layer1: add namespace event helpers step 15
This commit is contained in:
@@ -64,4 +64,25 @@ func TestNamespaceRecordIsTerminal(t *testing.T) {
|
||||
t.Fatalf("expected terminal=%v for phase %s", test.expected, test.phase)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestNewNamespaceEventClonesLabels(t *testing.T) {
|
||||
now := time.Now().UTC()
|
||||
labels := map[string]string{ManagedNamespaceLabelKey: ManagedNamespaceLabelValue}
|
||||
event := NewNamespaceEvent(NamespaceEventAdd, "tenant-a", labels, NamespaceSourceWatcher, now)
|
||||
labels[ManagedNamespaceLabelKey] = "false"
|
||||
|
||||
if event.Labels[ManagedNamespaceLabelKey] != ManagedNamespaceLabelValue {
|
||||
t.Fatalf("expected namespace event labels to be cloned")
|
||||
}
|
||||
}
|
||||
|
||||
func TestManagedNamespaceEvent(t *testing.T) {
|
||||
event := ManagedNamespaceEvent(NamespaceEventAdd, "tenant-a", NamespaceSourceWatcher, time.Now().UTC())
|
||||
if event.Labels[ManagedNamespaceLabelKey] != ManagedNamespaceLabelValue {
|
||||
t.Fatalf("expected managed namespace label in event")
|
||||
}
|
||||
if event.Name != "tenant-a" {
|
||||
t.Fatalf("expected tenant-a event name")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user