Skip to content

Commit

Permalink
Feat: run harness tests in parallel (#669)
Browse files Browse the repository at this point in the history
  • Loading branch information
TomerHeber committed Jun 30, 2023
1 parent 8e77df2 commit b33c6b1
Showing 1 changed file with 19 additions and 7 deletions.
26 changes: 19 additions & 7 deletions tests/harness.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"path"
"runtime"
"strings"
"sync"
)

const TESTS_FOLDER = "tests/integration"
Expand All @@ -24,16 +25,27 @@ func main() {
log.Println(len(testNames), " tests to run")
buildFakeTerraformRegistry()
destroyMode := os.Getenv("DESTROY_MODE")

var wg sync.WaitGroup

for _, testName := range testNames {
if destroyMode == "DESTROY_ONLY" {
terraformDestory(testName)
} else {
success, err := runTest(testName, destroyMode != "NO_DESTROY")
if !success {
log.Fatalln("Halting due to test failure:", err)
wg.Add(1)

go func(testName string) {
if destroyMode == "DESTROY_ONLY" {
terraformDestory(testName)
} else {
success, err := runTest(testName, destroyMode != "NO_DESTROY")
if !success {
log.Fatalln("Halting due to test failure:", err)
}
}
}

wg.Done()
}(testName)
}

wg.Wait()
}
func compileProvider() error {
cmd := exec.Command("go", "build")
Expand Down

0 comments on commit b33c6b1

Please sign in to comment.