@@ -21,39 +21,41 @@ func Test_ListXVSHNPostgreSQL(t *testing.T) {
21
21
namespace : "namespace-prod" ,
22
22
postgresqls : & vshnv1.XVSHNPostgreSQLList {
23
23
Items : []vshnv1.XVSHNPostgreSQL {
24
- getInstance ("prod" , "namespace-prod" ),
25
- getInstance ("prod-2" , "namespace-prod-2" ),
24
+ getInstance ("prod" , "namespace-prod" , "instance-namespace" ),
25
+ getInstance ("prod-2" , "namespace-prod-2" , "instance-namespace" ),
26
26
getInstanceWithoutLabels ("prod-3" ),
27
27
getInstanceWithoutLabels ("prod" ),
28
28
getInstanceWithoutClaimName ("prod" , "namespace-prod" ),
29
29
getInstanceWithoutClaimName ("prod-3" , "namespace-prod-2" ),
30
30
getInstanceWithoutClaimNamespace ("prod" ),
31
31
getInstanceWithoutClaimNamespace ("prod-3" ),
32
- getInstance ("test" , "namespace-test-2" ),
33
- getInstance ("test" , "namespace-prod" ),
32
+ getInstance ("test" , "namespace-test-2" , "instance-namespace" ),
33
+ getInstance ("test" , "namespace-prod" , "instance-namespace" ),
34
+ getInstanceWithoutInstanceNamespace ("test" , "namespace-prod" ),
34
35
},
35
36
},
36
37
expectedPostgresqls : & vshnv1.XVSHNPostgreSQLList {
37
38
Items : []vshnv1.XVSHNPostgreSQL {
38
- getInstance ("prod" , "namespace-prod" ),
39
- getInstance ("test" , "namespace-prod" ),
39
+ getInstance ("prod" , "namespace-prod" , "instance-namespace" ),
40
+ getInstance ("test" , "namespace-prod" , "instance-namespace" ),
40
41
},
41
42
},
42
43
},
43
44
"GivenAListOfPostgreSQLs_ThenFilter_2" : {
44
45
namespace : "namespace-not-match" ,
45
46
postgresqls : & vshnv1.XVSHNPostgreSQLList {
46
47
Items : []vshnv1.XVSHNPostgreSQL {
47
- getInstance ("prod" , "namespace-prod" ),
48
- getInstance ("prod-2" , "namespace-prod-2" ),
48
+ getInstance ("prod" , "namespace-prod" , "instance-namespace" ),
49
+ getInstance ("prod" , "namespace-prod" , "instance-namespace" ),
50
+ getInstance ("prod-2" , "namespace-prod-2" , "instance-namespace" ),
49
51
getInstanceWithoutLabels ("prod-3" ),
50
52
getInstanceWithoutLabels ("prod" ),
51
53
getInstanceWithoutClaimName ("prod" , "namespace-prod" ),
52
54
getInstanceWithoutClaimName ("prod-3" , "namespace-prod-2" ),
53
55
getInstanceWithoutClaimNamespace ("prod" ),
54
56
getInstanceWithoutClaimNamespace ("prod-3" ),
55
- getInstance ("test" , "namespace-test-2" ),
56
- getInstance ("test" , "namespace-prod" ),
57
+ getInstance ("test" , "namespace-test-2" , "instance-namespace" ),
58
+ getInstance ("test" , "namespace-prod" , "instance-namespace" ),
57
59
},
58
60
},
59
61
expectedPostgresqls : & vshnv1.XVSHNPostgreSQLList {
@@ -118,7 +120,7 @@ func getInstanceWithoutLabels(name string) vshnv1.XVSHNPostgreSQL {
118
120
}
119
121
}
120
122
121
- func getInstance (name , namespace string ) vshnv1.XVSHNPostgreSQL {
123
+ func getInstanceWithoutInstanceNamespace (name , namespace string ) vshnv1.XVSHNPostgreSQL {
122
124
return vshnv1.XVSHNPostgreSQL {
123
125
ObjectMeta : metav1.ObjectMeta {
124
126
Name : name + "-tty" ,
@@ -129,3 +131,18 @@ func getInstance(name, namespace string) vshnv1.XVSHNPostgreSQL {
129
131
},
130
132
}
131
133
}
134
+
135
+ func getInstance (name , namespace , instanceNamespace string ) vshnv1.XVSHNPostgreSQL {
136
+ return vshnv1.XVSHNPostgreSQL {
137
+ ObjectMeta : metav1.ObjectMeta {
138
+ Name : name + "-tty" ,
139
+ Labels : map [string ]string {
140
+ claimNameLabel : name ,
141
+ claimNamespaceLabel : namespace ,
142
+ },
143
+ },
144
+ Status : vshnv1.VSHNPostgreSQLStatus {
145
+ InstanceNamespace : instanceNamespace ,
146
+ },
147
+ }
148
+ }
0 commit comments