Skip to content

Commit 52efdcf

Browse files
committed
Add conformance test to verify resolution of conflicting service types
Fixes #92 Signed-off-by: Tom Pantelis <[email protected]>
1 parent 2abe65e commit 52efdcf

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

conformance/service_import.go

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ var (
3333
_ = Describe("", Label(ClusterIPLabel), testClusterIPServiceImport)
3434
_ = Describe("", Label(HeadlessLabel), testHeadlessServiceImport)
3535
_ = Describe("", Label(ExternalNameLabel), testExternalNameService)
36+
_ = Describe("", testServiceTypeConflict)
3637
)
3738

3839
func testGeneralServiceImport() {
@@ -326,3 +327,29 @@ func testExternalNameService() {
326327
"the ServiceImport should not exist for an ExternalName service")
327328
})
328329
}
330+
331+
func testServiceTypeConflict() {
332+
t := newTwoClusterTestDriver(newTestDriver())
333+
334+
BeforeEach(func() {
335+
t.helloService2.Spec.ClusterIP = corev1.ClusterIPNone
336+
})
337+
338+
JustBeforeEach(func() {
339+
t.createServiceExport(&clients[0], newHelloServiceExport())
340+
})
341+
342+
Specify("A service exported on two clusters with conflicting headlessness should apply the conflict resolution policy and "+
343+
"report a Conflict condition on the ServiceExport", Label(RequiredLabel), func() {
344+
AddReportEntry(SpecRefReportEntry, "https://github.com/kubernetes/enhancements/tree/master/keps/sig-multicluster/1645-multi-cluster-services-api#headlessness")
345+
346+
t.awaitServiceExportCondition(&clients[1], v1alpha1.ServiceExportConflict, metav1.ConditionTrue)
347+
348+
for i := range clients {
349+
serviceImport := t.awaitServiceImport(&clients[i], helloServiceName, true, nil)
350+
351+
Expect(serviceImport.Spec.Type).To(Equal(v1alpha1.ClusterSetIP), reportNonConformant(
352+
fmt.Sprintf("ServiceImport on cluster %q has type %q", clients[i].name, serviceImport.Spec.Type)))
353+
}
354+
})
355+
}

0 commit comments

Comments
 (0)