package activator import ( "context" "testing" ) // Settings spec rev 11 ยง4.3a: a landing move carries the build state with // the replica. The legacy round mirrors the whole hibernate prefix to // moves//, and promoteStagedReplica copies every staged object over // the own prefix, build-state.json included. This pins today's behaviour: // a keep filter added to the promotion later must not drop it. func TestALandingMovePromotesTheBuildState(t *testing.T) { b := testExecBackend(t) m := newFakeMirrorStore() b.Mirror = m host := "moved.example.com" m.put(b.Cfg.Bucket, MovesPrefix(host)+"generations/0000/a.ltx", "e1") m.put(b.Cfg.Bucket, MovesPrefix(host)+"build-state.json", "e2") if _, err := b.promoteStagedReplica(context.Background(), host); err != nil { t.Fatal(err) } got, ok := m.buckets[b.Cfg.Bucket][b.Cfg.hibernatePrefix(host)+"/build-state.json"] if !ok || got.ETag != "e2" { t.Fatalf("the landing did not carry build-state.json beside the replica: %+v %v", got, ok) } if _, ok := m.buckets[b.Cfg.Bucket][b.Cfg.hibernatePrefix(host)+"/generations/0000/a.ltx"]; !ok { t.Fatal("the landing did not carry the replica") } }