Merge pull request #7978 from hashicorp/jbardin/races

Fix improper wait group usage in test
This commit is contained in:
James Bardin 2016-08-05 12:52:39 -04:00 committed by GitHub
commit f3a06c0cb2
1 changed files with 3 additions and 3 deletions

View File

@ -122,8 +122,8 @@ func TestValidateVarsAttribute(t *testing.T) {
func TestTemplateSharedMemoryRace(t *testing.T) { func TestTemplateSharedMemoryRace(t *testing.T) {
var wg sync.WaitGroup var wg sync.WaitGroup
for i := 0; i < 100; i++ { for i := 0; i < 100; i++ {
go func(wg *sync.WaitGroup, t *testing.T, i int) {
wg.Add(1) wg.Add(1)
go func(t *testing.T, i int) {
out, err := execute("don't panic!", map[string]interface{}{}) out, err := execute("don't panic!", map[string]interface{}{})
if err != nil { if err != nil {
t.Fatalf("err: %s", err) t.Fatalf("err: %s", err)
@ -132,7 +132,7 @@ func TestTemplateSharedMemoryRace(t *testing.T) {
t.Fatalf("bad output: %s", out) t.Fatalf("bad output: %s", out)
} }
wg.Done() wg.Done()
}(&wg, t, i) }(t, i)
} }
wg.Wait() wg.Wait()
} }