@@ -44,10 +44,6 @@ func testGeneralServiceImport() {
4444 helloServiceExport = newHelloServiceExport ()
4545 })
4646
47- JustBeforeEach (func () {
48- t .createServiceExport (& clients [0 ], helloServiceExport )
49- })
50-
5147 assertHasKeyValues := func (g Gomega , actual , expected map [string ]string ) {
5248 for k , v := range expected {
5349 g .Expect (actual ).To (HaveKeyWithValue (k , v ), reportNonConformant ("" ))
@@ -148,17 +144,8 @@ func testGeneralServiceImport() {
148144}
149145
150146func testClusterIPServiceImport () {
151- var helloServiceExport * v1alpha1.ServiceExport
152147 t := newTestDriver ()
153148
154- BeforeEach (func () {
155- helloServiceExport = newHelloServiceExport ()
156- })
157-
158- JustBeforeEach (func () {
159- t .createServiceExport (& clients [0 ], helloServiceExport )
160- })
161-
162149 Specify ("Exporting a ClusterIP service should create a ServiceImport of type ClusterSetIP in the service's namespace in each cluster. " +
163150 "Unexporting should delete the ServiceImport" , Label (RequiredLabel ), func () {
164151 AddReportEntry (SpecRefReportEntry , "https://github.com/kubernetes/enhancements/tree/master/keps/sig-multicluster/1645-multi-cluster-services-api#importing-services" )
@@ -267,10 +254,6 @@ func testHeadlessServiceImport() {
267254 t .helloService .Spec .ClusterIP = corev1 .ClusterIPNone
268255 })
269256
270- JustBeforeEach (func () {
271- t .createServiceExport (& clients [0 ], newHelloServiceExport ())
272- })
273-
274257 Specify ("Exporting a headless service should create a ServiceImport of type Headless in the service's namespace in each cluster. " +
275258 "Unexporting should delete the ServiceImport" , Label (RequiredLabel ), func () {
276259 AddReportEntry (SpecRefReportEntry , "https://github.com/kubernetes/enhancements/tree/master/keps/sig-multicluster/1645-multi-cluster-services-api#service-types" )
@@ -309,10 +292,6 @@ func testExternalNameService() {
309292 t .helloService .Spec .ExternalName = "example.com"
310293 })
311294
312- JustBeforeEach (func () {
313- t .createServiceExport (& clients [0 ], newHelloServiceExport ())
314- })
315-
316295 Specify ("Exporting an ExternalName service should set ServiceExport Valid condition to False" , Label (RequiredLabel ), func () {
317296 AddReportEntry (SpecRefReportEntry , "https://github.com/kubernetes/enhancements/blob/master/keps/sig-multicluster/1645-multi-cluster-services-api/README.md#service-types" )
318297
@@ -329,15 +308,18 @@ func testServiceTypeConflict() {
329308 t .helloService2 .Spec .ClusterIP = corev1 .ClusterIPNone
330309 })
331310
332- JustBeforeEach (func () {
333- t .createServiceExport (& clients [0 ], newHelloServiceExport ())
334- })
335-
336311 Specify ("A service exported on two clusters with conflicting headlessness should apply the conflict resolution policy and " +
337312 "report a Conflict condition on the ServiceExport" , Label (RequiredLabel ), func () {
338313 AddReportEntry (SpecRefReportEntry , "https://github.com/kubernetes/enhancements/tree/master/keps/sig-multicluster/1645-multi-cluster-services-api#headlessness" )
339314
340315 t .awaitServiceExportCondition (& clients [0 ], v1alpha1 .ServiceExportConditionConflict , metav1 .ConditionTrue )
341316 t .awaitServiceExportCondition (& clients [1 ], v1alpha1 .ServiceExportConditionConflict , metav1 .ConditionTrue )
317+
318+ for i := range clients {
319+ serviceImport := t .awaitServiceImport (& clients [i ], helloServiceName , true , nil )
320+
321+ Expect (serviceImport .Spec .Type ).To (Equal (v1alpha1 .ClusterSetIP ), reportNonConformant (
322+ fmt .Sprintf ("ServiceImport on cluster %q has type %q" , clients [i ].name , serviceImport .Spec .Type )))
323+ }
342324 })
343325}
0 commit comments