Skip to content

Commit

Permalink
Add t.Parallel() to more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
DrJosh9000 committed Aug 23, 2023
1 parent bf97e53 commit 95fa8de
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 4 deletions.
12 changes: 12 additions & 0 deletions internal/job/integration/checkout_git_mirrors_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ func TestCheckingOutGitHubPullRequests_WithGitMirrors(t *testing.T) {
}

func TestWithResolvingCommitExperiment_WithGitMirrors(t *testing.T) {
t.Parallel()

ctx, _ := experiments.Enable(mainCtx, experiments.ResolveCommitAfterCheckout)
tester, err := NewBootstrapTester(ctx)
if err != nil {
Expand Down Expand Up @@ -479,6 +481,8 @@ func TestCleaningAnExistingCheckout_WithGitMirrors(t *testing.T) {
}

func TestForcingACleanCheckout_WithGitMirrors(t *testing.T) {
t.Parallel()

tester, err := NewBootstrapTester(mainCtx)
if err != nil {
t.Fatalf("NewBootstrapTester() error = %v", err)
Expand All @@ -503,6 +507,8 @@ func TestForcingACleanCheckout_WithGitMirrors(t *testing.T) {
}

func TestCheckoutOnAnExistingRepositoryWithoutAGitFolder_WithGitMirrors(t *testing.T) {
t.Parallel()

tester, err := NewBootstrapTester(mainCtx)
if err != nil {
t.Fatalf("NewBootstrapTester() error = %v", err)
Expand Down Expand Up @@ -532,6 +538,8 @@ func TestCheckoutOnAnExistingRepositoryWithoutAGitFolder_WithGitMirrors(t *testi
}

func TestCheckoutRetriesOnCleanFailure_WithGitMirrors(t *testing.T) {
t.Parallel()

tester, err := NewBootstrapTester(mainCtx)
if err != nil {
t.Fatalf("NewBootstrapTester() error = %v", err)
Expand Down Expand Up @@ -562,6 +570,8 @@ func TestCheckoutRetriesOnCleanFailure_WithGitMirrors(t *testing.T) {
}

func TestCheckoutRetriesOnCloneFailure_WithGitMirrors(t *testing.T) {
t.Parallel()

tester, err := NewBootstrapTester(mainCtx)
if err != nil {
t.Fatalf("NewBootstrapTester() error = %v", err)
Expand Down Expand Up @@ -590,6 +600,8 @@ func TestCheckoutRetriesOnCloneFailure_WithGitMirrors(t *testing.T) {
}

func TestCheckoutDoesNotRetryOnHookFailure_WithGitMirrors(t *testing.T) {
t.Parallel()

tester, err := NewBootstrapTester(mainCtx)
if err != nil {
t.Fatalf("NewBootstrapTester() error = %v", err)
Expand Down
12 changes: 12 additions & 0 deletions internal/job/integration/checkout_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ var commitPattern = bintest.MatchPattern(`(?ms)\Acommit [0-9a-f]+\nabbrev-commit
const gitShowFormatArg = "--format=commit %H%nabbrev-commit %h%nAuthor: %an <%ae>%n%n%w(0,4,4)%B"

func TestWithResolvingCommitExperiment(t *testing.T) {
t.Parallel()

ctx, _ := experiments.Enable(mainCtx, experiments.ResolveCommitAfterCheckout)
tester, err := NewBootstrapTester(ctx)
if err != nil {
Expand Down Expand Up @@ -528,6 +530,8 @@ func TestCleaningAnExistingCheckout(t *testing.T) {
}

func TestForcingACleanCheckout(t *testing.T) {
t.Parallel()

tester, err := NewBootstrapTester(mainCtx)
if err != nil {
t.Fatalf("NewBootstrapTester() error = %v", err)
Expand All @@ -548,6 +552,8 @@ func TestForcingACleanCheckout(t *testing.T) {
}

func TestCheckoutOnAnExistingRepositoryWithoutAGitFolder(t *testing.T) {
t.Parallel()

tester, err := NewBootstrapTester(mainCtx)
if err != nil {
t.Fatalf("NewBootstrapTester() error = %v", err)
Expand All @@ -573,6 +579,8 @@ func TestCheckoutOnAnExistingRepositoryWithoutAGitFolder(t *testing.T) {
}

func TestCheckoutRetriesOnCleanFailure(t *testing.T) {
t.Parallel()

tester, err := NewBootstrapTester(mainCtx)
if err != nil {
t.Fatalf("NewBootstrapTester() error = %v", err)
Expand All @@ -599,6 +607,8 @@ func TestCheckoutRetriesOnCleanFailure(t *testing.T) {
}

func TestCheckoutRetriesOnCloneFailure(t *testing.T) {
t.Parallel()

tester, err := NewBootstrapTester(mainCtx)
if err != nil {
t.Fatalf("NewBootstrapTester() error = %v", err)
Expand All @@ -623,6 +633,8 @@ func TestCheckoutRetriesOnCloneFailure(t *testing.T) {
}

func TestCheckoutDoesNotRetryOnHookFailure(t *testing.T) {
t.Parallel()

tester, err := NewBootstrapTester(mainCtx)
if err != nil {
t.Fatalf("NewBootstrapTester() error = %v", err)
Expand Down
8 changes: 6 additions & 2 deletions internal/job/integration/hooks_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -511,13 +511,13 @@ func TestExitCodesPropagateOutFromGlobalHooks(t *testing.T) {
}

func TestPreExitHooksFireAfterCancel(t *testing.T) {
t.Parallel()

// TODO: Why is this test skipped on windows and darwin?
if runtime.GOOS == "windows" || runtime.GOOS == "darwin" {
t.Skip()
}

t.Parallel()

tester, err := NewBootstrapTester(mainCtx)
if err != nil {
t.Fatalf("NewBootstrapTester() error = %v", err)
Expand Down Expand Up @@ -548,6 +548,8 @@ func TestPreExitHooksFireAfterCancel(t *testing.T) {
}

func TestPolyglotScriptHooksCanBeRun(t *testing.T) {
t.Parallel()

if runtime.GOOS == "windows" {
t.Skip("script hooks aren't supported on windows")
}
Expand Down Expand Up @@ -587,6 +589,8 @@ func TestPolyglotScriptHooksCanBeRun(t *testing.T) {
}

func TestPolyglotBinaryHooksCanBeRun(t *testing.T) {
t.Parallel()

ctx := mainCtx
ctx, _ = experiments.Enable(ctx, experiments.PolyglotHooks)
ctx, _ = experiments.Enable(ctx, experiments.JobAPI)
Expand Down
4 changes: 4 additions & 0 deletions internal/job/integration/isolated_plugin_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ import (
// that a plugin modified upstream is treated as expected. That is, by default, the updates won't
// take effect, but with BUILDKITE_PLUGINS_ALWAYS_CLONE_FRESH set, they will.
func TestModifiedIsolatedPluginNoForcePull(t *testing.T) {
t.Parallel()

ctx, _ := experiments.Enable(mainCtx, experiments.IsolatedPluginCheckout)

tester, err := NewBootstrapTester(ctx)
Expand Down Expand Up @@ -128,6 +130,8 @@ func TestModifiedIsolatedPluginNoForcePull(t *testing.T) {
// and after modifying a plugin's source, but this time with BUILDKITE_PLUGINS_ALWAYS_CLONE_FRESH
// set to true. So, we expect the upstream plugin changes to take effect on our second build.
func TestModifiedIsolatedPluginWithForcePull(t *testing.T) {
t.Parallel()

ctx, _ := experiments.Enable(mainCtx, experiments.IsolatedPluginCheckout)

tester, err := NewBootstrapTester(ctx)
Expand Down
2 changes: 2 additions & 0 deletions internal/job/integration/job_api_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ import (
)

func TestBootstrapRunsJobAPI(t *testing.T) {
t.Parallel()

ctx, _ := experiments.Enable(mainCtx, experiments.JobAPI)

tester, err := NewBootstrapTester(ctx)
Expand Down
8 changes: 6 additions & 2 deletions internal/job/integration/plugin_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,12 +207,12 @@ func TestOverlappingPluginHooks(t *testing.T) {
}

func TestPluginCloneRetried(t *testing.T) {
t.Parallel()

if runtime.GOOS == "windows" {
t.Skip("Not passing on windows, needs investigation")
}

t.Parallel()

tester, err := NewBootstrapTester(mainCtx)
if err != nil {
t.Fatalf("NewBootstrapTester() error = %v", err)
Expand Down Expand Up @@ -278,6 +278,8 @@ func TestPluginCloneRetried(t *testing.T) {
// that a plugin modified upstream is treated as expected. That is, by default, the updates won't
// take effect, but with BUILDKITE_PLUGINS_ALWAYS_CLONE_FRESH set, they will.
func TestModifiedPluginNoForcePull(t *testing.T) {
t.Parallel()

ctx := mainCtx

tester, err := NewBootstrapTester(ctx)
Expand Down Expand Up @@ -387,6 +389,8 @@ func TestModifiedPluginNoForcePull(t *testing.T) {
// and after modifying a plugin's source, but this time with BUILDKITE_PLUGINS_ALWAYS_CLONE_FRESH
// set to true. So, we expect the upstream plugin changes to take effect on our second build.
func TestModifiedPluginWithForcePull(t *testing.T) {
t.Parallel()

ctx := mainCtx

tester, err := NewBootstrapTester(mainCtx)
Expand Down

0 comments on commit 95fa8de

Please sign in to comment.