Skip to content

Commit

Permalink
Add test case to check that multiple DefaultLabeller instances have t…
Browse files Browse the repository at this point in the history
…he same runID

Signed-off-by: Cornelius Weig <22861411+corneliusweig@users.noreply.github.com>
  • Loading branch information
corneliusweig committed Aug 3, 2019
1 parent 938824e commit 2e02db0
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions pkg/skaffold/deploy/labeller_test.go
Expand Up @@ -48,13 +48,22 @@ func TestDefaultLabeller(t *testing.T) {
"skaffold.dev/run-id": l.runID,
}
t.CheckDeepEqual(expected, labels)
if l.runID == "" {
t.Error("run-id label should not be empty")
}
})
}
}

func TestDefaultLabeller_TwoInstancesHaveSameRunID(t *testing.T) {
first := NewLabeller("v1.0.0")
second := NewLabeller("v2.0.0")

if first.RunIDKeyValueString() != second.RunIDKeyValueString() {
t.Errorf("expected the run-id to be the same for two instances")
}
if first.runID == "" {
t.Error("run-id label should not be empty")
}
}

func TestK8sManagedByLabelKeyValueString(t *testing.T) {
defaultLabeller := &DefaultLabeller{
version: "version",
Expand Down

0 comments on commit 2e02db0

Please sign in to comment.