Skip to content

Commit cd0c184

Browse files
authored
Merge branch 'main' into streaming-timeout
2 parents 1e48e39 + 27fb3a9 commit cd0c184

File tree

10 files changed

+249
-221
lines changed

10 files changed

+249
-221
lines changed

executor/linux/build_test.go

Lines changed: 75 additions & 75 deletions
Large diffs are not rendered by default.

executor/linux/linux_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ func testUser() *library.User {
239239
}
240240
}
241241

242-
// testUser is a test helper function to create a metadata
242+
// testMetadata is a test helper function to create a metadata
243243
// type with all fields set to a fake value.
244244
func testMetadata() *types.Metadata {
245245
return &types.Metadata{

executor/linux/opts_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,7 @@ func TestLinux_Opt_WithRuntime(t *testing.T) {
482482
// setup types
483483
_runtime, err := docker.NewMock()
484484
if err != nil {
485-
t.Errorf("unable to create runtime engine: %v", err)
485+
t.Errorf("unable to create docker runtime engine: %v", err)
486486
}
487487

488488
// setup tests

executor/linux/secret_test.go

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ func TestLinux_Secret_create(t *testing.T) {
4747

4848
_runtime, err := docker.NewMock()
4949
if err != nil {
50-
t.Errorf("unable to create runtime engine: %v", err)
50+
t.Errorf("unable to create docker runtime engine: %v", err)
5151
}
5252

5353
// setup tests
@@ -57,7 +57,7 @@ func TestLinux_Secret_create(t *testing.T) {
5757
container *pipeline.Container
5858
}{
5959
{
60-
name: "good image tag",
60+
name: "docker-good image tag",
6161
failure: false,
6262
container: &pipeline.Container{
6363
ID: "secret_github_octocat_1_vault",
@@ -70,7 +70,7 @@ func TestLinux_Secret_create(t *testing.T) {
7070
},
7171
},
7272
{
73-
name: "notfound image tag",
73+
name: "docker-notfound image tag",
7474
failure: true,
7575
container: &pipeline.Container{
7676
ID: "secret_github_octocat_1_vault",
@@ -96,21 +96,21 @@ func TestLinux_Secret_create(t *testing.T) {
9696
WithVelaClient(_client),
9797
)
9898
if err != nil {
99-
t.Errorf("unable to create executor engine: %v", err)
99+
t.Errorf("unable to create %s executor engine: %v", test.name, err)
100100
}
101101

102102
err = _engine.secret.create(context.Background(), test.container)
103103

104104
if test.failure {
105105
if err == nil {
106-
t.Errorf("create should have returned err")
106+
t.Errorf("%s create should have returned err", test.name)
107107
}
108108

109109
return // continue to next test
110110
}
111111

112112
if err != nil {
113-
t.Errorf("create returned err: %v", err)
113+
t.Errorf("%s create returned err: %v", test.name, err)
114114
}
115115
})
116116
}
@@ -134,7 +134,7 @@ func TestLinux_Secret_delete(t *testing.T) {
134134

135135
_runtime, err := docker.NewMock()
136136
if err != nil {
137-
t.Errorf("unable to create runtime engine: %v", err)
137+
t.Errorf("unable to create docker runtime engine: %v", err)
138138
}
139139

140140
_step := new(library.Step)
@@ -150,7 +150,7 @@ func TestLinux_Secret_delete(t *testing.T) {
150150
step *library.Step
151151
}{
152152
{
153-
name: "running container-empty step",
153+
name: "docker-running container-empty step",
154154
failure: false,
155155
container: &pipeline.Container{
156156
ID: "secret_github_octocat_1_vault",
@@ -164,7 +164,7 @@ func TestLinux_Secret_delete(t *testing.T) {
164164
step: new(library.Step),
165165
},
166166
{
167-
name: "running container-pending step",
167+
name: "docker-running container-pending step",
168168
failure: false,
169169
container: &pipeline.Container{
170170
ID: "secret_github_octocat_1_vault",
@@ -178,7 +178,7 @@ func TestLinux_Secret_delete(t *testing.T) {
178178
step: _step,
179179
},
180180
{
181-
name: "inspecting container failure due to invalid container id",
181+
name: "docker-inspecting container failure due to invalid container id",
182182
failure: true,
183183
container: &pipeline.Container{
184184
ID: "secret_github_octocat_1_notfound",
@@ -192,7 +192,7 @@ func TestLinux_Secret_delete(t *testing.T) {
192192
step: new(library.Step),
193193
},
194194
{
195-
name: "removing container failure",
195+
name: "docker-removing container failure",
196196
failure: true,
197197
container: &pipeline.Container{
198198
ID: "secret_github_octocat_1_ignorenotfound",
@@ -219,7 +219,7 @@ func TestLinux_Secret_delete(t *testing.T) {
219219
WithVelaClient(_client),
220220
)
221221
if err != nil {
222-
t.Errorf("unable to create executor engine: %v", err)
222+
t.Errorf("unable to create %s executor engine: %v", test.name, err)
223223
}
224224

225225
_ = _engine.CreateBuild(context.Background())
@@ -230,14 +230,14 @@ func TestLinux_Secret_delete(t *testing.T) {
230230

231231
if test.failure {
232232
if err == nil {
233-
t.Errorf("destroy should have returned err")
233+
t.Errorf("%s destroy should have returned err", test.name)
234234
}
235235

236236
return // continue to next test
237237
}
238238

239239
if err != nil {
240-
t.Errorf("destroy returned err: %v", err)
240+
t.Errorf("%s destroy returned err: %v", test.name, err)
241241
}
242242
})
243243
}
@@ -263,7 +263,7 @@ func TestLinux_Secret_exec(t *testing.T) {
263263

264264
_runtime, err := docker.NewMock()
265265
if err != nil {
266-
t.Errorf("unable to create runtime engine: %v", err)
266+
t.Errorf("unable to create docker runtime engine: %v", err)
267267
}
268268

269269
streamRequests, done := message.MockStreamRequestsWithCancel(context.Background())
@@ -276,12 +276,12 @@ func TestLinux_Secret_exec(t *testing.T) {
276276
pipeline string
277277
}{
278278
{
279-
name: "basic secrets pipeline",
279+
name: "docker-basic secrets pipeline",
280280
failure: false,
281281
pipeline: "testdata/build/secrets/basic.yml",
282282
},
283283
{
284-
name: "pipeline with secret name not found",
284+
name: "docker-pipeline with secret name not found",
285285
failure: true,
286286
pipeline: "testdata/build/secrets/name_notfound.yml",
287287
},
@@ -313,7 +313,7 @@ func TestLinux_Secret_exec(t *testing.T) {
313313
withStreamRequests(streamRequests),
314314
)
315315
if err != nil {
316-
t.Errorf("unable to create executor engine: %v", err)
316+
t.Errorf("unable to create %s executor engine: %v", test.name, err)
317317
}
318318

319319
_engine.build.SetStatus(constants.StatusSuccess)
@@ -325,14 +325,14 @@ func TestLinux_Secret_exec(t *testing.T) {
325325

326326
if test.failure {
327327
if err == nil {
328-
t.Errorf("exec should have returned err")
328+
t.Errorf("%s exec should have returned err", test.name)
329329
}
330330

331331
return // continue to next test
332332
}
333333

334334
if err != nil {
335-
t.Errorf("exec returned err: %v", err)
335+
t.Errorf("%s exec returned err: %v", test.name, err)
336336
}
337337
})
338338
}
@@ -355,7 +355,7 @@ func TestLinux_Secret_pull(t *testing.T) {
355355

356356
_runtime, err := docker.NewMock()
357357
if err != nil {
358-
t.Errorf("unable to create runtime engine: %v", err)
358+
t.Errorf("unable to create docker runtime engine: %v", err)
359359
}
360360

361361
// setup tests
@@ -365,7 +365,7 @@ func TestLinux_Secret_pull(t *testing.T) {
365365
secret *pipeline.Secret
366366
}{
367367
{
368-
name: "success with org secret",
368+
name: "docker-success with org secret",
369369
failure: false,
370370
secret: &pipeline.Secret{
371371
Name: "foo",
@@ -377,7 +377,7 @@ func TestLinux_Secret_pull(t *testing.T) {
377377
},
378378
},
379379
{
380-
name: "failure with invalid org secret",
380+
name: "docker-failure with invalid org secret",
381381
failure: true,
382382
secret: &pipeline.Secret{
383383
Name: "foo",
@@ -389,7 +389,7 @@ func TestLinux_Secret_pull(t *testing.T) {
389389
},
390390
},
391391
{
392-
name: "failure with org secret key not found",
392+
name: "docker-failure with org secret key not found",
393393
failure: true,
394394
secret: &pipeline.Secret{
395395
Name: "foo",
@@ -401,7 +401,7 @@ func TestLinux_Secret_pull(t *testing.T) {
401401
},
402402
},
403403
{
404-
name: "success with repo secret",
404+
name: "docker-success with repo secret",
405405
failure: false,
406406
secret: &pipeline.Secret{
407407
Name: "foo",
@@ -413,7 +413,7 @@ func TestLinux_Secret_pull(t *testing.T) {
413413
},
414414
},
415415
{
416-
name: "failure with invalid repo secret",
416+
name: "docker-failure with invalid repo secret",
417417
failure: true,
418418
secret: &pipeline.Secret{
419419
Name: "foo",
@@ -425,7 +425,7 @@ func TestLinux_Secret_pull(t *testing.T) {
425425
},
426426
},
427427
{
428-
name: "failure with repo secret key not found",
428+
name: "docker-failure with repo secret key not found",
429429
failure: true,
430430
secret: &pipeline.Secret{
431431
Name: "foo",
@@ -437,7 +437,7 @@ func TestLinux_Secret_pull(t *testing.T) {
437437
},
438438
},
439439
{
440-
name: "success with shared secret",
440+
name: "docker-success with shared secret",
441441
failure: false,
442442
secret: &pipeline.Secret{
443443
Name: "foo",
@@ -449,7 +449,7 @@ func TestLinux_Secret_pull(t *testing.T) {
449449
},
450450
},
451451
{
452-
name: "failure with shared secret key not found",
452+
name: "docker-failure with shared secret key not found",
453453
failure: true,
454454
secret: &pipeline.Secret{
455455
Name: "foo",
@@ -461,7 +461,7 @@ func TestLinux_Secret_pull(t *testing.T) {
461461
},
462462
},
463463
{
464-
name: "failure with invalid type",
464+
name: "docker-failure with invalid type",
465465
failure: true,
466466
secret: &pipeline.Secret{
467467
Name: "foo",
@@ -486,21 +486,21 @@ func TestLinux_Secret_pull(t *testing.T) {
486486
WithVelaClient(_client),
487487
)
488488
if err != nil {
489-
t.Errorf("unable to create executor engine: %v", err)
489+
t.Errorf("unable to create %s executor engine: %v", test.name, err)
490490
}
491491

492492
_, err = _engine.secret.pull(test.secret)
493493

494494
if test.failure {
495495
if err == nil {
496-
t.Errorf("pull should have returned err")
496+
t.Errorf("%s pull should have returned err", test.name)
497497
}
498498

499499
return // continue to next test
500500
}
501501

502502
if err != nil {
503-
t.Errorf("pull returned err: %v", err)
503+
t.Errorf("%s pull returned err: %v", test.name, err)
504504
}
505505
})
506506
}
@@ -524,7 +524,7 @@ func TestLinux_Secret_stream(t *testing.T) {
524524

525525
_runtime, err := docker.NewMock()
526526
if err != nil {
527-
t.Errorf("unable to create runtime engine: %v", err)
527+
t.Errorf("unable to create docker runtime engine: %v", err)
528528
}
529529

530530
// setup tests
@@ -535,7 +535,7 @@ func TestLinux_Secret_stream(t *testing.T) {
535535
container *pipeline.Container
536536
}{
537537
{
538-
name: "container step succeeds",
538+
name: "docker-container step succeeds",
539539
failure: false,
540540
logs: new(library.Log),
541541
container: &pipeline.Container{
@@ -549,7 +549,7 @@ func TestLinux_Secret_stream(t *testing.T) {
549549
},
550550
},
551551
{
552-
name: "container step fails because of invalid container id",
552+
name: "docker-container step fails because of invalid container id",
553553
failure: true,
554554
logs: new(library.Log),
555555
container: &pipeline.Container{
@@ -576,7 +576,7 @@ func TestLinux_Secret_stream(t *testing.T) {
576576
WithVelaClient(_client),
577577
)
578578
if err != nil {
579-
t.Errorf("unable to create executor engine: %v", err)
579+
t.Errorf("unable to create %s executor engine: %v", test.name, err)
580580
}
581581

582582
// add init container info to client
@@ -586,14 +586,14 @@ func TestLinux_Secret_stream(t *testing.T) {
586586

587587
if test.failure {
588588
if err == nil {
589-
t.Errorf("stream should have returned err")
589+
t.Errorf("%s stream should have returned err", test.name)
590590
}
591591

592592
return // continue to next test
593593
}
594594

595595
if err != nil {
596-
t.Errorf("stream returned err: %v", err)
596+
t.Errorf("%s stream returned err: %v", test.name, err)
597597
}
598598
})
599599
}

0 commit comments

Comments
 (0)