Skip to content

Commit 398bcaa

Browse files
authored
Merge pull request #120 from tpantelis/use_new_cond_type_defs
Use new ServiceExport Condition definitions in conformance tests
2 parents 85bcb03 + 7dc6eae commit 398bcaa

File tree

3 files changed

+13
-10
lines changed

3 files changed

+13
-10
lines changed

conformance/conformance_suite.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -288,12 +288,13 @@ func (t *testDriver) ensureNoServiceImport(c *clusterClients, name, nonConforman
288288
}, 5*time.Second, 100*time.Millisecond).Should(BeTrue(), reportNonConformant(nonConformanceMsg))
289289
}
290290

291-
func (t *testDriver) awaitServiceExportCondition(c *clusterClients, condType string, wantStatus metav1.ConditionStatus) {
291+
func (t *testDriver) awaitServiceExportCondition(c *clusterClients, condType v1alpha1.ServiceExportConditionType,
292+
wantStatus metav1.ConditionStatus) {
292293
Eventually(func() bool {
293294
se, err := c.mcs.MulticlusterV1alpha1().ServiceExports(t.namespace).Get(ctx, helloServiceName, metav1.GetOptions{})
294295
Expect(err).ToNot(HaveOccurred())
295296

296-
cond := meta.FindStatusCondition(se.Status.Conditions, condType)
297+
cond := meta.FindStatusCondition(se.Status.Conditions, string(condType))
297298
return cond != nil && cond.Status == wantStatus
298299
}, 20*time.Second, 100*time.Millisecond).Should(BeTrue(),
299300
reportNonConformant(fmt.Sprintf("The %s condition was not set to %s", condType, wantStatus)))

conformance/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ require (
99
k8s.io/apimachinery v0.32.5
1010
k8s.io/client-go v0.32.5
1111
k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738
12-
sigs.k8s.io/mcs-api v0.1.0
12+
sigs.k8s.io/mcs-api v0.2.1-0.20250806212941-7dbcbd12a231
1313
)
1414

1515
replace sigs.k8s.io/mcs-api => ..

conformance/service_import.go

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,8 @@ func testGeneralServiceImport() {
131131
Label(OptionalLabel), Label(ExportedLabelsLabel), func() {
132132
AddReportEntry(SpecRefReportEntry, "https://github.com/kubernetes/enhancements/tree/master/keps/sig-multicluster/1645-multi-cluster-services-api#labels-and-annotations")
133133

134-
t.awaitServiceExportCondition(&clients[0], v1alpha1.ServiceExportConflict, metav1.ConditionTrue)
135-
t.awaitServiceExportCondition(&clients[1], v1alpha1.ServiceExportConflict, metav1.ConditionTrue)
134+
t.awaitServiceExportCondition(&clients[0], v1alpha1.ServiceExportConditionConflict, metav1.ConditionTrue)
135+
t.awaitServiceExportCondition(&clients[1], v1alpha1.ServiceExportConditionConflict, metav1.ConditionTrue)
136136

137137
t.awaitServiceImport(&clients[0], t.helloService.Name, false,
138138
func(g Gomega, serviceImport *v1alpha1.ServiceImport) {
@@ -163,6 +163,8 @@ func testClusterIPServiceImport() {
163163
"Unexporting should delete the ServiceImport", Label(RequiredLabel), func() {
164164
AddReportEntry(SpecRefReportEntry, "https://github.com/kubernetes/enhancements/tree/master/keps/sig-multicluster/1645-multi-cluster-services-api#importing-services")
165165

166+
t.awaitServiceExportCondition(&clients[0], v1alpha1.ServiceExportConditionValid, metav1.ConditionTrue)
167+
166168
for i := range clients {
167169
serviceImport := t.awaitServiceImport(&clients[i], helloServiceName, true, nil)
168170

@@ -245,8 +247,8 @@ func testClusterIPServiceImport() {
245247
Specify("should apply the conflict resolution policy and report a Conflict condition on each ServiceExport", func() {
246248
AddReportEntry(SpecRefReportEntry, "https://github.com/kubernetes/enhancements/tree/master/keps/sig-multicluster/1645-multi-cluster-services-api#service-port")
247249

248-
t.awaitServiceExportCondition(&clients[0], v1alpha1.ServiceExportConflict, metav1.ConditionTrue)
249-
t.awaitServiceExportCondition(&clients[1], v1alpha1.ServiceExportConflict, metav1.ConditionTrue)
250+
t.awaitServiceExportCondition(&clients[0], v1alpha1.ServiceExportConditionConflict, metav1.ConditionTrue)
251+
t.awaitServiceExportCondition(&clients[1], v1alpha1.ServiceExportConditionConflict, metav1.ConditionTrue)
250252

251253
t.awaitServiceImport(&clients[0], t.helloService.Name, false,
252254
func(g Gomega, serviceImport *v1alpha1.ServiceImport) {
@@ -314,7 +316,7 @@ func testExternalNameService() {
314316
Specify("Exporting an ExternalName service should set ServiceExport Valid condition to False", Label(RequiredLabel), func() {
315317
AddReportEntry(SpecRefReportEntry, "https://github.com/kubernetes/enhancements/blob/master/keps/sig-multicluster/1645-multi-cluster-services-api/README.md#service-types")
316318

317-
t.awaitServiceExportCondition(&clients[0], v1alpha1.ServiceExportValid, metav1.ConditionFalse)
319+
t.awaitServiceExportCondition(&clients[0], v1alpha1.ServiceExportConditionValid, metav1.ConditionFalse)
318320
t.ensureNoServiceImport(&clients[0], helloServiceName,
319321
"the ServiceImport should not exist for an ExternalName service")
320322
})
@@ -335,7 +337,7 @@ func testServiceTypeConflict() {
335337
"report a Conflict condition on the ServiceExport", Label(RequiredLabel), func() {
336338
AddReportEntry(SpecRefReportEntry, "https://github.com/kubernetes/enhancements/tree/master/keps/sig-multicluster/1645-multi-cluster-services-api#headlessness")
337339

338-
t.awaitServiceExportCondition(&clients[0], v1alpha1.ServiceExportConflict, metav1.ConditionTrue)
339-
t.awaitServiceExportCondition(&clients[1], v1alpha1.ServiceExportConflict, metav1.ConditionTrue)
340+
t.awaitServiceExportCondition(&clients[0], v1alpha1.ServiceExportConditionConflict, metav1.ConditionTrue)
341+
t.awaitServiceExportCondition(&clients[1], v1alpha1.ServiceExportConditionConflict, metav1.ConditionTrue)
340342
})
341343
}

0 commit comments

Comments
 (0)