diff --git a/cmd/mesh-controller/walk_from_keys_integration_test.go b/cmd/mesh-controller/walk_from_keys_integration_test.go index 3705da9d..a63213ab 100644 --- a/cmd/mesh-controller/walk_from_keys_integration_test.go +++ b/cmd/mesh-controller/walk_from_keys_integration_test.go @@ -155,3 +155,32 @@ func TestTheBuilderABuildModuleAndTheControllerAreTakenFromKeysAndNothingIsAsked case <-time.After(300 * time.Millisecond): } } + +// C5's criterion: after a plan that moves the builder, its record names the builder's key and its fingerprint. +func TestTheBuildersRecordNamesItsKeyAndFingerprint(t *testing.T) { + tm := aTierMesh(t, sdkdelivery.BuilderModule) + ctx := t.Context() + inv := tm.open.inventory + b := aBuilderOnTheBus(t) + p := tm.plan(t) + p.Commit = "c6c6c6c6c6c6c6c6" + p.Modules[sdkdelivery.BuilderModule] = &inventory.PlanModule{} + if err := inv.SavePlan(ctx, &p); err != nil { + t.Fatal(err) + } + fp := fpOf('9') + manifest := b.indexed(t, sdkdelivery.BuilderModule, "c6", "novox/mesh-catalog", "modules/"+sdkdelivery.BuilderModule, p.Commit, fp) + b.built(t, sdkdelivery.BuilderModule, "c6", fp, manifest, sdkdelivery.BuildDone) + becomes(t, 10*time.Second, "the builder taken from its key", func() bool { + advancePlans(ctx, tm.open) + return tm.plan(t).Modules[sdkdelivery.BuilderModule].State == "built" + }) + id := tm.plan(t).Modules[sdkdelivery.BuilderModule].Build + record, found, err := inv.BuildByID(ctx, id) + if err != nil || !found { + t.Fatalf("the builder's record %q: %v %v", id, found, err) + } + if !strings.HasPrefix(record.ID, "key-") || record.SourceFingerprint != fp || record.Module != sdkdelivery.BuilderModule { + t.Fatalf("the builder's record names %+v, not its key and fingerprint %s", record, fp) + } +}