lib/uplink: fix test data race

cfg was being modified concurrently.

Change-Id: I431f152e7e3f72582f1a7d39967c2496e0e0dc1e
This commit is contained in:
Egon Elbre 2019-12-17 17:33:23 +02:00
parent afe05edff2
commit 69dc514fcb

View File

@ -35,7 +35,6 @@ func testPlanetWithLibUplink(t *testing.T, cfg testConfig,
// as testplanet makes it easy to get another way :D // as testplanet makes it easy to get another way :D
testUplink := planet.Uplinks[0] testUplink := planet.Uplinks[0]
satellite := planet.Satellites[0] satellite := planet.Satellites[0]
cfg.uplinkCfg.Volatile.TLS.SkipPeerCAWhitelist = true
apiKey, err := uplink.ParseAPIKey(testUplink.APIKey[satellite.ID()].Serialize()) apiKey, err := uplink.ParseAPIKey(testUplink.APIKey[satellite.ID()].Serialize())
if err != nil { if err != nil {
@ -262,7 +261,10 @@ func TestBucketAttrs(t *testing.T) {
} }
) )
testPlanetWithLibUplink(t, testConfig{}, cfg := testConfig{}
cfg.uplinkCfg.Volatile.TLS.SkipPeerCAWhitelist = true
testPlanetWithLibUplink(t, cfg,
func(t *testing.T, ctx *testcontext.Context, planet *testplanet.Planet, proj *uplink.Project) { func(t *testing.T, ctx *testcontext.Context, planet *testplanet.Planet, proj *uplink.Project) {
before := time.Now() before := time.Now()
bucket, err := proj.CreateBucket(ctx, bucketName, &inBucketConfig) bucket, err := proj.CreateBucket(ctx, bucketName, &inBucketConfig)
@ -323,8 +325,10 @@ func TestBucketAttrsApply(t *testing.T) {
} }
testConfig testConfig testConfig testConfig
) )
// so our test object will not be inlined (otherwise it will lose its RS params) // so our test object will not be inlined (otherwise it will lose its RS params)
testConfig.uplinkCfg.Volatile.MaxInlineSize = 1 testConfig.uplinkCfg.Volatile.MaxInlineSize = 1
testConfig.uplinkCfg.Volatile.TLS.SkipPeerCAWhitelist = true
testPlanetWithLibUplink(t, testConfig, testPlanetWithLibUplink(t, testConfig,
func(t *testing.T, ctx *testcontext.Context, planet *testplanet.Planet, proj *uplink.Project) { func(t *testing.T, ctx *testcontext.Context, planet *testplanet.Planet, proj *uplink.Project) {