Skip to content

Commit 0a869ac

Browse files
committed
Use different resource versions each time
In this way, we avoid having to skip over "stale" watch events. The downside is having to keep track of the previous resource version.
1 parent 4582e26 commit 0a869ac

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

test/e2e/common/configmap.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ var _ = ginkgo.Describe("[sig-node] ConfigMap", func() {
194194
framework.ExpectNoError(err)
195195

196196
ginkgo.By("creating a ConfigMap")
197-
_, err = f.ClientSet.CoreV1().ConfigMaps(testNamespaceName).Create(context.TODO(), &testConfigMap, metav1.CreateOptions{})
197+
cm, err := f.ClientSet.CoreV1().ConfigMaps(testNamespaceName).Create(context.TODO(), &testConfigMap, metav1.CreateOptions{})
198198
framework.ExpectNoError(err, "failed to create ConfigMap")
199199

200200
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
@@ -228,12 +228,12 @@ var _ = ginkgo.Describe("[sig-node] ConfigMap", func() {
228228
framework.ExpectNoError(err, "failed to marshal patch data")
229229

230230
ginkgo.By("patching the ConfigMap")
231-
_, err = f.ClientSet.CoreV1().ConfigMaps(testNamespaceName).Patch(context.TODO(), testConfigMapName, types.StrategicMergePatchType, []byte(configMapPatchPayload), metav1.PatchOptions{})
231+
cm2, err := f.ClientSet.CoreV1().ConfigMaps(testNamespaceName).Patch(context.TODO(), testConfigMapName, types.StrategicMergePatchType, []byte(configMapPatchPayload), metav1.PatchOptions{})
232232
framework.ExpectNoError(err, "failed to patch ConfigMap")
233233
ginkgo.By("waiting for the ConfigMap to be modified")
234234
ctx, cancel = context.WithTimeout(context.Background(), 30*time.Second)
235235
defer cancel()
236-
_, err = watchtools.Until(ctx, cml.ResourceVersion, w, func(event watch.Event) (bool, error) {
236+
_, err = watchtools.Until(ctx, cm.ResourceVersion, w, func(event watch.Event) (bool, error) {
237237
switch event.Type {
238238
case watch.Modified:
239239
if cm, ok := event.Object.(*v1.ConfigMap); ok {
@@ -282,7 +282,7 @@ var _ = ginkgo.Describe("[sig-node] ConfigMap", func() {
282282
ginkgo.By("waiting for the ConfigMap to be deleted")
283283
ctx, cancel = context.WithTimeout(context.Background(), 30*time.Second)
284284
defer cancel()
285-
_, err = watchtools.Until(ctx, cml.ResourceVersion, w, func(event watch.Event) (bool, error) {
285+
_, err = watchtools.Until(ctx, cm2.ResourceVersion, w, func(event watch.Event) (bool, error) {
286286
switch event.Type {
287287
case watch.Deleted:
288288
if cm, ok := event.Object.(*v1.ConfigMap); ok {

0 commit comments

Comments
 (0)