@@ -18,42 +18,38 @@ func TestValidateOCI_RegistryAllowlist(t *testing.T) {
1818 expectError bool
1919 errorMsg string
2020 }{
21- // Allowed registries - these should NOT fail with "unsupported registry"
21+ // Allowed registries - use real public images that exist
22+ // These should fail with "missing required annotation" (no MCP label)
23+ // NOT with "unsupported registry", "does not exist", or "is private" errors
2224 {
23- name : "Docker Hub should be allowed" ,
24- identifier : "docker.io/test/image:latest" ,
25- // Will fail on image not found, but registry should be accepted
25+ name : "Docker Hub should be allowed" ,
26+ identifier : "docker.io/library/alpine:latest" ,
2627 expectError : true ,
28+ errorMsg : "missing required annotation" ,
2729 },
2830 {
29- name : "Docker Hub without explicit registry should default and be allowed" ,
30- identifier : "test/image:latest" ,
31- // Will fail on image not found, but registry should be accepted
31+ name : "Docker Hub without explicit registry should default and be allowed" ,
32+ identifier : "library/hello-world:latest" ,
3233 expectError : true ,
34+ errorMsg : "missing required annotation" ,
3335 },
3436 {
35- name : "GHCR should be allowed" ,
36- identifier : "ghcr.io/test/image:latest" ,
37- // Will fail on image fetch, but registry should be accepted
37+ name : "GHCR should be allowed" ,
38+ identifier : "ghcr.io/containerbase/base:latest" ,
3839 expectError : true ,
40+ errorMsg : "missing required annotation" ,
3941 },
4042 {
41- name : "Artifact Registry us-central1 should be allowed" ,
42- identifier : "us-central1-docker.pkg.dev/project/repo/image:latest" ,
43- // Will fail on image fetch, but registry should be accepted
43+ name : "Artifact Registry regional should be allowed" ,
44+ identifier : "us-central1-docker.pkg.dev/database-toolbox/toolbox/toolbox:latest" ,
4445 expectError : true ,
46+ errorMsg : "missing required annotation" ,
4547 },
4648 {
47- name : "Artifact Registry europe-west1 should be allowed" ,
48- identifier : "europe-west1-docker.pkg.dev/project/repo/image:latest" ,
49- // Will fail on image fetch, but registry should be accepted
50- expectError : true ,
51- },
52- {
53- name : "Artifact Registry multi-region us should be allowed" ,
54- identifier : "us-docker.pkg.dev/project/repo/image:latest" ,
55- // Will fail on image fetch, but registry should be accepted
49+ name : "Artifact Registry multi-region should be allowed" ,
50+ identifier : "us-docker.pkg.dev/berglas/berglas/berglas:latest" ,
5651 expectError : true ,
52+ errorMsg : "missing required annotation" ,
5753 },
5854
5955 // Disallowed registries
@@ -106,13 +102,8 @@ func TestValidateOCI_RegistryAllowlist(t *testing.T) {
106102
107103 if tt .expectError {
108104 assert .Error (t , err )
109- if tt .errorMsg != "" {
110- // Should contain the specific error message
111- assert .Contains (t , err .Error (), tt .errorMsg )
112- } else {
113- // For allowed registries, should NOT be "unsupported registry" error
114- assert .NotContains (t , err .Error (), "unsupported OCI registry" )
115- }
105+ // Should contain the specific error message
106+ assert .Contains (t , err .Error (), tt .errorMsg )
116107 } else {
117108 assert .NoError (t , err )
118109 }
0 commit comments