Skip to content

Commit d7229f1

Browse files
author
Jeff Peeler
committed
fix(e2e): slightly improves execution time
1 parent ae457b3 commit d7229f1

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

pkg/controller/operators/olm/operatorgroup.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ func (a *Operator) syncOperatorGroups(obj interface{}) error {
2121
log.Debugf("wrong type: %#v\n", obj)
2222
return fmt.Errorf("casting OperatorGroup failed")
2323
}
24+
log.Infof("syncing operator group %v", op)
2425

2526
err, targetedNamespaces := a.updateNamespaceList(op)
2627
log.Debugf("Got targetedNamespaces: '%v'", targetedNamespaces)

test/e2e/operator_groups_e2e_test.go

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -116,18 +116,23 @@ func TestOperatorGroup(t *testing.T) {
116116
Name: "e2e-operator-group",
117117
Namespace: testNamespace,
118118
},
119-
Spec: v1alpha2.OperatorGroupSpec{
120-
Selector: metav1.LabelSelector{
121-
MatchLabels: matchingLabel,
122-
},
123-
},
124119
}
125120
_, err = crc.OperatorsV1alpha2().OperatorGroups(testNamespace).Create(&operatorGroup)
126121
require.NoError(t, err)
127122
expectedOperatorGroupStatus := v1alpha2.OperatorGroupStatus{
128123
Namespaces: []*corev1.Namespace{createdOtherNamespace},
129124
}
130125

126+
// instead of setting the label selector initially, do it here to force immediate reconcile
127+
fetchedOpGroup, err := crc.OperatorsV1alpha2().OperatorGroups(testNamespace).Get(operatorGroup.GetName(), metav1.GetOptions{})
128+
fetchedOpGroup.Spec = v1alpha2.OperatorGroupSpec{
129+
Selector: metav1.LabelSelector{
130+
MatchLabels: matchingLabel,
131+
},
132+
}
133+
_, err = crc.OperatorsV1alpha2().OperatorGroups(testNamespace).Update(fetchedOpGroup)
134+
require.NoError(t, err)
135+
131136
log.Debug("Waiting on operator group to have correct status")
132137
err = wait.Poll(pollInterval, pollDuration, func() (bool, error) {
133138
fetched, fetchErr := crc.OperatorsV1alpha2().OperatorGroups(testNamespace).Get(operatorGroup.Name, metav1.GetOptions{})

0 commit comments

Comments
 (0)