console: begin's store refusals are proven to write no record (Plan 6 Task 1)
The two refusals ruling R3 puts before the record now spy on the record key and fail on any write, not only on a record left afterwards: a refusal moved after the write would roll back and still leave none.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 file changed,
+10
−0
internal/console/apiinstanceimport_test.go+10 −0
CI passed — run details
diff --git a/internal/console/apiinstanceimport_test.go b/internal/console/apiinstanceimport_test.go| index 52530de47..48b75b86b 100644 |
| --- a/internal/console/apiinstanceimport_test.go |
| +++ b/internal/console/apiinstanceimport_test.go |
| @@ -287,7 +287,12 @@ func TestImportBeginRefusesATakenStore(t *testing.T) { |
| if _, err := objstore.PutIn(context.Background(), f.fx.rel, "bab", fromApp, "old", foreign, ""); err != nil { |
| t.Fatal(err) |
| } |
| + var seen *provision.Record |
| + f.fx.srv.cfg.Releases = &recordSpy{Store: f.fx.rel, key: provision.RecordKey("bab", fromApp, importHost), seen: &seen} |
| code, out := beginImport(t, f, importHost, importSHA, 10) |
| + if seen != nil { |
| + t.Fatalf("a record was written before the refusal: %+v", seen) |
| + } |
| if code != http.StatusConflict || str(t, out, "error") != "environment old already has a store (carlos-bab-shop-old). A seeded instance needs a new, empty one." { |
| t.Fatalf("= %d %v", code, out) |
| } |
| @@ -300,10 +305,15 @@ func TestImportBeginStoreGatesRefuseBeforeTheRecord(t *testing.T) { |
| f := newImportFixture(t) |
| enableInstances(t, f.fx, fromApp, fromManifest(true)) |
| f.fx.srv.cfg.SecretsPub = "" |
| + var seen *provision.Record |
| + f.fx.srv.cfg.Releases = &recordSpy{Store: f.fx.rel, key: provision.RecordKey("bab", fromApp, importHost), seen: &seen} |
| code, out := beginImport(t, f, importHost, importSHA, 10) |
| if code != http.StatusServiceUnavailable || str(t, out, "error") != "this console has no secrets key (CARLOS_SECRETS_PUBKEY) — it cannot deliver a store credential, so it will not mint one" { |
| t.Fatalf("= %d %v", code, out) |
| } |
| + if seen != nil { |
| + t.Fatalf("a record was written before the refusal: %+v", seen) |
| + } |
| f.requireNoRecord(t, importHost) |
| } |