Allow to set args from checks
parent
6f39d5c99c
commit
7170f9f09c
|
@ -34,6 +34,7 @@ type AccCheck struct {
|
|||
PreExec func()
|
||||
PostExec func()
|
||||
Env map[string]string
|
||||
Args func() []string
|
||||
Check func(result *ScanResult, stdout string, err error)
|
||||
}
|
||||
|
||||
|
@ -349,7 +350,6 @@ func Run(t *testing.T, c AccTestCase) {
|
|||
"--output", fmt.Sprintf("json://%s", c.getResultFilePath()),
|
||||
)
|
||||
}
|
||||
os.Args = c.Args
|
||||
|
||||
for _, check := range c.Checks {
|
||||
driftctlCmd := cmd.NewDriftctlCmd(test.Build{})
|
||||
|
@ -366,6 +366,10 @@ func Run(t *testing.T, c AccTestCase) {
|
|||
check.PreExec()
|
||||
c.restoreEnv()
|
||||
}
|
||||
os.Args = c.Args
|
||||
if check.Args != nil {
|
||||
os.Args = append(os.Args, check.Args()...)
|
||||
}
|
||||
_, out, cmdErr := runDriftCtlCmd(driftctlCmd)
|
||||
if len(check.Env) > 0 {
|
||||
for key := range check.Env {
|
||||
|
|
Loading…
Reference in New Issue