Add test case to check that multiple DefaultLabeller instances have the same runID
@@ -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",
