Skip to content

Commit

Permalink
wip -- params reset to runCmd()
Browse files Browse the repository at this point in the history
  • Loading branch information
ransomw1c committed Jun 26, 2019
1 parent f887296 commit a02ff06
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions cmd/datamon/cmd/cli_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,13 +139,21 @@ func setupTests(t *testing.T) func() {
os.RemoveAll(destinationDir)
deleteBucket(ctx, t, client, bucketMeta)
deleteBucket(ctx, t, client, bucketBlob)
params = paramsT{}
}
return cleanup
}

func runCmd(t *testing.T, cmd []string, intentMsg string, expectError bool) {
fatalCallsBefore := exitMocks.fatalCalls
bucketMeta := params.repo.MetadataBucket
bucketBlob := params.repo.BlobBucket
contributorEmail := params.repo.ContributorEmail
contributorName := params.repo.ContributorName
params = paramsT{}
params.repo.MetadataBucket = bucketMeta
params.repo.BlobBucket = bucketBlob
params.repo.ContributorEmail = contributorEmail
params.repo.ContributorName = contributorName
rootCmd.SetArgs(cmd)
require.NoError(t, rootCmd.Execute(), "error executing '"+strings.Join(cmd, " ")+"' : "+intentMsg)
if expectError {
Expand Down Expand Up @@ -762,9 +770,6 @@ func TestDiffBundle(t *testing.T) {
"--repo", repo1,
"--concurrency-factor", "20",
}, "upload bundle at "+dirPathStr(t, files[0]), false)
// todo: zero out params in runCmd(), not cleanup()
// params = paramsT{} << this breaks getting bundle id from label
params.bundle.ID = ""
r, w, err := os.Pipe()
if err != nil {
panic(err)
Expand Down

0 comments on commit a02ff06

Please sign in to comment.