Correct the unindexed sensitivity fixture

This commit is contained in:
2026-10-09 04:11:50 +00:00
parent b37948cfea
commit f849e06b77
2 changed files with 17 additions and 7 deletions

View File

@@ -7,11 +7,12 @@ import (
func TestSecretDependencyClosureMatchesFixedPointScan(t *testing.T) {
tests := []struct {
name string
paths map[string]Path
seed map[string]bool
dependencies []secretDependency
inherited []secretDependency
name string
paths map[string]Path
seed map[string]bool
dependencies []secretDependency
inherited []secretDependency
wantSensitivity map[string]bool
}{
{
name: "forward reverse chains and cycles",
@@ -38,13 +39,14 @@ func TestSecretDependencyClosureMatchesFixedPointScan(t *testing.T) {
{
name: "unindexed seed only activates inherited relations",
paths: secretPaths(Keys("ordinary"), Keys("copy")),
seed: map[string]bool{"untracked": true},
seed: secretSet(Keys("untracked")),
dependencies: []secretDependency{
{dependency: Keys("untracked"), target: Keys("ordinary")},
},
inherited: []secretDependency{
{dependency: Keys("untracked"), target: Keys("copy")},
},
wantSensitivity: map[string]bool{"/copy": true, "/ordinary": false},
},
{
name: "inheritance direction root escapes and numeric spellings",
@@ -75,6 +77,11 @@ func TestSecretDependencyClosureMatchesFixedPointScan(t *testing.T) {
if !reflect.DeepEqual(got, want) {
t.Fatalf("closure = %#v, want %#v", got, want)
}
for pointer, sensitive := range test.wantSensitivity {
if got[pointer] != sensitive {
t.Errorf("sensitivity at %q = %v, want %v", pointer, got[pointer], sensitive)
}
}
})
}
}