Skip to content

Commit

Permalink
Fix failing TestAddGlobalArtifactToScope unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
jessesuen committed Jan 9, 2019
1 parent 4fd758c commit 6726d9a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions workflow/controller/operator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -765,27 +765,27 @@ func TestAddGlobalArtifactToScope(t *testing.T) {
},
}
// Make sure if the artifact is not global, don't add to scope
woc.addArtifactToGlobalScope(art)
woc.addArtifactToGlobalScope(art, nil)
assert.Nil(t, woc.wf.Status.Outputs)

// Now mark it as global. Verify it is added to workflow outputs
art.GlobalName = "global-art"
woc.addArtifactToGlobalScope(art)
woc.addArtifactToGlobalScope(art, nil)
assert.Equal(t, 1, len(woc.wf.Status.Outputs.Artifacts))
assert.Equal(t, art.GlobalName, woc.wf.Status.Outputs.Artifacts[0].Name)
assert.Equal(t, "some/key", woc.wf.Status.Outputs.Artifacts[0].S3.Key)

// Change the value and verify update is reflected
art.S3.Key = "new/key"
woc.addArtifactToGlobalScope(art)
woc.addArtifactToGlobalScope(art, nil)
assert.Equal(t, 1, len(woc.wf.Status.Outputs.Artifacts))
assert.Equal(t, art.GlobalName, woc.wf.Status.Outputs.Artifacts[0].Name)
assert.Equal(t, "new/key", woc.wf.Status.Outputs.Artifacts[0].S3.Key)

// Add a new global artifact
art.GlobalName = "global-art2"
art.S3.Key = "new/new/key"
woc.addArtifactToGlobalScope(art)
woc.addArtifactToGlobalScope(art, nil)
assert.Equal(t, 2, len(woc.wf.Status.Outputs.Artifacts))
assert.Equal(t, art.GlobalName, woc.wf.Status.Outputs.Artifacts[1].Name)
assert.Equal(t, "new/new/key", woc.wf.Status.Outputs.Artifacts[1].S3.Key)
Expand Down

0 comments on commit 6726d9a

Please sign in to comment.