@@ -118,6 +118,29 @@ func TestManifestPush(t *testing.T) {
118118 "output" : expectedDigest ,
119119 }),
120120 },
121+ {
122+ Description : "reject-cross-registry-sources" ,
123+ Require : require .Not (nerdtest .Docker ),
124+ Setup : func (data test.Data , helpers test.Helpers ) {
125+ targetRef := fmt .Sprintf ("%s:%d/%s" ,
126+ registryTokenAuthHTTPSRandom .IP .String (), registryTokenAuthHTTPSRandom .Port , "test-list-push:v1" )
127+ helpers .Ensure ("manifest" , "create" , "--insecure" , targetRef + "-cross" , manifestRef )
128+ },
129+ Command : func (data test.Data , helpers test.Helpers ) test.TestableCommand {
130+ targetRef := fmt .Sprintf ("%s:%d/%s" ,
131+ registryTokenAuthHTTPSRandom .IP .String (), registryTokenAuthHTTPSRandom .Port , "test-list-push:v1" )
132+ return helpers .Command ("manifest" , "push" , "--insecure" , targetRef + "-cross" )
133+ },
134+ Expected : func (data test.Data , helpers test.Helpers ) * test.Expected {
135+ return & test.Expected {
136+ ExitCode : 1 ,
137+ Errors : []error {errors .New (data .Labels ().Get ("error" ))},
138+ }
139+ },
140+ Data : test .WithLabels (map [string ]string {
141+ "error" : "cannot use source images from a different registry than the target image:" ,
142+ }),
143+ },
121144 },
122145 }
123146 testCase .Run (t )
0 commit comments