-
Notifications
You must be signed in to change notification settings - Fork 2
/
parallelism.go
28 lines (22 loc) · 850 Bytes
/
parallelism.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package scenario
import (
"fmt"
"testing"
"github.com/Excoriate/tftest/pkg/tfdir"
test_structure "github.com/gruntwork-io/terratest/modules/test-structure"
)
// SetupTerraformDirForParallelism sets up the Terraform directory for parallelism.
// It copies the Terraform directory to a temporary directory and returns the path to the temporary directory.
func SetupTerraformDirForParallelism(t *testing.T, tfDir string) (string, error) {
if t == nil {
return "", fmt.Errorf("t is required")
}
if tfDir == "" {
return "", fmt.Errorf("tfDir is required")
}
testDirRelPathFromGitRepo, gitRepoRoot, err := tfdir.GetRelativePathFromGitRepo(tfDir, t)
if err != nil {
return "", fmt.Errorf("failed to resolve test directory: %v", err)
}
return test_structure.CopyTerraformFolderToTemp(t, gitRepoRoot, testDirRelPathFromGitRepo), nil
}