Skip to content

Commit

Permalink
Merge pull request #1037 from hashicorp/sams/tf-test-parallel
Browse files Browse the repository at this point in the history
Add parallelism to create options for TF Test Runs
  • Loading branch information
dsa0x authored Jan 15, 2025
2 parents 5630634 + dc3621a commit 9254825
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
3 changes: 3 additions & 0 deletions test_run.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,9 @@ type TestRunCreateOptions struct {
// executed by this TestRun.
Verbose *bool `jsonapi:"attr,verbose,omitempty"`

// Parallelism controls the number of parallel operations to execute within a single test run.
Parallelism *int `jsonapi:"attr,parallelism,omitempty"`

// Variables allows you to specify terraform input variables for
// a particular run, prioritized over variables defined on the workspace.
Variables []*RunVariable `jsonapi:"attr,variables,omitempty"`
Expand Down
12 changes: 12 additions & 0 deletions test_run_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,18 @@ func TestTestRunsCreate(t *testing.T) {
_, err := client.TestRuns.Create(ctx, options)
require.NoError(t, err)
})

p := 10
t.Run("with a custom parallelism version", func(t *testing.T) {
options := TestRunCreateOptions{
ConfigurationVersion: cvTest,
RegistryModule: rmTest,
Parallelism: &p,
}
_, err := client.TestRuns.Create(ctx, options)
require.NoError(t, err)
})

t.Run("without a configuration version", func(t *testing.T) {
options := TestRunCreateOptions{
RegistryModule: rmTest,
Expand Down

0 comments on commit 9254825

Please sign in to comment.