Skip to content

Commit c90ccd8

Browse files
committed
Fix label issue in operator group e2e test
Signed-off-by: perdasilva <[email protected]>
1 parent 9f4f719 commit c90ccd8

File tree

5 files changed

+30
-4
lines changed

5 files changed

+30
-4
lines changed

test/e2e/gc_e2e_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -646,7 +646,7 @@ var _ = Describe("Garbage collection for dependent resources", func() {
646646
}).Should(BeNil())
647647
})
648648

649-
// issue: https://github.com/operator-framework/operator-lifecycle-manager/issues/2626
649+
// flake issue: https://github.com/operator-framework/operator-lifecycle-manager/issues/2626
650650
It("[FLAKY] should have removed the old configmap and put the new configmap in place", func() {
651651
Eventually(func() bool {
652652
_, err := kubeClient.GetConfigMap(testNamespace, configmapName)

test/e2e/operator_groups_e2e_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1899,7 +1899,7 @@ var _ = Describe("Operator Group", func() {
18991899
aCSV := newCSV(csvName, opGroupNamespace, "", semver.MustParse("0.0.0"), []apiextensions.CustomResourceDefinition{mainCRD}, nil, &namedStrategy)
19001900

19011901
// Use the It spec name as label after stripping whitespaces
1902-
aCSV.Labels = map[string]string{"label": strings.Replace(CurrentGinkgoTestDescription().TestText, " ", "", -1)}
1902+
aCSV.Labels = map[string]string{"label": RemoveNonAlphanumericCharacters(CurrentGinkgoTestDescription().TestText)}
19031903
createdCSV, err := crc.OperatorsV1alpha1().ClusterServiceVersions(opGroupNamespace).Create(context.TODO(), &aCSV, metav1.CreateOptions{})
19041904
require.NoError(GinkgoT(), err)
19051905

test/e2e/operator_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,8 @@ var _ = Describe("Operator API", func() {
7070
// 14. Ensure the reference to ns-a is eventually removed from o's status.components.refs field
7171
// 15. Delete o
7272
// 16. Ensure o is not re-created
73-
It("should surface components in its status", func() {
73+
// issue: https://github.com/operator-framework/operator-lifecycle-manager/issues/2628
74+
It("[FLAKY] should surface components in its status", func() {
7475
o := &operatorsv1.Operator{}
7576
o.SetName(genName("o-"))
7677

test/e2e/util.go

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1030,3 +1030,27 @@ func inKind(client operatorclient.ClientInterface) (bool, error) {
10301030
}
10311031
return false, nil
10321032
}
1033+
1034+
// RemoveNonAlphanumericCharacters removes all non-alphanumeric runes from a slice
1035+
func RemoveNonAlphanumericCharacters(in string) string {
1036+
return filterSlice(in, alphanumericFilter)
1037+
}
1038+
1039+
// filterSlice removes characters from a slice using the protocol set by the filterFn
1040+
func filterSlice(in string, filterFn func(int, int, rune) bool) string {
1041+
var stringBuilder strings.Builder
1042+
for pos, char := range in {
1043+
mustFilter := filterFn(pos, len(in), char)
1044+
if mustFilter {
1045+
stringBuilder.WriteRune(char)
1046+
}
1047+
fmt.Printf("%c (%d) %d/%d %t\n", char, char, pos, len(in), mustFilter)
1048+
}
1049+
return stringBuilder.String()
1050+
}
1051+
1052+
// alphanumericFilter returns true is the character is alphaNumeric
1053+
func alphanumericFilter(index int, length int, char rune) bool {
1054+
isAlphaNumeric := (char >= 48 && char <= 57) || (char >= 65 && char <= 90) || (char >= 97 && char <= 122)
1055+
return isAlphaNumeric
1056+
}

test/e2e/webhook_e2e_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,8 @@ var _ = Describe("CSVs with a Webhook", func() {
434434
return false, nil
435435
}).Should(BeTrue())
436436
})
437-
It("Is updated when the CAs expire", func() {
437+
// issue: https://github.com/operator-framework/operator-lifecycle-manager/issues/2629
438+
It("[FLAKY] Is updated when the CAs expire", func() {
438439
sideEffect := admissionregistrationv1.SideEffectClassNone
439440
webhook := operatorsv1alpha1.WebhookDescription{
440441
GenerateName: webhookName,

0 commit comments

Comments
 (0)