| index bca47d25f..b6b8ff7f8 100644 |
| --- a/internal/hostrelocate/pin_envkey_test.go |
| +++ b/internal/hostrelocate/pin_envkey_test.go |
| @@ -127,11 +127,11 @@ func TestStorePinnerKeyEvidence(t *testing.T) { |
| |
| var errUnreadable = errors.New("sentinel: any read error") |
| |
| -// A configured key's record vouches only beside the env item that shows |
| -// the instance's own file supplies no key. A manifest without host.env is |
| -// not evidence that nothing overrides the configuration at launch (absence |
| -// is never evidence): the pin refuses, and the same record beside an env |
| -// item with no key of its own pins. |
| +// A configured key's record vouches only beside positive evidence that the |
| +// instance's own file supplies no key: the env item with no key of its |
| +// own, or the release flush's deletion entry for it. A manifest that never |
| +// published host.env is not evidence that nothing overrides the |
| +// configuration at launch (absence is never evidence): the pin refuses. |
| func TestStorePinnerConfigRecordNeedsTheEnvItem(t *testing.T) { |
| ctx := context.Background() |
| at := time.Date(2026, 10, 7, 9, 0, 0, 0, time.UTC) |
| @@ -139,11 +139,12 @@ func TestStorePinnerConfigRecordNeedsTheEnvItem(t *testing.T) { |
| record := string(instancekey.AdoptionRecord(writer, instancekey.SourceConfig, instancekey.Digest("configured-A"))) |
| for _, tc := range []struct { |
| name string |
| - env bool |
| + env string // "", "item" or "deleted" |
| want error |
| }{ |
| - {"no env item", false, ErrFilesUnevidenced}, |
| - {"an env item with no key of its own", true, nil}, |
| + {"an env item never published", "", ErrFilesUnevidenced}, |
| + {"an env item with no key of its own", "item", nil}, |
| + {"the flush's deletion entry for the env item", "deleted", nil}, |
| } { |
| t.Run(tc.name, func(t *testing.T) { |
| claims, data := release.NewDirStore(t.TempDir()), release.NewDirStore(t.TempDir()) |
| @@ -160,8 +161,11 @@ func TestStorePinnerConfigRecordNeedsTheEnvItem(t *testing.T) { |
| m.Platform[name] = hostfiles.Entry{Object: obj, SHA256: sha, Size: int64(len(body)), Mode: 0o600, Seq: 4} |
| } |
| item(instancekey.AdoptionItem, record) |
| - if tc.env { |
| + switch tc.env { |
| + case "item": |
| item(hostfiles.EnvItem, "CARLOS_ADMIN_TOKEN=t\n") |
| + case "deleted": |
| + m.Platform[hostfiles.EnvItem] = hostfiles.Entry{Seq: 4, Deleted: true} |
| } |
| putManifest(t, data, "g3", m) |
| p := StorePinner{Claims: claims, Data: data, Release: routeRelease, Bucket: "data", Region: "ie", SelectDB: selectAt(41)} |