Skip to content

Commit 4582e26

Browse files
committed
Now use the stock watchtools.Until
By passing in the same initial resource version each time, we get all watch events from the beginning each time.
1 parent 1048ddd commit 4582e26

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

test/e2e/common/configmap.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -192,15 +192,14 @@ var _ = ginkgo.Describe("[sig-node] ConfigMap", func() {
192192
}
193193
cml, err := f.ClientSet.CoreV1().ConfigMaps(testNamespaceName).List(context.TODO(), metav1.ListOptions{LabelSelector: "test-configmap-static=true"})
194194
framework.ExpectNoError(err)
195-
retryWatcher, err := watchtools.NewRetryWatcher(cml.ResourceVersion, w)
196195

197196
ginkgo.By("creating a ConfigMap")
198197
_, err = f.ClientSet.CoreV1().ConfigMaps(testNamespaceName).Create(context.TODO(), &testConfigMap, metav1.CreateOptions{})
199198
framework.ExpectNoError(err, "failed to create ConfigMap")
200199

201200
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
202201
defer cancel()
203-
_, err = framework.WatchUntilWithoutRetry(ctx, retryWatcher, func(event watch.Event) (bool, error) {
202+
_, err = watchtools.Until(ctx, cml.ResourceVersion, w, func(event watch.Event) (bool, error) {
204203
switch event.Type {
205204
case watch.Added:
206205
if cm, ok := event.Object.(*v1.ConfigMap); ok {
@@ -234,7 +233,7 @@ var _ = ginkgo.Describe("[sig-node] ConfigMap", func() {
234233
ginkgo.By("waiting for the ConfigMap to be modified")
235234
ctx, cancel = context.WithTimeout(context.Background(), 30*time.Second)
236235
defer cancel()
237-
_, err = framework.WatchUntilWithoutRetry(ctx, retryWatcher, func(event watch.Event) (bool, error) {
236+
_, err = watchtools.Until(ctx, cml.ResourceVersion, w, func(event watch.Event) (bool, error) {
238237
switch event.Type {
239238
case watch.Modified:
240239
if cm, ok := event.Object.(*v1.ConfigMap); ok {
@@ -283,7 +282,7 @@ var _ = ginkgo.Describe("[sig-node] ConfigMap", func() {
283282
ginkgo.By("waiting for the ConfigMap to be deleted")
284283
ctx, cancel = context.WithTimeout(context.Background(), 30*time.Second)
285284
defer cancel()
286-
_, err = framework.WatchUntilWithoutRetry(ctx, retryWatcher, func(event watch.Event) (bool, error) {
285+
_, err = watchtools.Until(ctx, cml.ResourceVersion, w, func(event watch.Event) (bool, error) {
287286
switch event.Type {
288287
case watch.Deleted:
289288
if cm, ok := event.Object.(*v1.ConfigMap); ok {

0 commit comments

Comments
 (0)