add inherited annotation to unit test
This commit is contained in:
parent
ba6983153a
commit
1fd6ab04f8
|
|
@ -33,11 +33,13 @@ func TestSyncStatefulSetsAnnotations(t *testing.T) {
|
||||||
client, _ := newFakeK8sSyncClient()
|
client, _ := newFakeK8sSyncClient()
|
||||||
clusterName := "acid-test-cluster"
|
clusterName := "acid-test-cluster"
|
||||||
namespace := "default"
|
namespace := "default"
|
||||||
|
inheritedAnnotation := "environment"
|
||||||
|
|
||||||
pg := acidv1.Postgresql{
|
pg := acidv1.Postgresql{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Name: clusterName,
|
Name: clusterName,
|
||||||
Namespace: namespace,
|
Namespace: namespace,
|
||||||
|
Annotations: map[string]string{inheritedAnnotation: "test"},
|
||||||
},
|
},
|
||||||
Spec: acidv1.PostgresSpec{
|
Spec: acidv1.PostgresSpec{
|
||||||
Volume: acidv1.Volume{
|
Volume: acidv1.Volume{
|
||||||
|
|
@ -57,6 +59,7 @@ func TestSyncStatefulSetsAnnotations(t *testing.T) {
|
||||||
DefaultCPULimit: "300m",
|
DefaultCPULimit: "300m",
|
||||||
DefaultMemoryRequest: "300Mi",
|
DefaultMemoryRequest: "300Mi",
|
||||||
DefaultMemoryLimit: "300Mi",
|
DefaultMemoryLimit: "300Mi",
|
||||||
|
InheritedAnnotations: []string{inheritedAnnotation},
|
||||||
PodRoleLabel: "spilo-role",
|
PodRoleLabel: "spilo-role",
|
||||||
ResourceCheckInterval: time.Duration(3),
|
ResourceCheckInterval: time.Duration(3),
|
||||||
ResourceCheckTimeout: time.Duration(10),
|
ResourceCheckTimeout: time.Duration(10),
|
||||||
|
|
@ -104,4 +107,9 @@ func TestSyncStatefulSetsAnnotations(t *testing.T) {
|
||||||
if !cmp.match {
|
if !cmp.match {
|
||||||
t.Errorf("%s: current and desired statefulsets are not matching %#v", testName, cmp)
|
t.Errorf("%s: current and desired statefulsets are not matching %#v", testName, cmp)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// check if inherited annotation exists
|
||||||
|
if _, exists := desiredSts.Annotations[inheritedAnnotation]; !exists {
|
||||||
|
t.Errorf("%s: inherited annotation not found in desired statefulset: %#v", testName, desiredSts.Annotations)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue