Skip to content

Commit 5952aad

Browse files
fix: drop t.Parallel() from dynamic tests that now use t.Setenv via Integration(t)
t.Setenv and t.Parallel are mutually exclusive on the same *testing.T regardless of call order (Go panics either way), not just when Setenv follows Parallel as previously assumed. TestSDKv1Provider, TestConflictsWithNamePrefixOnly, TestConflictsWithBothUserSpecified, and TestRandomCreate all call Integration(t) (or t.Setenv directly), which now sets an env var, so they can no longer also call t.Parallel().
1 parent 3f7d78b commit 5952aad

2 files changed

Lines changed: 11 additions & 12 deletions

File tree

dynamic/conflicting_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ import (
1919
var conflictsProviderPath = helper.BuildOnce(&globalTempDir,
2020
"test/conflictsprovider", "terraform-provider-conflictsprovider")
2121

22-
func TestConflictsWithNamePrefixOnly(t *testing.T) {
23-
// helper.Integration(t) now calls t.Setenv, which must happen before t.Parallel().
22+
func TestConflictsWithNamePrefixOnly(t *testing.T) { //nolint:paralleltest
23+
// helper.Integration(t) now calls t.Setenv. t.Setenv and t.Parallel are mutually
24+
// exclusive on the same test, so this cannot be parallel.
2425
helper.Integration(t)
25-
t.Parallel()
2626
skipWindows(t)
2727

2828
server := parameterizedTestServer(t, conflictsProviderPath)
@@ -55,10 +55,10 @@ func TestConflictsWithNamePrefixOnly(t *testing.T) {
5555
// When the user explicitly supplies both `name` and `name_prefix`, the bridge
5656
// must surface the upstream ConflictsWith error rather than silently dropping
5757
// one of the user-provided values.
58-
func TestConflictsWithBothUserSpecified(t *testing.T) {
59-
// helper.Integration(t) now calls t.Setenv, which must happen before t.Parallel().
58+
func TestConflictsWithBothUserSpecified(t *testing.T) { //nolint:paralleltest
59+
// helper.Integration(t) now calls t.Setenv. t.Setenv and t.Parallel are mutually
60+
// exclusive on the same test, so this cannot be parallel.
6061
helper.Integration(t)
61-
t.Parallel()
6262
skipWindows(t)
6363

6464
server := parameterizedTestServer(t, conflictsProviderPath)

dynamic/provider_test.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -723,10 +723,9 @@ func TestSchemaGenerationIndexDocOutDir(t *testing.T) { //nolint:paralleltest
723723

724724
func TestRandomCreate(t *testing.T) {
725725
// This test relies on live registry acquisition, so it must not inherit
726-
// PULUMI_DISABLE_AUTOMATIC_PLUGIN_ACQUISITION from the environment. Must be set
727-
// before t.Parallel(), since t.Setenv panics once a test is marked parallel.
726+
// PULUMI_DISABLE_AUTOMATIC_PLUGIN_ACQUISITION from the environment. t.Setenv and
727+
// t.Parallel are mutually exclusive on the same test, so this cannot be parallel.
728728
t.Setenv("PULUMI_DISABLE_AUTOMATIC_PLUGIN_ACQUISITION", "false")
729-
t.Parallel()
730729
ctx := context.Background()
731730
server := grpcTestServer(ctx, t)
732731
parameterizeResp, err := server.Parameterize(ctx, &pulumirpc.ParameterizeRequest{
@@ -787,10 +786,10 @@ func TestRandomCreate(t *testing.T) {
787786
})
788787
}
789788

790-
func TestSDKv1Provider(t *testing.T) {
791-
// helper.Integration(t) now calls t.Setenv, which must happen before t.Parallel().
789+
func TestSDKv1Provider(t *testing.T) { //nolint:paralleltest
790+
// helper.Integration(t) now calls t.Setenv. t.Setenv and t.Parallel are mutually
791+
// exclusive on the same test, so this cannot be parallel.
792792
helper.Integration(t)
793-
t.Parallel()
794793
skipWindows(t)
795794

796795
server := parameterizedTestServer(t, sdkv1ProviderPath)

0 commit comments

Comments
 (0)