@@ -47,6 +47,7 @@ import (
47
47
)
48
48
49
49
func TestConfig_Validate (t * testing.T ) {
50
+ t .Parallel ()
50
51
tests := map [string ]struct {
51
52
setup func (cfg * Config , limits * validation.Limits )
52
53
expected error
@@ -80,7 +81,9 @@ func TestConfig_Validate(t *testing.T) {
80
81
}
81
82
82
83
for testName , testData := range tests {
84
+ testData := testData
83
85
t .Run (testName , func (t * testing.T ) {
86
+ t .Parallel ()
84
87
cfg := & Config {}
85
88
limits := & validation.Limits {}
86
89
flagext .DefaultValues (cfg , limits )
@@ -92,6 +95,7 @@ func TestConfig_Validate(t *testing.T) {
92
95
}
93
96
94
97
func TestStoreGateway_InitialSyncWithDefaultShardingEnabled (t * testing.T ) {
98
+ t .Parallel ()
95
99
tests := map [string ]struct {
96
100
initialExists bool
97
101
initialState ring.InstanceState
@@ -123,7 +127,9 @@ func TestStoreGateway_InitialSyncWithDefaultShardingEnabled(t *testing.T) {
123
127
}
124
128
125
129
for testName , testData := range tests {
130
+ testData := testData
126
131
t .Run (testName , func (t * testing.T ) {
132
+ t .Parallel ()
127
133
ctx := context .Background ()
128
134
gatewayCfg := mockGatewayConfig ()
129
135
gatewayCfg .ShardingEnabled = true
@@ -174,6 +180,7 @@ func TestStoreGateway_InitialSyncWithDefaultShardingEnabled(t *testing.T) {
174
180
}
175
181
176
182
func TestStoreGateway_InitialSyncWithShardingDisabled (t * testing.T ) {
183
+ t .Parallel ()
177
184
ctx := context .Background ()
178
185
gatewayCfg := mockGatewayConfig ()
179
186
gatewayCfg .ShardingEnabled = false
@@ -195,6 +202,7 @@ func TestStoreGateway_InitialSyncWithShardingDisabled(t *testing.T) {
195
202
}
196
203
197
204
func TestStoreGateway_InitialSyncFailure (t * testing.T ) {
205
+ t .Parallel ()
198
206
ctx := context .Background ()
199
207
gatewayCfg := mockGatewayConfig ()
200
208
gatewayCfg .ShardingEnabled = true
@@ -223,6 +231,7 @@ func TestStoreGateway_InitialSyncFailure(t *testing.T) {
223
231
// their own blocks, regardless which store-gateway joined the ring first or last (even if starting
224
232
// at the same time, they will join the ring at a slightly different time).
225
233
func TestStoreGateway_InitialSyncWithWaitRingStability (t * testing.T ) {
234
+ //parallel testing causes data race
226
235
bucketClient , storageDir := cortex_testutil .PrepareFilesystemBucket (t )
227
236
228
237
// This tests uses real TSDB blocks. 24h time range, 2h block range period,
@@ -302,6 +311,7 @@ func TestStoreGateway_InitialSyncWithWaitRingStability(t *testing.T) {
302
311
for testName , testData := range tests {
303
312
for _ , bucketIndexEnabled := range []bool {true , false } {
304
313
t .Run (fmt .Sprintf ("%s (bucket index enabled = %v)" , testName , bucketIndexEnabled ), func (t * testing.T ) {
314
+ //parallel testing causes data race
305
315
// Randomise the seed but log it in case we need to reproduce the test on failure.
306
316
seed := time .Now ().UnixNano ()
307
317
rand .Seed (seed )
@@ -383,6 +393,7 @@ func TestStoreGateway_InitialSyncWithWaitRingStability(t *testing.T) {
383
393
}
384
394
385
395
func TestStoreGateway_BlocksSyncWithDefaultSharding_RingTopologyChangedAfterScaleUp (t * testing.T ) {
396
+ t .Parallel ()
386
397
const (
387
398
numUsers = 2
388
399
numBlocks = numUsers * 12
@@ -542,6 +553,7 @@ func TestStoreGateway_BlocksSyncWithDefaultSharding_RingTopologyChangedAfterScal
542
553
}
543
554
544
555
func TestStoreGateway_ShouldSupportLoadRingTokensFromFile (t * testing.T ) {
556
+ t .Parallel ()
545
557
tests := map [string ]struct {
546
558
storedTokens ring.Tokens
547
559
expectedNumTokens int
@@ -561,7 +573,9 @@ func TestStoreGateway_ShouldSupportLoadRingTokensFromFile(t *testing.T) {
561
573
}
562
574
563
575
for testName , testData := range tests {
576
+ testData := testData
564
577
t .Run (testName , func (t * testing.T ) {
578
+ t .Parallel ()
565
579
tokensFile , err := os .CreateTemp (os .TempDir (), "tokens-*" )
566
580
require .NoError (t , err )
567
581
defer os .Remove (tokensFile .Name ()) //nolint:errcheck
@@ -596,6 +610,7 @@ func TestStoreGateway_ShouldSupportLoadRingTokensFromFile(t *testing.T) {
596
610
}
597
611
598
612
func TestStoreGateway_SyncOnRingTopologyChanged (t * testing.T ) {
613
+ t .Parallel ()
599
614
registeredAt := time .Now ()
600
615
601
616
tests := map [string ]struct {
@@ -704,7 +719,9 @@ func TestStoreGateway_SyncOnRingTopologyChanged(t *testing.T) {
704
719
}
705
720
706
721
for testName , testData := range tests {
722
+ testData := testData
707
723
t .Run (testName , func (t * testing.T ) {
724
+ t .Parallel ()
708
725
ctx := context .Background ()
709
726
gatewayCfg := mockGatewayConfig ()
710
727
gatewayCfg .ShardingEnabled = true
@@ -764,6 +781,7 @@ func TestStoreGateway_SyncOnRingTopologyChanged(t *testing.T) {
764
781
}
765
782
766
783
func TestStoreGateway_RingLifecyclerShouldAutoForgetUnhealthyInstances (t * testing.T ) {
784
+ t .Parallel ()
767
785
const unhealthyInstanceID = "unhealthy-id"
768
786
const heartbeatTimeout = time .Minute
769
787
@@ -810,6 +828,7 @@ func TestStoreGateway_RingLifecyclerShouldAutoForgetUnhealthyInstances(t *testin
810
828
}
811
829
812
830
func TestStoreGateway_SeriesQueryingShouldRemoveExternalLabels (t * testing.T ) {
831
+ t .Parallel ()
813
832
ctx := context .Background ()
814
833
logger := log .NewNopLogger ()
815
834
userID := "user-1"
@@ -855,7 +874,9 @@ func TestStoreGateway_SeriesQueryingShouldRemoveExternalLabels(t *testing.T) {
855
874
}
856
875
857
876
for _ , bucketIndexEnabled := range []bool {true , false } {
877
+ bucketIndexEnabled := bucketIndexEnabled
858
878
t .Run (fmt .Sprintf ("bucket index enabled = %v" , bucketIndexEnabled ), func (t * testing.T ) {
879
+ t .Parallel ()
859
880
// Create a store-gateway used to query back the series from the blocks.
860
881
gatewayCfg := mockGatewayConfig ()
861
882
gatewayCfg .ShardingEnabled = false
@@ -901,6 +922,7 @@ func TestStoreGateway_SeriesQueryingShouldRemoveExternalLabels(t *testing.T) {
901
922
}
902
923
903
924
func TestStoreGateway_SeriesQueryingShouldEnforceMaxChunksPerQueryLimit (t * testing.T ) {
925
+ t .Parallel ()
904
926
const chunksQueried = 10
905
927
906
928
tests := map [string ]struct {
@@ -948,6 +970,7 @@ func TestStoreGateway_SeriesQueryingShouldEnforceMaxChunksPerQueryLimit(t *testi
948
970
949
971
for testName , testData := range tests {
950
972
t .Run (testName , func (t * testing.T ) {
973
+ //parallel testing causes data race
951
974
// Customise the limits.
952
975
limits := defaultLimitsConfig ()
953
976
limits .MaxChunksPerQuery = testData .limit
@@ -1036,6 +1059,7 @@ func TestStoreGateway_SeriesQueryingShouldEnforceMaxSeriesPerQueryLimit(t *testi
1036
1059
1037
1060
for testName , testData := range tests {
1038
1061
t .Run (testName , func (t * testing.T ) {
1062
+ //parallel testing causes data race
1039
1063
// Customise the limits.
1040
1064
limits := defaultLimitsConfig ()
1041
1065
limits .MaxFetchedSeriesPerQuery = testData .limit
0 commit comments