From 7170f9f09cbf23d2f682e9b8a6de4211c249e7de Mon Sep 17 00:00:00 2001 From: Elie Date: Tue, 30 Mar 2021 17:50:13 +0200 Subject: [PATCH] Allow to set args from checks --- test/acceptance/testing.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/test/acceptance/testing.go b/test/acceptance/testing.go index c3adbf6e..7ef589af 100644 --- a/test/acceptance/testing.go +++ b/test/acceptance/testing.go @@ -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 {