Skip to content

Commit

Permalink
Added waitgroup to tests to wait for files to be created.
Browse files Browse the repository at this point in the history
  • Loading branch information
Direside committed Nov 1, 2019
1 parent 0d20a5c commit f900d82
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions tests/integration/ci/ci_test.go
Expand Up @@ -31,7 +31,7 @@ func TestGenerateJenkins(t *testing.T) {
templates := packr.New("templates", "../../../templates")
testTemplator := templator.NewTemplator(templates)

var waitgroup *sync.WaitGroup
var waitgroup sync.WaitGroup

testConf := &config.Commit0Config{
Language: "go",
Expand All @@ -40,10 +40,11 @@ func TestGenerateJenkins(t *testing.T) {
},
}

err := ci.Generate(testTemplator.CI, testConf, testData+"/actual", waitgroup)
err := ci.Generate(testTemplator.CI, testConf, testData+"/actual", &waitgroup)
if err != nil {
t.Errorf("Error when executing test. %s", err)
}
waitgroup.Wait()

actual, err := ioutil.ReadFile(testData + "actual/Jenkinsfile")
if err != nil {
Expand All @@ -66,7 +67,7 @@ func TestGenerateCircleCI(t *testing.T) {
templates := packr.New("templates", "../../../templates")
testTemplator := templator.NewTemplator(templates)

var waitgroup *sync.WaitGroup
var waitgroup sync.WaitGroup

testConf := &config.Commit0Config{
Language: "go",
Expand All @@ -75,10 +76,11 @@ func TestGenerateCircleCI(t *testing.T) {
},
}

err := ci.Generate(testTemplator.CI, testConf, testData+"/actual", waitgroup)
err := ci.Generate(testTemplator.CI, testConf, testData+"/actual", &waitgroup)
if err != nil {
t.Errorf("Error when executing test. %s", err)
}
waitgroup.Wait()

actual, err := ioutil.ReadFile(testData + "actual/.circleci/config.yml")
if err != nil {
Expand All @@ -101,7 +103,7 @@ func TestGenerateTravisCI(t *testing.T) {
templates := packr.New("templates", "../../../templates")
testTemplator := templator.NewTemplator(templates)

var waitgroup *sync.WaitGroup
var waitgroup sync.WaitGroup

testConf := &config.Commit0Config{
Language: "go",
Expand All @@ -110,10 +112,11 @@ func TestGenerateTravisCI(t *testing.T) {
},
}

err := ci.Generate(testTemplator.CI, testConf, testData+"/actual", waitgroup)
err := ci.Generate(testTemplator.CI, testConf, testData+"/actual", &waitgroup)
if err != nil {
t.Errorf("Error when executing test. %s", err)
}
waitgroup.Wait()

actual, err := ioutil.ReadFile(testData + "actual/.travis.yml")
if err != nil {
Expand Down

0 comments on commit f900d82

Please sign in to comment.