Skip to content
This repository has been archived by the owner on Nov 1, 2022. It is now read-only.

Commit

Permalink
Run manifest policy update unit tests in parallel
Browse files Browse the repository at this point in the history
  • Loading branch information
2opremio committed Dec 11, 2019
1 parent 562384f commit 38ad933
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions pkg/cluster/kubernetes/policies_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,13 +186,15 @@ func TestUpdatePolicies(t *testing.T) {
},
} {
t.Run(c.name, func(t *testing.T) {
caseIn := templToString(t, annotationsTemplate, c.in)
caseOut := templToString(t, annotationsTemplate, c.out)
cLocal := c // Use copy to avoid races between parallel tests
t.Parallel()
caseIn := templToString(t, annotationsTemplate, cLocal.in)
caseOut := templToString(t, annotationsTemplate, cLocal.out)
resourceID := resource.MustParseID("default:deployment/nginx")
manifests := NewManifests(ConstNamespacer("default"), log.NewLogfmtLogger(os.Stdout))
out, err := manifests.UpdateWorkloadPolicies([]byte(caseIn), resourceID, c.update)
assert.Equal(t, c.wantErr, err != nil, "unexpected error value: %s", err)
if !c.wantErr {
out, err := manifests.UpdateWorkloadPolicies([]byte(caseIn), resourceID, cLocal.update)
assert.Equal(t, cLocal.wantErr, err != nil, "unexpected error value: %s", err)
if !cLocal.wantErr {
assert.Equal(t, string(out), caseOut)
}
})
Expand Down

0 comments on commit 38ad933

Please sign in to comment.