diff --git a/e2e/e2e.go b/e2e/e2e.go index dbc457e1c..b8c1d69ea 100644 --- a/e2e/e2e.go +++ b/e2e/e2e.go @@ -17,6 +17,7 @@ import ( type binary struct { binPath string workDir string + env []string } // NewBinary prepares a temporary directory containing the files from the @@ -93,6 +94,12 @@ func NewBinary(binaryPath, workingDir string) *binary { } } +// AddEnv appends an entry to the environment variable table passed to any +// commands subsequently run. +func (b *binary) AddEnv(entry string) { + b.env = append(b.env, entry) +} + // Cmd returns an exec.Cmd pre-configured to run the generated Terraform // binary with the given arguments in the temporary working directory. // @@ -108,6 +115,8 @@ func (b *binary) Cmd(args ...string) *exec.Cmd { // end-to-end testing of our Checkpoint interactions.) cmd.Env = append(cmd.Env, "CHECKPOINT_DISABLE=1") + cmd.Env = append(cmd.Env, b.env...) + return cmd }