From 7dc075673c24ffd8bde08a4c7ec55a8b633b20e2 Mon Sep 17 00:00:00 2001 From: Abu Kashem Date: Mon, 16 Mar 2020 17:43:32 -0400 Subject: [PATCH] Fix data race issue in unit test TestDispatchingBookmarkEventsWithConcurrentStop can use processEvent instead of `dispatchEvent` to avoid data race conditions with `Cacher.watchersBuffer`. --- .../k8s.io/apiserver/pkg/storage/cacher/cacher_whitebox_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/staging/src/k8s.io/apiserver/pkg/storage/cacher/cacher_whitebox_test.go b/staging/src/k8s.io/apiserver/pkg/storage/cacher/cacher_whitebox_test.go index cd5d0f5f3a7..133e4ccc49d 100644 --- a/staging/src/k8s.io/apiserver/pkg/storage/cacher/cacher_whitebox_test.go +++ b/staging/src/k8s.io/apiserver/pkg/storage/cacher/cacher_whitebox_test.go @@ -793,7 +793,7 @@ func TestDispatchingBookmarkEventsWithConcurrentStop(t *testing.T) { wg := sync.WaitGroup{} wg.Add(2) go func() { - cacher.dispatchEvent(bookmark) + cacher.processEvent(bookmark) wg.Done() }()