Skip to content

Commit 91d5124

Browse files
committed
cleanup tmc e2e tests to remove data races
Signed-off-by: David Festal <[email protected]>
1 parent abdae2b commit 91d5124

File tree

3 files changed

+44
-27
lines changed

3 files changed

+44
-27
lines changed

test/e2e/reconciler/scheduling/upsynced_scheduling_test.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,13 +125,12 @@ func TestUpsyncedScheduling(t *testing.T) {
125125

126126
// Create a client that uses the upsyncer URL
127127
upsyncerVirtualWorkspaceConfig := rest.CopyConfig(upstreamConfig)
128-
var upsyncerVirtualWorkspaceURL string
129-
framework.Eventually(t, func() (found bool, message string) {
130-
upsyncerVirtualWorkspaceURL, found, err = framework.VirtualWorkspaceURL(ctx, upstreamKcpClient, userWs, syncerFixture.GetUpsyncerVirtualWorkspaceURLs())
128+
framework.Eventually(t, func() (found bool, _ string) {
129+
var err error
130+
upsyncerVirtualWorkspaceConfig.Host, found, err = framework.VirtualWorkspaceURL(ctx, upstreamKcpClient, userWs, syncerFixture.GetUpsyncerVirtualWorkspaceURLs())
131131
require.NoError(t, err)
132132
return found, "Upsyncer virtual workspace URL not found"
133133
}, wait.ForeverTestTimeout, time.Millisecond*100, "Upsyncer virtual workspace URL not found")
134-
upsyncerVirtualWorkspaceConfig.Host = upsyncerVirtualWorkspaceURL
135134
upsyncerKCPClient, err := kcpkubernetesclientset.NewForConfig(upsyncerVirtualWorkspaceConfig)
136135
require.NoError(t, err)
137136

test/e2e/syncer/tunnels_test.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -379,13 +379,12 @@ func TestSyncerTunnelFilter(t *testing.T) {
379379

380380
// Create a pod on the upstream namespace that looks like the downstream pod being upsynced.
381381
upsyncerVirtualWorkspaceConfig := rest.CopyConfig(kcpServer.BaseConfig(t))
382-
var upsyncerVirtualWorkspaceURL string
383-
framework.Eventually(t, func() (found bool, message string) {
384-
upsyncerVirtualWorkspaceURL, found, err = framework.VirtualWorkspaceURL(ctx, kcpClient, userWs, syncerFixture.GetUpsyncerVirtualWorkspaceURLs())
382+
framework.Eventually(t, func() (found bool, _ string) {
383+
var err error
384+
upsyncerVirtualWorkspaceConfig.Host, found, err = framework.VirtualWorkspaceURL(ctx, kcpClient, userWs, syncerFixture.GetUpsyncerVirtualWorkspaceURLs())
385385
require.NoError(t, err)
386386
return found, "Upsyncer virtual workspace URL not found"
387387
}, wait.ForeverTestTimeout, time.Millisecond*100, "Upsyncer virtual workspace URL not found")
388-
upsyncerVirtualWorkspaceConfig.Host = upsyncerVirtualWorkspaceURL
389388
upsyncedClient, err := kcpkubernetesclientset.NewForConfig(upsyncerVirtualWorkspaceConfig)
390389
require.NoError(t, err)
391390

test/e2e/virtual/syncer/virtualworkspace_test.go

Lines changed: 38 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,8 @@ func TestSyncerVirtualWorkspace(t *testing.T) {
279279
rootComputeLogicalCluster := logicalcluster.From(export)
280280

281281
kubelikeVWDiscoverConfig := rest.CopyConfig(server.BaseConfig(t))
282-
framework.Eventually(t, func() (found bool, message string) {
282+
framework.Eventually(t, func() (found bool, _ string) {
283+
var err error
283284
kubelikeVWDiscoverConfig.Host, found, err = framework.VirtualWorkspaceURL(ctx, kcpClusterClient, kubelikeLocationWorkspace, kubelikeSyncer.GetSyncerVirtualWorkspaceURLs())
284285
require.NoError(t, err)
285286
return found, "Syncer virtual workspace URL not found"
@@ -300,7 +301,8 @@ func TestSyncerVirtualWorkspace(t *testing.T) {
300301
}, wait.ForeverTestTimeout, time.Millisecond*100)
301302

302303
wildwestVWDiscoverConfig := rest.CopyConfig(server.BaseConfig(t))
303-
framework.Eventually(t, func() (found bool, message string) {
304+
framework.Eventually(t, func() (found bool, _ string) {
305+
var err error
304306
wildwestVWDiscoverConfig.Host, found, err = framework.VirtualWorkspaceURL(ctx, kcpClusterClient, wildwestLocationWorkspace, wildwestSyncer.GetSyncerVirtualWorkspaceURLs())
305307
require.NoError(t, err)
306308
return found, "Syncer virtual workspace URL not found"
@@ -405,7 +407,8 @@ func TestSyncerVirtualWorkspace(t *testing.T) {
405407
}, wait.ForeverTestTimeout, time.Millisecond*100, "token secret for default service account not created")
406408

407409
wildwestVWConfig := rest.CopyConfig(server.BaseConfig(t))
408-
framework.Eventually(t, func() (found bool, message string) {
410+
framework.Eventually(t, func() (found bool, _ string) {
411+
var err error
409412
wildwestVWConfig.Host, found, err = framework.VirtualWorkspaceURL(ctx, kcpClusterClient, wildwestLocationWorkspace, wildwestSyncer.GetSyncerVirtualWorkspaceURLs())
410413
require.NoError(t, err)
411414
return found, "Syncer virtual workspace URL not found"
@@ -533,7 +536,8 @@ func TestSyncerVirtualWorkspace(t *testing.T) {
533536
require.NoError(t, err)
534537

535538
wildwestVWConfig := rest.CopyConfig(server.BaseConfig(t))
536-
framework.Eventually(t, func() (found bool, message string) {
539+
framework.Eventually(t, func() (found bool, _ string) {
540+
var err error
537541
wildwestVWConfig.Host, found, err = framework.VirtualWorkspaceURL(ctx, kcpClusterClient, wildwestLocationWorkspace, wildwestSyncer.GetSyncerVirtualWorkspaceURLs())
538542
require.NoError(t, err)
539543
return found, "Syncer virtual workspace URL not found"
@@ -691,7 +695,8 @@ func TestSyncerVirtualWorkspace(t *testing.T) {
691695
require.NoError(t, err)
692696

693697
wildwestVWConfig := rest.CopyConfig(server.BaseConfig(t))
694-
framework.Eventually(t, func() (found bool, message string) {
698+
framework.Eventually(t, func() (found bool, _ string) {
699+
var err error
695700
wildwestVWConfig.Host, found, err = framework.VirtualWorkspaceURL(ctx, kcpClusterClient, consumerWorkspace, wildwestSyncer.GetSyncerVirtualWorkspaceURLs())
696701
require.NoError(t, err)
697702
return found, "Syncer virtual workspace URL not found"
@@ -934,7 +939,8 @@ func TestSyncerVirtualWorkspace(t *testing.T) {
934939
require.NoError(t, err)
935940

936941
wildwestNorthVWConfig := rest.CopyConfig(server.BaseConfig(t))
937-
framework.Eventually(t, func() (found bool, message string) {
942+
framework.Eventually(t, func() (found bool, _ string) {
943+
var err error
938944
wildwestNorthVWConfig.Host, found, err = framework.VirtualWorkspaceURL(ctx, kcpClusterClient, consumerWorkspace, wildwestNorthSyncer.GetSyncerVirtualWorkspaceURLs())
939945
require.NoError(t, err)
940946
return found, "Syncer virtual workspace URL not found"
@@ -943,7 +949,8 @@ func TestSyncerVirtualWorkspace(t *testing.T) {
943949
require.NoError(t, err)
944950

945951
wildwestSouthVWConfig := rest.CopyConfig(server.BaseConfig(t))
946-
framework.Eventually(t, func() (found bool, message string) {
952+
framework.Eventually(t, func() (found bool, _ string) {
953+
var err error
947954
wildwestSouthVWConfig.Host, found, err = framework.VirtualWorkspaceURL(ctx, kcpClusterClient, consumerWorkspace, wildwestSouthSyncer.GetSyncerVirtualWorkspaceURLs())
948955
require.NoError(t, err)
949956
return found, "Syncer virtual workspace URL not found"
@@ -1157,15 +1164,17 @@ func TestSyncerVirtualWorkspace(t *testing.T) {
11571164
}, wait.ForeverTestTimeout, time.Millisecond*100)
11581165

11591166
wildwestNorthVWConfig := rest.CopyConfig(server.BaseConfig(t))
1160-
framework.Eventually(t, func() (found bool, message string) {
1167+
framework.Eventually(t, func() (found bool, _ string) {
1168+
var err error
11611169
wildwestNorthVWConfig.Host, found, err = framework.VirtualWorkspaceURL(ctx, kcpClusterClient, consumerWorkspace, wildwestNorthSyncer.GetSyncerVirtualWorkspaceURLs())
11621170
require.NoError(t, err)
11631171
return found, "Syncer virtual workspace URL not found"
11641172
}, wait.ForeverTestTimeout, time.Millisecond*100, "Syncer virtual workspace URL not found")
11651173
vwNorthClusterClient, err := wildwestclientset.NewForConfig(wildwestNorthVWConfig)
11661174
require.NoError(t, err)
11671175
wildwestSouthVWConfig := rest.CopyConfig(server.BaseConfig(t))
1168-
framework.Eventually(t, func() (found bool, message string) {
1176+
framework.Eventually(t, func() (found bool, _ string) {
1177+
var err error
11691178
wildwestSouthVWConfig.Host, found, err = framework.VirtualWorkspaceURL(ctx, kcpClusterClient, consumerWorkspace, wildwestSouthSyncer.GetSyncerVirtualWorkspaceURLs())
11701179
require.NoError(t, err)
11711180
return found, "Syncer virtual workspace URL not found"
@@ -1441,7 +1450,8 @@ func TestSyncerVirtualWorkspace(t *testing.T) {
14411450
require.Len(t, kcpCowboys.Items, 1)
14421451

14431452
wildwestVWConfig := rest.CopyConfig(server.BaseConfig(t))
1444-
framework.Eventually(t, func() (found bool, message string) {
1453+
framework.Eventually(t, func() (found bool, _ string) {
1454+
var err error
14451455
wildwestVWConfig.Host, found, err = framework.VirtualWorkspaceURL(ctx, kcpClusterClient, consumerWorkspace, wildwestSyncer.GetSyncerVirtualWorkspaceURLs())
14461456
require.NoError(t, err)
14471457
return found, "Syncer virtual workspace URL not found"
@@ -1547,7 +1557,8 @@ func TestSyncerVirtualWorkspace(t *testing.T) {
15471557
require.NoError(t, err)
15481558

15491559
wildwestVWConfig := rest.CopyConfig(server.BaseConfig(t))
1550-
framework.Eventually(t, func() (found bool, message string) {
1560+
framework.Eventually(t, func() (found bool, _ string) {
1561+
var err error
15511562
wildwestVWConfig.Host, found, err = framework.VirtualWorkspaceURL(ctx, kcpClusterClient, consumerWorkspace, wildwestSyncer.GetSyncerVirtualWorkspaceURLs())
15521563
require.NoError(t, err)
15531564
return found, "Syncer virtual workspace URL not found"
@@ -1688,7 +1699,8 @@ func TestUpsyncerVirtualWorkspace(t *testing.T) {
16881699
t.Cleanup(cancelFunc)
16891700

16901701
upsyncerVWConfig := rest.CopyConfig(server.BaseConfig(t))
1691-
framework.Eventually(t, func() (found bool, message string) {
1702+
framework.Eventually(t, func() (found bool, _ string) {
1703+
var err error
16921704
upsyncerVWConfig.Host, found, err = framework.VirtualWorkspaceURL(ctx, kcpClusterClient, ws, syncer.GetUpsyncerVirtualWorkspaceURLs())
16931705
require.NoError(t, err)
16941706
return found, "Upsyncer virtual workspace URL not found"
@@ -1738,7 +1750,8 @@ func TestUpsyncerVirtualWorkspace(t *testing.T) {
17381750
t.Cleanup(cancelFunc)
17391751

17401752
upsyncerVWConfig := rest.CopyConfig(server.BaseConfig(t))
1741-
framework.Eventually(t, func() (found bool, message string) {
1753+
framework.Eventually(t, func() (found bool, _ string) {
1754+
var err error
17421755
upsyncerVWConfig.Host, found, err = framework.VirtualWorkspaceURL(ctx, kcpClusterClient, ws, syncer.GetUpsyncerVirtualWorkspaceURLs())
17431756
require.NoError(t, err)
17441757
return found, "Upsyncer virtual workspace URL not found"
@@ -1791,7 +1804,8 @@ func TestUpsyncerVirtualWorkspace(t *testing.T) {
17911804
t.Cleanup(cancelFunc)
17921805

17931806
upsyncerVWConfig := rest.CopyConfig(server.BaseConfig(t))
1794-
framework.Eventually(t, func() (found bool, message string) {
1807+
framework.Eventually(t, func() (found bool, _ string) {
1808+
var err error
17951809
upsyncerVWConfig.Host, found, err = framework.VirtualWorkspaceURL(ctx, kcpClusterClient, ws, syncer.GetUpsyncerVirtualWorkspaceURLs())
17961810
require.NoError(t, err)
17971811
return found, "Upsyncer virtual workspace URL not found"
@@ -1843,7 +1857,8 @@ func TestUpsyncerVirtualWorkspace(t *testing.T) {
18431857
t.Cleanup(cancelFunc)
18441858

18451859
upsyncerVWConfig := rest.CopyConfig(server.BaseConfig(t))
1846-
framework.Eventually(t, func() (found bool, message string) {
1860+
framework.Eventually(t, func() (found bool, _ string) {
1861+
var err error
18471862
upsyncerVWConfig.Host, found, err = framework.VirtualWorkspaceURL(ctx, kcpClusterClient, ws, syncer.GetUpsyncerVirtualWorkspaceURLs())
18481863
require.NoError(t, err)
18491864
return found, "Upsyncer virtual workspace URL not found"
@@ -1885,7 +1900,8 @@ func TestUpsyncerVirtualWorkspace(t *testing.T) {
18851900
t.Cleanup(cancelFunc)
18861901

18871902
upsyncerVWConfig := rest.CopyConfig(server.BaseConfig(t))
1888-
framework.Eventually(t, func() (found bool, message string) {
1903+
framework.Eventually(t, func() (found bool, _ string) {
1904+
var err error
18891905
upsyncerVWConfig.Host, found, err = framework.VirtualWorkspaceURL(ctx, kcpClusterClient, ws, syncer.GetUpsyncerVirtualWorkspaceURLs())
18901906
require.NoError(t, err)
18911907
return found, "Upsyncer virtual workspace URL not found"
@@ -1944,7 +1960,8 @@ func TestUpsyncerVirtualWorkspace(t *testing.T) {
19441960
t.Cleanup(cancelFunc)
19451961

19461962
upsyncerVWConfig := rest.CopyConfig(server.BaseConfig(t))
1947-
framework.Eventually(t, func() (found bool, message string) {
1963+
framework.Eventually(t, func() (found bool, _ string) {
1964+
var err error
19481965
upsyncerVWConfig.Host, found, err = framework.VirtualWorkspaceURL(ctx, kcpClusterClient, ws, syncer.GetUpsyncerVirtualWorkspaceURLs())
19491966
require.NoError(t, err)
19501967
return found, "Upsyncer virtual workspace URL not found"
@@ -2006,7 +2023,8 @@ func TestUpsyncerVirtualWorkspace(t *testing.T) {
20062023
t.Cleanup(cancelFunc)
20072024

20082025
upsyncerVWConfig := rest.CopyConfig(server.BaseConfig(t))
2009-
framework.Eventually(t, func() (found bool, message string) {
2026+
framework.Eventually(t, func() (found bool, _ string) {
2027+
var err error
20102028
upsyncerVWConfig.Host, found, err = framework.VirtualWorkspaceURL(ctx, kcpClusterClient, ws, syncer.GetUpsyncerVirtualWorkspaceURLs())
20112029
require.NoError(t, err)
20122030
return found, "Upsyncer virtual workspace URL not found"
@@ -2096,7 +2114,8 @@ func TestUpsyncerVirtualWorkspace(t *testing.T) {
20962114
}, wait.ForeverTestTimeout, time.Millisecond*100)
20972115

20982116
upsyncerVWConfig := rest.CopyConfig(server.BaseConfig(t))
2099-
framework.Eventually(t, func() (found bool, message string) {
2117+
framework.Eventually(t, func() (found bool, _ string) {
2118+
var err error
21002119
upsyncerVWConfig.Host, found, err = framework.VirtualWorkspaceURL(ctx, kcpClusterClient, upsyncerWS, upsyncer.GetUpsyncerVirtualWorkspaceURLs())
21012120
require.NoError(t, err)
21022121
return found, "Upsyncer virtual workspace URL not found"

0 commit comments

Comments
 (0)