1
0
mirror of synced 2026-05-03 02:03:31 +00:00

feat: adding support digest pinning for flux plugin install

Signed-off-by: iam-karan-suresh <karansuresh.info@gmail.com>
This commit is contained in:
iam-karan-suresh
2026-04-26 12:20:14 +05:30
parent 4e78a9d7e0
commit df3878d36a
5 changed files with 151 additions and 10 deletions

View File

@@ -211,6 +211,7 @@ func TestParseNameVersion(t *testing.T) {
{"operator@0.45.0", "operator", "0.45.0"},
{"my-tool@1.0.0", "my-tool", "1.0.0"},
{"plugin@", "plugin", ""},
{"operator@sha256:abc123", "operator", "sha256:abc123"},
}
for _, tt := range tests {
@@ -226,6 +227,27 @@ func TestParseNameVersion(t *testing.T) {
}
}
func TestIsDigestRef(t *testing.T) {
tests := []struct {
input string
want bool
}{
{"sha256:06e0a38db4fa6bc9f705a577c7e58dc020bfe2618e45488599e5ef7bb62e3a8a", true},
{"0.45.0", false},
{"", false},
{"sha256", false},
{"SHA256:abc", false}, // case-sensitive
}
for _, tt := range tests {
t.Run(tt.input, func(t *testing.T) {
if got := isDigestRef(tt.input); got != tt.want {
t.Errorf("isDigestRef(%q) = %v, want %v", tt.input, got, tt.want)
}
})
}
}
func TestPluginDiscoverSkipsBuiltins(t *testing.T) {
origHandler := pluginHandler
defer func() { pluginHandler = origHandler }()