layer1: add namespace bootstrap step 11
This commit is contained in:
@@ -137,4 +137,24 @@ func TestNamespaceManagerMarkPartStateDerivesPhase(t *testing.T) {
|
||||
if record.Phase != NamespacePhaseFailed {
|
||||
t.Fatalf("expected phase failed, got %s", record.Phase)
|
||||
}
|
||||
}
|
||||
|
||||
func TestNamespaceManagerBootstrap(t *testing.T) {
|
||||
manager := NewNamespaceManager()
|
||||
now := time.Now().UTC()
|
||||
records := manager.Bootstrap([]string{"tenant-b", "tenant-a"}, NamespaceSourceBackfill, now)
|
||||
|
||||
if len(records) != 2 {
|
||||
t.Fatalf("expected 2 bootstrap records, got %d", len(records))
|
||||
}
|
||||
if !reflect.DeepEqual([]string{"tenant-a", "tenant-b"}, manager.Snapshot()) {
|
||||
t.Fatalf("expected manager snapshot to contain bootstrapped namespaces")
|
||||
}
|
||||
record, ok := manager.Get("tenant-a")
|
||||
if !ok {
|
||||
t.Fatalf("expected tenant-a after bootstrap")
|
||||
}
|
||||
if record.Source != NamespaceSourceBackfill {
|
||||
t.Fatalf("expected bootstrap source backfill, got %s", record.Source)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user