Merge pull request #177 from sshota0809/issue/175

Embed the environment variables before PreExec in ACC test
main
Elie 2021-02-03 11:26:11 +01:00 committed by GitHub
commit d565ba66b8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 5 deletions

View File

@ -271,16 +271,16 @@ func Run(t *testing.T, c AccTestCase) {
if check.Check == nil { if check.Check == nil {
t.Fatal("Check attribute must be defined") t.Fatal("Check attribute must be defined")
} }
if check.PreExec != nil {
c.useTerraformEnv()
check.PreExec()
c.restoreEnv()
}
if len(check.Env) > 0 { if len(check.Env) > 0 {
for key, value := range check.Env { for key, value := range check.Env {
os.Setenv(key, value) os.Setenv(key, value)
} }
} }
if check.PreExec != nil {
c.useTerraformEnv()
check.PreExec()
c.restoreEnv()
}
_, out, cmdErr := runDriftCtlCmd(driftctlCmd) _, out, cmdErr := runDriftCtlCmd(driftctlCmd)
if len(check.Env) > 0 { if len(check.Env) > 0 {
for key := range check.Env { for key := range check.Env {