From 809f1588c5219d73a644610f375729cffecef0d5 Mon Sep 17 00:00:00 2001 From: Adele Reed Date: Mon, 19 Sep 2022 13:13:22 -0700 Subject: [PATCH] copy plan files too --- e2etest/declarativeScenario.go | 8 ++++++++ e2etest/runner.go | 2 ++ 2 files changed, 10 insertions(+) diff --git a/e2etest/declarativeScenario.go b/e2etest/declarativeScenario.go index e939a4a764..6cf6642680 100644 --- a/e2etest/declarativeScenario.go +++ b/e2etest/declarativeScenario.go @@ -78,6 +78,11 @@ func (s *scenario) Run() { } azcopyRan := false defer func() { + err := os.MkdirAll(os.Getenv("AZCOPY_E2E_LOG_OUTPUT"), os.ModePerm|os.ModeDir) + if err != nil { + s.a.Assert(err, equals(), nil) + return + } if azcopyRan { s.uploadLogs(logDir) s.a.(*testingAsserter).t.Log("uploaded logs for job " + s.state.result.jobID.String() + " to container azcopylogs in account " + os.Getenv("AZCOPY_E2E_ACCOUNT_NAME")) @@ -143,6 +148,9 @@ func (s *scenario) Run() { } func (s *scenario) uploadLogs(logDir string) { + if s.state.result == nil { + return // nothing to upload + } s.a.Assert(os.Rename(logDir, filepath.Join(os.Getenv("AZCOPY_E2E_LOG_OUTPUT"), s.state.result.jobID.String())), equals(), nil) } diff --git a/e2etest/runner.go b/e2etest/runner.go index d4c54d83b9..a5f5d1e22f 100644 --- a/e2etest/runner.go +++ b/e2etest/runner.go @@ -26,6 +26,7 @@ import ( "fmt" "os" "os/exec" + "path/filepath" "strconv" "strings" @@ -236,6 +237,7 @@ func (t *TestRunner) ExecuteAzCopyCommand(operation Operation, src, dst string, if logDir != "" { env = append(env, "AZCOPY_LOG_LOCATION="+logDir) + env = append(env, "AZCOPY_JOB_PLAN_LOCATION="+filepath.Join(logDir, "plans")) } out, err := t.execDebuggableWithOutput(GlobalInputManager{}.GetExecutablePath(), args, env, afterStart, chToStdin)