@@ -248,23 +248,25 @@ func TestNewCreateCommandWithContentTrustErrors(t *testing.T) {
248248 },
249249 }
250250 for _ , tc := range testCases {
251- fakeCLI := test .NewFakeCli (& fakeClient {
252- createContainerFunc : func (config * container.Config ,
253- hostConfig * container.HostConfig ,
254- networkingConfig * network.NetworkingConfig ,
255- platform * specs.Platform ,
256- containerName string ,
257- ) (container.CreateResponse , error ) {
258- return container.CreateResponse {}, errors .New ("shouldn't try to pull image" )
259- },
260- }, test .EnableContentTrust )
261- fakeCLI .SetNotaryClient (tc .notaryFunc )
262- cmd := NewCreateCommand (fakeCLI )
263- cmd .SetOut (io .Discard )
264- cmd .SetErr (io .Discard )
265- cmd .SetArgs (tc .args )
266- err := cmd .Execute ()
267- assert .ErrorContains (t , err , tc .expectedError )
251+ t .Run (tc .name , func (t * testing.T ) {
252+ fakeCLI := test .NewFakeCli (& fakeClient {
253+ createContainerFunc : func (config * container.Config ,
254+ hostConfig * container.HostConfig ,
255+ networkingConfig * network.NetworkingConfig ,
256+ platform * specs.Platform ,
257+ containerName string ,
258+ ) (container.CreateResponse , error ) {
259+ return container.CreateResponse {}, errors .New ("shouldn't try to pull image" )
260+ },
261+ }, test .EnableContentTrust )
262+ fakeCLI .SetNotaryClient (tc .notaryFunc )
263+ cmd := NewCreateCommand (fakeCLI )
264+ cmd .SetOut (io .Discard )
265+ cmd .SetErr (io .Discard )
266+ cmd .SetArgs (tc .args )
267+ err := cmd .Execute ()
268+ assert .ErrorContains (t , err , tc .expectedError )
269+ })
268270 }
269271}
270272
0 commit comments