From b9907f43568edcd3d248ad19d22b5643b0cf7285 Mon Sep 17 00:00:00 2001 From: Kevin Su Date: Wed, 6 Dec 2023 15:52:14 -0800 Subject: [PATCH] Fix flaky test_monitor (#4537) * Fix flaky test_monitor Signed-off-by: Kevin Su * fix test Signed-off-by: Kevin Su --------- Signed-off-by: Kevin Su Co-authored-by: Eduardo Apolinario <653394+eapolinario@users.noreply.github.com> --- .../go/tasks/pluginmachinery/internal/webapi/monitor_test.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/flyteplugins/go/tasks/pluginmachinery/internal/webapi/monitor_test.go b/flyteplugins/go/tasks/pluginmachinery/internal/webapi/monitor_test.go index c47d77ae76..1628582156 100644 --- a/flyteplugins/go/tasks/pluginmachinery/internal/webapi/monitor_test.go +++ b/flyteplugins/go/tasks/pluginmachinery/internal/webapi/monitor_test.go @@ -21,6 +21,7 @@ import ( func Test_monitor(t *testing.T) { ctx := context.Background() + ctx, cancel := context.WithCancel(ctx) tCtx := &mocks.TaskExecutionContext{} ctxMeta := &mocks.TaskExecutionMetadata{} execID := &mocks.TaskExecutionID{} @@ -70,6 +71,7 @@ func Test_monitor(t *testing.T) { // Wait for sync to run to actually delete the resource wg.Wait() + cancel() cachedItem, err = cacheObj.GetOrCreate("generated_name", CacheItem{Resource: "new_resource"}) assert.NoError(t, err) assert.Equal(t, "new_resource", cachedItem.(CacheItem).Resource.(string))