From 6feced2eaa94e80f1659fdce1075dddb3369a521 Mon Sep 17 00:00:00 2001 From: Jacob Floyd Date: Thu, 27 Oct 2022 22:20:56 -0500 Subject: [PATCH] refactor(executor tests): cleanup test names and errors Add runtime (docker) to all executor/linux test names (where relevant). Include test name in test error messages. Co-authored-by: Jordan Brockopp Co-authored-by: Jordan Sussman --- executor/linux/build_test.go | 150 ++++++++++++++++----------------- executor/linux/linux_test.go | 2 +- executor/linux/opts_test.go | 2 +- executor/linux/secret_test.go | 78 ++++++++--------- executor/linux/service_test.go | 68 +++++++-------- executor/linux/stage_test.go | 54 ++++++------ executor/linux/step_test.go | 78 ++++++++--------- 7 files changed, 216 insertions(+), 216 deletions(-) diff --git a/executor/linux/build_test.go b/executor/linux/build_test.go index 5422a9516..334a34b6e 100644 --- a/executor/linux/build_test.go +++ b/executor/linux/build_test.go @@ -46,7 +46,7 @@ func TestLinux_CreateBuild(t *testing.T) { _runtime, err := docker.NewMock() if err != nil { - t.Errorf("unable to create runtime engine: %v", err) + t.Errorf("unable to create docker runtime engine: %v", err) } tests := []struct { @@ -56,31 +56,31 @@ func TestLinux_CreateBuild(t *testing.T) { pipeline string }{ { - name: "basic secrets pipeline", + name: "docker-basic secrets pipeline", failure: false, build: _build, pipeline: "testdata/build/secrets/basic.yml", }, { - name: "basic services pipeline", + name: "docker-basic services pipeline", failure: false, build: _build, pipeline: "testdata/build/services/basic.yml", }, { - name: "basic steps pipeline", + name: "docker-basic steps pipeline", failure: false, build: _build, pipeline: "testdata/build/steps/basic.yml", }, { - name: "basic stages pipeline", + name: "docker-basic stages pipeline", failure: false, build: _build, pipeline: "testdata/build/stages/basic.yml", }, { - name: "steps pipeline with empty build", + name: "docker-steps pipeline with empty build", failure: true, build: new(library.Build), pipeline: "testdata/build/steps/basic.yml", @@ -98,7 +98,7 @@ func TestLinux_CreateBuild(t *testing.T) { WithUser(_user). Compile(test.pipeline) if err != nil { - t.Errorf("unable to compile pipeline %s: %v", test.pipeline, err) + t.Errorf("unable to compile %s pipeline %s: %v", test.name, test.pipeline, err) } _engine, err := New( @@ -110,21 +110,21 @@ func TestLinux_CreateBuild(t *testing.T) { WithVelaClient(_client), ) if err != nil { - t.Errorf("unable to create executor engine: %v", err) + t.Errorf("unable to create %s executor engine: %v", test.name, err) } err = _engine.CreateBuild(context.Background()) if test.failure { if err == nil { - t.Errorf("CreateBuild should have returned err") + t.Errorf("%s CreateBuild should have returned err", test.name) } return // continue to next test } if err != nil { - t.Errorf("CreateBuild returned err: %v", err) + t.Errorf("%s CreateBuild returned err: %v", test.name, err) } }) } @@ -150,7 +150,7 @@ func TestLinux_PlanBuild(t *testing.T) { _runtime, err := docker.NewMock() if err != nil { - t.Errorf("unable to create runtime engine: %v", err) + t.Errorf("unable to create docker runtime engine: %v", err) } tests := []struct { @@ -159,22 +159,22 @@ func TestLinux_PlanBuild(t *testing.T) { pipeline string }{ { - name: "basic secrets pipeline", + name: "docker-basic secrets pipeline", failure: false, pipeline: "testdata/build/secrets/basic.yml", }, { - name: "basic services pipeline", + name: "docker-basic services pipeline", failure: false, pipeline: "testdata/build/services/basic.yml", }, { - name: "basic steps pipeline", + name: "docker-basic steps pipeline", failure: false, pipeline: "testdata/build/steps/basic.yml", }, { - name: "basic stages pipeline", + name: "docker-basic stages pipeline", failure: false, pipeline: "testdata/build/stages/basic.yml", }, @@ -191,7 +191,7 @@ func TestLinux_PlanBuild(t *testing.T) { WithUser(_user). Compile(test.pipeline) if err != nil { - t.Errorf("unable to compile pipeline %s: %v", test.pipeline, err) + t.Errorf("unable to compile %s pipeline %s: %v", test.name, test.pipeline, err) } _engine, err := New( @@ -203,27 +203,27 @@ func TestLinux_PlanBuild(t *testing.T) { WithVelaClient(_client), ) if err != nil { - t.Errorf("unable to create executor engine: %v", err) + t.Errorf("unable to create %s executor engine: %v", test.name, err) } // run create to init steps to be created properly err = _engine.CreateBuild(context.Background()) if err != nil { - t.Errorf("unable to create build: %v", err) + t.Errorf("%s unable to create build: %v", test.name, err) } err = _engine.PlanBuild(context.Background()) if test.failure { if err == nil { - t.Errorf("PlanBuild should have returned err") + t.Errorf("%s PlanBuild should have returned err", test.name) } return // continue to next test } if err != nil { - t.Errorf("PlanBuild returned err: %v", err) + t.Errorf("%s PlanBuild returned err: %v", test.name, err) } }) } @@ -249,7 +249,7 @@ func TestLinux_AssembleBuild(t *testing.T) { _runtime, err := docker.NewMock() if err != nil { - t.Errorf("unable to create runtime engine: %v", err) + t.Errorf("unable to create docker runtime engine: %v", err) } streamRequests, done := message.MockStreamRequestsWithCancel(context.Background()) @@ -261,62 +261,62 @@ func TestLinux_AssembleBuild(t *testing.T) { pipeline string }{ { - name: "basic secrets pipeline", + name: "docker-basic secrets pipeline", failure: false, pipeline: "testdata/build/secrets/basic.yml", }, { - name: "secrets pipeline with image not found", + name: "docker-secrets pipeline with image not found", failure: true, pipeline: "testdata/build/secrets/img_notfound.yml", }, { - name: "secrets pipeline with ignoring image not found", + name: "docker-secrets pipeline with ignoring image not found", failure: true, pipeline: "testdata/build/secrets/img_ignorenotfound.yml", }, { - name: "basic services pipeline", + name: "docker-basic services pipeline", failure: false, pipeline: "testdata/build/services/basic.yml", }, { - name: "services pipeline with image not found", + name: "docker-services pipeline with image not found", failure: true, pipeline: "testdata/build/services/img_notfound.yml", }, { - name: "services pipeline with ignoring image not found", + name: "docker-services pipeline with ignoring image not found", failure: true, pipeline: "testdata/build/services/img_ignorenotfound.yml", }, { - name: "basic steps pipeline", + name: "docker-basic steps pipeline", failure: false, pipeline: "testdata/build/steps/basic.yml", }, { - name: "steps pipeline with image not found", + name: "docker-steps pipeline with image not found", failure: true, pipeline: "testdata/build/steps/img_notfound.yml", }, { - name: "steps pipeline with ignoring image not found", + name: "docker-steps pipeline with ignoring image not found", failure: true, pipeline: "testdata/build/steps/img_ignorenotfound.yml", }, { - name: "basic stages pipeline", + name: "docker-basic stages pipeline", failure: false, pipeline: "testdata/build/stages/basic.yml", }, { - name: "stages pipeline with image not found", + name: "docker-stages pipeline with image not found", failure: true, pipeline: "testdata/build/stages/img_notfound.yml", }, { - name: "stages pipeline with ignoring image not found", + name: "docker-stages pipeline with ignoring image not found", failure: true, pipeline: "testdata/build/stages/img_ignorenotfound.yml", }, @@ -333,7 +333,7 @@ func TestLinux_AssembleBuild(t *testing.T) { WithUser(_user). Compile(test.pipeline) if err != nil { - t.Errorf("unable to compile pipeline %s: %v", test.pipeline, err) + t.Errorf("unable to compile %s pipeline %s: %v", test.name, test.pipeline, err) } _engine, err := New( @@ -346,7 +346,7 @@ func TestLinux_AssembleBuild(t *testing.T) { withStreamRequests(streamRequests), ) if err != nil { - t.Errorf("unable to create executor engine: %v", err) + t.Errorf("unable to create %s executor engine: %v", test.name, err) } // run create to init steps to be created properly @@ -359,14 +359,14 @@ func TestLinux_AssembleBuild(t *testing.T) { if test.failure { if err == nil { - t.Errorf("AssembleBuild should have returned err") + t.Errorf("%s AssembleBuild should have returned err", test.name) } return // continue to next test } if err != nil { - t.Errorf("AssembleBuild returned err: %v", err) + t.Errorf("%s AssembleBuild returned err: %v", test.name, err) } }) } @@ -392,7 +392,7 @@ func TestLinux_ExecBuild(t *testing.T) { _runtime, err := docker.NewMock() if err != nil { - t.Errorf("unable to create runtime engine: %v", err) + t.Errorf("unable to create docker runtime engine: %v", err) } streamRequests, done := message.MockStreamRequestsWithCancel(context.Background()) @@ -404,32 +404,32 @@ func TestLinux_ExecBuild(t *testing.T) { pipeline string }{ { - name: "basic services pipeline", + name: "docker-basic services pipeline", failure: false, pipeline: "testdata/build/services/basic.yml", }, { - name: "services pipeline with image not found", + name: "docker-services pipeline with image not found", failure: true, pipeline: "testdata/build/services/img_notfound.yml", }, { - name: "basic steps pipeline", + name: "docker-basic steps pipeline", failure: false, pipeline: "testdata/build/steps/basic.yml", }, { - name: "steps pipeline with image not found", + name: "docker-steps pipeline with image not found", failure: true, pipeline: "testdata/build/steps/img_notfound.yml", }, { - name: "basic stages pipeline", + name: "docker-basic stages pipeline", failure: false, pipeline: "testdata/build/stages/basic.yml", }, { - name: "stages pipeline with image not found", + name: "docker-stages pipeline with image not found", failure: true, pipeline: "testdata/build/stages/img_notfound.yml", }, @@ -446,7 +446,7 @@ func TestLinux_ExecBuild(t *testing.T) { WithUser(_user). Compile(test.pipeline) if err != nil { - t.Errorf("unable to compile pipeline %s: %v", test.pipeline, err) + t.Errorf("unable to compile %s pipeline %s: %v", test.name, test.pipeline, err) } _engine, err := New( @@ -459,7 +459,7 @@ func TestLinux_ExecBuild(t *testing.T) { withStreamRequests(streamRequests), ) if err != nil { - t.Errorf("unable to create executor engine: %v", err) + t.Errorf("unable to create %s executor engine: %v", test.name, err) } // run create to init steps to be created properly @@ -484,7 +484,7 @@ func TestLinux_ExecBuild(t *testing.T) { // in a privileged fashion. err = _runtime.CreateVolume(context.Background(), _pipeline) if err != nil { - t.Errorf("unable to create runtime volume: %v", err) + t.Errorf("unable to create docker runtime volume: %v", err) } // TODO: hack - remove this @@ -506,14 +506,14 @@ func TestLinux_ExecBuild(t *testing.T) { if test.failure { if err == nil { - t.Errorf("ExecBuild for %s should have returned err", test.pipeline) + t.Errorf("%s ExecBuild for %s should have returned err", test.name, test.pipeline) } return // continue to next test } if err != nil { - t.Errorf("ExecBuild for %s returned err: %v", test.pipeline, err) + t.Errorf("%s ExecBuild for %s returned err: %v", test.name, test.pipeline, err) } }) } @@ -539,7 +539,7 @@ func TestLinux_StreamBuild(t *testing.T) { _runtime, err := docker.NewMock() if err != nil { - t.Errorf("unable to create runtime engine: %v", err) + t.Errorf("unable to create docker runtime engine: %v", err) } type planFuncType = func(context.Context, *pipeline.Container) error @@ -559,7 +559,7 @@ func TestLinux_StreamBuild(t *testing.T) { planFunc func(*client) planFuncType }{ { - name: "basic services pipeline", + name: "docker-basic services pipeline", failure: false, pipeline: "testdata/build/services/basic.yml", messageKey: "service", @@ -582,7 +582,7 @@ func TestLinux_StreamBuild(t *testing.T) { }, }, { - name: "basic services pipeline with StreamService failure", + name: "docker-basic services pipeline with StreamService failure", failure: false, pipeline: "testdata/build/services/basic.yml", messageKey: "service", @@ -606,7 +606,7 @@ func TestLinux_StreamBuild(t *testing.T) { }, }, { - name: "basic steps pipeline", + name: "docker-basic steps pipeline", failure: false, pipeline: "testdata/build/steps/basic.yml", messageKey: "step", @@ -627,7 +627,7 @@ func TestLinux_StreamBuild(t *testing.T) { }, }, { - name: "basic steps pipeline with StreamStep failure", + name: "docker-basic steps pipeline with StreamStep failure", failure: false, pipeline: "testdata/build/steps/basic.yml", messageKey: "step", @@ -649,7 +649,7 @@ func TestLinux_StreamBuild(t *testing.T) { }, }, { - name: "basic stages pipeline", + name: "docker-basic stages pipeline", failure: false, pipeline: "testdata/build/stages/basic.yml", messageKey: "step", @@ -670,7 +670,7 @@ func TestLinux_StreamBuild(t *testing.T) { }, }, { - name: "basic secrets pipeline", + name: "docker-basic secrets pipeline", failure: false, pipeline: "testdata/build/secrets/basic.yml", messageKey: "secret", @@ -707,7 +707,7 @@ func TestLinux_StreamBuild(t *testing.T) { WithUser(_user). Compile(test.pipeline) if err != nil { - t.Errorf("unable to compile pipeline %s: %v", test.pipeline, err) + t.Errorf("unable to compile %s pipeline %s: %v", test.name, test.pipeline, err) } _engine, err := New( @@ -720,13 +720,13 @@ func TestLinux_StreamBuild(t *testing.T) { withStreamRequests(streamRequests), ) if err != nil { - t.Errorf("unable to create executor engine: %v", err) + t.Errorf("unable to create %s executor engine: %v", test.name, err) } // run create to init steps to be created properly err = _engine.CreateBuild(buildCtx) if err != nil { - t.Errorf("unable to create build: %v", err) + t.Errorf("%s unable to create build: %v", test.name, err) } // simulate ExecBuild() which runs concurrently with StreamBuild() @@ -753,14 +753,14 @@ func TestLinux_StreamBuild(t *testing.T) { if test.failure { if err == nil { - t.Errorf("StreamBuild for %s should have returned err", test.pipeline) + t.Errorf("%s StreamBuild for %s should have returned err", test.name, test.pipeline) } return // continue to next test } if err != nil { - t.Errorf("StreamBuild for %s returned err: %v", test.pipeline, err) + t.Errorf("%s StreamBuild for %s returned err: %v", test.name, test.pipeline, err) } }) } @@ -786,7 +786,7 @@ func TestLinux_DestroyBuild(t *testing.T) { _runtime, err := docker.NewMock() if err != nil { - t.Errorf("unable to create runtime engine: %v", err) + t.Errorf("unable to create docker runtime engine: %v", err) } tests := []struct { @@ -795,42 +795,42 @@ func TestLinux_DestroyBuild(t *testing.T) { pipeline string }{ { - name: "basic secrets pipeline", + name: "docker-basic secrets pipeline", failure: false, pipeline: "testdata/build/secrets/basic.yml", }, { - name: "secrets pipeline with name not found", + name: "docker-secrets pipeline with name not found", failure: false, pipeline: "testdata/build/secrets/name_notfound.yml", }, { - name: "basic services pipeline", + name: "docker-basic services pipeline", failure: false, pipeline: "testdata/build/services/basic.yml", }, { - name: "services pipeline with name not found", + name: "docker-services pipeline with name not found", failure: false, pipeline: "testdata/build/services/name_notfound.yml", }, { - name: "basic steps pipeline", + name: "docker-basic steps pipeline", failure: false, pipeline: "testdata/build/steps/basic.yml", }, { - name: "steps pipeline with name not found", + name: "docker-steps pipeline with name not found", failure: false, pipeline: "testdata/build/steps/name_notfound.yml", }, { - name: "basic stages pipeline", + name: "docker-basic stages pipeline", failure: false, pipeline: "testdata/build/stages/basic.yml", }, { - name: "stages pipeline with name not found", + name: "docker-stages pipeline with name not found", failure: false, pipeline: "testdata/build/stages/name_notfound.yml", }, @@ -847,7 +847,7 @@ func TestLinux_DestroyBuild(t *testing.T) { WithUser(_user). Compile(test.pipeline) if err != nil { - t.Errorf("unable to compile pipeline %s: %v", test.pipeline, err) + t.Errorf("unable to compile %s pipeline %s: %v", test.name, test.pipeline, err) } _engine, err := New( @@ -859,27 +859,27 @@ func TestLinux_DestroyBuild(t *testing.T) { WithVelaClient(_client), ) if err != nil { - t.Errorf("unable to create executor engine: %v", err) + t.Errorf("unable to create %s executor engine: %v", test.name, err) } // run create to init steps to be created properly err = _engine.CreateBuild(context.Background()) if err != nil { - t.Errorf("unable to create build: %v", err) + t.Errorf("%s unable to create build: %v", test.name, err) } err = _engine.DestroyBuild(context.Background()) if test.failure { if err == nil { - t.Errorf("DestroyBuild should have returned err") + t.Errorf("%s DestroyBuild should have returned err", test.name) } return // continue to next test } if err != nil { - t.Errorf("DestroyBuild returned err: %v", err) + t.Errorf("%s DestroyBuild returned err: %v", test.name, err) } }) } diff --git a/executor/linux/linux_test.go b/executor/linux/linux_test.go index 46abe49b4..1daf2c582 100644 --- a/executor/linux/linux_test.go +++ b/executor/linux/linux_test.go @@ -239,7 +239,7 @@ func testUser() *library.User { } } -// testUser is a test helper function to create a metadata +// testMetadata is a test helper function to create a metadata // type with all fields set to a fake value. func testMetadata() *types.Metadata { return &types.Metadata{ diff --git a/executor/linux/opts_test.go b/executor/linux/opts_test.go index ac49f04b2..5c26f44d5 100644 --- a/executor/linux/opts_test.go +++ b/executor/linux/opts_test.go @@ -346,7 +346,7 @@ func TestLinux_Opt_WithRuntime(t *testing.T) { // setup types _runtime, err := docker.NewMock() if err != nil { - t.Errorf("unable to create runtime engine: %v", err) + t.Errorf("unable to create docker runtime engine: %v", err) } // setup tests diff --git a/executor/linux/secret_test.go b/executor/linux/secret_test.go index ac9bfd066..a9cb94ca7 100644 --- a/executor/linux/secret_test.go +++ b/executor/linux/secret_test.go @@ -47,7 +47,7 @@ func TestLinux_Secret_create(t *testing.T) { _runtime, err := docker.NewMock() if err != nil { - t.Errorf("unable to create runtime engine: %v", err) + t.Errorf("unable to create docker runtime engine: %v", err) } // setup tests @@ -57,7 +57,7 @@ func TestLinux_Secret_create(t *testing.T) { container *pipeline.Container }{ { - name: "good image tag", + name: "docker-good image tag", failure: false, container: &pipeline.Container{ ID: "secret_github_octocat_1_vault", @@ -70,7 +70,7 @@ func TestLinux_Secret_create(t *testing.T) { }, }, { - name: "notfound image tag", + name: "docker-notfound image tag", failure: true, container: &pipeline.Container{ ID: "secret_github_octocat_1_vault", @@ -96,21 +96,21 @@ func TestLinux_Secret_create(t *testing.T) { WithVelaClient(_client), ) if err != nil { - t.Errorf("unable to create executor engine: %v", err) + t.Errorf("unable to create %s executor engine: %v", test.name, err) } err = _engine.secret.create(context.Background(), test.container) if test.failure { if err == nil { - t.Errorf("create should have returned err") + t.Errorf("%s create should have returned err", test.name) } return // continue to next test } if err != nil { - t.Errorf("create returned err: %v", err) + t.Errorf("%s create returned err: %v", test.name, err) } }) } @@ -134,7 +134,7 @@ func TestLinux_Secret_delete(t *testing.T) { _runtime, err := docker.NewMock() if err != nil { - t.Errorf("unable to create runtime engine: %v", err) + t.Errorf("unable to create docker runtime engine: %v", err) } _step := new(library.Step) @@ -150,7 +150,7 @@ func TestLinux_Secret_delete(t *testing.T) { step *library.Step }{ { - name: "running container-empty step", + name: "docker-running container-empty step", failure: false, container: &pipeline.Container{ ID: "secret_github_octocat_1_vault", @@ -164,7 +164,7 @@ func TestLinux_Secret_delete(t *testing.T) { step: new(library.Step), }, { - name: "running container-pending step", + name: "docker-running container-pending step", failure: false, container: &pipeline.Container{ ID: "secret_github_octocat_1_vault", @@ -178,7 +178,7 @@ func TestLinux_Secret_delete(t *testing.T) { step: _step, }, { - name: "inspecting container failure due to invalid container id", + name: "docker-inspecting container failure due to invalid container id", failure: true, container: &pipeline.Container{ ID: "secret_github_octocat_1_notfound", @@ -192,7 +192,7 @@ func TestLinux_Secret_delete(t *testing.T) { step: new(library.Step), }, { - name: "removing container failure", + name: "docker-removing container failure", failure: true, container: &pipeline.Container{ ID: "secret_github_octocat_1_ignorenotfound", @@ -219,7 +219,7 @@ func TestLinux_Secret_delete(t *testing.T) { WithVelaClient(_client), ) if err != nil { - t.Errorf("unable to create executor engine: %v", err) + t.Errorf("unable to create %s executor engine: %v", test.name, err) } _ = _engine.CreateBuild(context.Background()) @@ -230,14 +230,14 @@ func TestLinux_Secret_delete(t *testing.T) { if test.failure { if err == nil { - t.Errorf("destroy should have returned err") + t.Errorf("%s destroy should have returned err", test.name) } return // continue to next test } if err != nil { - t.Errorf("destroy returned err: %v", err) + t.Errorf("%s destroy returned err: %v", test.name, err) } }) } @@ -263,7 +263,7 @@ func TestLinux_Secret_exec(t *testing.T) { _runtime, err := docker.NewMock() if err != nil { - t.Errorf("unable to create runtime engine: %v", err) + t.Errorf("unable to create docker runtime engine: %v", err) } streamRequests, done := message.MockStreamRequestsWithCancel(context.Background()) @@ -276,12 +276,12 @@ func TestLinux_Secret_exec(t *testing.T) { pipeline string }{ { - name: "basic secrets pipeline", + name: "docker-basic secrets pipeline", failure: false, pipeline: "testdata/build/secrets/basic.yml", }, { - name: "pipeline with secret name not found", + name: "docker-pipeline with secret name not found", failure: true, pipeline: "testdata/build/secrets/name_notfound.yml", }, @@ -313,7 +313,7 @@ func TestLinux_Secret_exec(t *testing.T) { withStreamRequests(streamRequests), ) if err != nil { - t.Errorf("unable to create executor engine: %v", err) + t.Errorf("unable to create %s executor engine: %v", test.name, err) } _engine.build.SetStatus(constants.StatusSuccess) @@ -325,14 +325,14 @@ func TestLinux_Secret_exec(t *testing.T) { if test.failure { if err == nil { - t.Errorf("exec should have returned err") + t.Errorf("%s exec should have returned err", test.name) } return // continue to next test } if err != nil { - t.Errorf("exec returned err: %v", err) + t.Errorf("%s exec returned err: %v", test.name, err) } }) } @@ -355,7 +355,7 @@ func TestLinux_Secret_pull(t *testing.T) { _runtime, err := docker.NewMock() if err != nil { - t.Errorf("unable to create runtime engine: %v", err) + t.Errorf("unable to create docker runtime engine: %v", err) } // setup tests @@ -365,7 +365,7 @@ func TestLinux_Secret_pull(t *testing.T) { secret *pipeline.Secret }{ { - name: "success with org secret", + name: "docker-success with org secret", failure: false, secret: &pipeline.Secret{ Name: "foo", @@ -377,7 +377,7 @@ func TestLinux_Secret_pull(t *testing.T) { }, }, { - name: "failure with invalid org secret", + name: "docker-failure with invalid org secret", failure: true, secret: &pipeline.Secret{ Name: "foo", @@ -389,7 +389,7 @@ func TestLinux_Secret_pull(t *testing.T) { }, }, { - name: "failure with org secret key not found", + name: "docker-failure with org secret key not found", failure: true, secret: &pipeline.Secret{ Name: "foo", @@ -401,7 +401,7 @@ func TestLinux_Secret_pull(t *testing.T) { }, }, { - name: "success with repo secret", + name: "docker-success with repo secret", failure: false, secret: &pipeline.Secret{ Name: "foo", @@ -413,7 +413,7 @@ func TestLinux_Secret_pull(t *testing.T) { }, }, { - name: "failure with invalid repo secret", + name: "docker-failure with invalid repo secret", failure: true, secret: &pipeline.Secret{ Name: "foo", @@ -425,7 +425,7 @@ func TestLinux_Secret_pull(t *testing.T) { }, }, { - name: "failure with repo secret key not found", + name: "docker-failure with repo secret key not found", failure: true, secret: &pipeline.Secret{ Name: "foo", @@ -437,7 +437,7 @@ func TestLinux_Secret_pull(t *testing.T) { }, }, { - name: "success with shared secret", + name: "docker-success with shared secret", failure: false, secret: &pipeline.Secret{ Name: "foo", @@ -449,7 +449,7 @@ func TestLinux_Secret_pull(t *testing.T) { }, }, { - name: "failure with shared secret key not found", + name: "docker-failure with shared secret key not found", failure: true, secret: &pipeline.Secret{ Name: "foo", @@ -461,7 +461,7 @@ func TestLinux_Secret_pull(t *testing.T) { }, }, { - name: "failure with invalid type", + name: "docker-failure with invalid type", failure: true, secret: &pipeline.Secret{ Name: "foo", @@ -486,21 +486,21 @@ func TestLinux_Secret_pull(t *testing.T) { WithVelaClient(_client), ) if err != nil { - t.Errorf("unable to create executor engine: %v", err) + t.Errorf("unable to create %s executor engine: %v", test.name, err) } _, err = _engine.secret.pull(test.secret) if test.failure { if err == nil { - t.Errorf("pull should have returned err") + t.Errorf("%s pull should have returned err", test.name) } return // continue to next test } if err != nil { - t.Errorf("pull returned err: %v", err) + t.Errorf("%s pull returned err: %v", test.name, err) } }) } @@ -524,7 +524,7 @@ func TestLinux_Secret_stream(t *testing.T) { _runtime, err := docker.NewMock() if err != nil { - t.Errorf("unable to create runtime engine: %v", err) + t.Errorf("unable to create docker runtime engine: %v", err) } // setup tests @@ -535,7 +535,7 @@ func TestLinux_Secret_stream(t *testing.T) { container *pipeline.Container }{ { - name: "container step succeeds", + name: "docker-container step succeeds", failure: false, logs: new(library.Log), container: &pipeline.Container{ @@ -549,7 +549,7 @@ func TestLinux_Secret_stream(t *testing.T) { }, }, { - name: "container step fails because of invalid container id", + name: "docker-container step fails because of invalid container id", failure: true, logs: new(library.Log), container: &pipeline.Container{ @@ -576,7 +576,7 @@ func TestLinux_Secret_stream(t *testing.T) { WithVelaClient(_client), ) if err != nil { - t.Errorf("unable to create executor engine: %v", err) + t.Errorf("unable to create %s executor engine: %v", test.name, err) } // add init container info to client @@ -586,14 +586,14 @@ func TestLinux_Secret_stream(t *testing.T) { if test.failure { if err == nil { - t.Errorf("stream should have returned err") + t.Errorf("%s stream should have returned err", test.name) } return // continue to next test } if err != nil { - t.Errorf("stream returned err: %v", err) + t.Errorf("%s stream returned err: %v", test.name, err) } }) } diff --git a/executor/linux/service_test.go b/executor/linux/service_test.go index c95a488c2..6b2fbd6be 100644 --- a/executor/linux/service_test.go +++ b/executor/linux/service_test.go @@ -39,7 +39,7 @@ func TestLinux_CreateService(t *testing.T) { _runtime, err := docker.NewMock() if err != nil { - t.Errorf("unable to create runtime engine: %v", err) + t.Errorf("unable to create docker runtime engine: %v", err) } // setup tests @@ -49,7 +49,7 @@ func TestLinux_CreateService(t *testing.T) { container *pipeline.Container }{ { - name: "basic service container", + name: "docker-basic service container", failure: false, container: &pipeline.Container{ ID: "service_github_octocat_1_postgres", @@ -64,7 +64,7 @@ func TestLinux_CreateService(t *testing.T) { }, }, { - name: "service container with image not found", + name: "docker-service container with image not found", failure: true, container: &pipeline.Container{ ID: "service_github_octocat_1_postgres", @@ -79,7 +79,7 @@ func TestLinux_CreateService(t *testing.T) { }, }, { - name: "empty service container", + name: "docker-empty service container", failure: true, container: new(pipeline.Container), }, @@ -97,21 +97,21 @@ func TestLinux_CreateService(t *testing.T) { WithVelaClient(_client), ) if err != nil { - t.Errorf("unable to create executor engine: %v", err) + t.Errorf("unable to create %s executor engine: %v", test.name, err) } err = _engine.CreateService(context.Background(), test.container) if test.failure { if err == nil { - t.Errorf("CreateService should have returned err") + t.Errorf("%s CreateService should have returned err", test.name) } return // continue to next test } if err != nil { - t.Errorf("CreateService returned err: %v", err) + t.Errorf("%s CreateService returned err: %v", test.name, err) } }) } @@ -134,7 +134,7 @@ func TestLinux_PlanService(t *testing.T) { _runtime, err := docker.NewMock() if err != nil { - t.Errorf("unable to create runtime engine: %v", err) + t.Errorf("unable to create docker runtime engine: %v", err) } // setup tests @@ -144,7 +144,7 @@ func TestLinux_PlanService(t *testing.T) { container *pipeline.Container }{ { - name: "basic service container", + name: "docker-basic service container", failure: false, container: &pipeline.Container{ ID: "service_github_octocat_1_postgres", @@ -159,7 +159,7 @@ func TestLinux_PlanService(t *testing.T) { }, }, { - name: "service container with nil environment", + name: "docker-service container with nil environment", failure: true, container: &pipeline.Container{ ID: "service_github_octocat_1_postgres", @@ -174,7 +174,7 @@ func TestLinux_PlanService(t *testing.T) { }, }, { - name: "empty service container", + name: "docker-empty service container", failure: true, container: new(pipeline.Container), }, @@ -192,21 +192,21 @@ func TestLinux_PlanService(t *testing.T) { WithVelaClient(_client), ) if err != nil { - t.Errorf("unable to create executor engine: %v", err) + t.Errorf("unable to create %s executor engine: %v", test.name, err) } err = _engine.PlanService(context.Background(), test.container) if test.failure { if err == nil { - t.Errorf("PlanService should have returned err") + t.Errorf("%s PlanService should have returned err", test.name) } return // continue to next test } if err != nil { - t.Errorf("PlanService returned err: %v", err) + t.Errorf("%s PlanService returned err: %v", test.name, err) } }) } @@ -229,7 +229,7 @@ func TestLinux_ExecService(t *testing.T) { _runtime, err := docker.NewMock() if err != nil { - t.Errorf("unable to create runtime engine: %v", err) + t.Errorf("unable to create docker runtime engine: %v", err) } streamRequests, done := message.MockStreamRequestsWithCancel(context.Background()) @@ -242,7 +242,7 @@ func TestLinux_ExecService(t *testing.T) { container *pipeline.Container }{ { - name: "basic service container", + name: "docker-basic service container", failure: false, container: &pipeline.Container{ ID: "service_github_octocat_1_postgres", @@ -257,7 +257,7 @@ func TestLinux_ExecService(t *testing.T) { }, }, { - name: "service container with image not found", + name: "docker-service container with image not found", failure: true, container: &pipeline.Container{ ID: "service_github_octocat_1_postgres", @@ -272,7 +272,7 @@ func TestLinux_ExecService(t *testing.T) { }, }, { - name: "empty service container", + name: "docker-empty service container", failure: true, container: new(pipeline.Container), }, @@ -291,7 +291,7 @@ func TestLinux_ExecService(t *testing.T) { withStreamRequests(streamRequests), ) if err != nil { - t.Errorf("unable to create executor engine: %v", err) + t.Errorf("unable to create %s executor engine: %v", test.name, err) } if !test.container.Empty() { @@ -303,14 +303,14 @@ func TestLinux_ExecService(t *testing.T) { if test.failure { if err == nil { - t.Errorf("ExecService should have returned err") + t.Errorf("%s ExecService should have returned err", test.name) } return // continue to next test } if err != nil { - t.Errorf("ExecService returned err: %v", err) + t.Errorf("%s ExecService returned err: %v", test.name, err) } }) } @@ -333,7 +333,7 @@ func TestLinux_StreamService(t *testing.T) { _runtime, err := docker.NewMock() if err != nil { - t.Errorf("unable to create runtime engine: %v", err) + t.Errorf("unable to create docker runtime engine: %v", err) } // setup tests @@ -343,7 +343,7 @@ func TestLinux_StreamService(t *testing.T) { container *pipeline.Container }{ { - name: "basic service container", + name: "docker-basic service container", failure: false, container: &pipeline.Container{ ID: "service_github_octocat_1_postgres", @@ -358,7 +358,7 @@ func TestLinux_StreamService(t *testing.T) { }, }, { - name: "service container with name not found", + name: "docker-service container with name not found", failure: true, container: &pipeline.Container{ ID: "service_github_octocat_1_notfound", @@ -373,7 +373,7 @@ func TestLinux_StreamService(t *testing.T) { }, }, { - name: "empty service container", + name: "docker-empty service container", failure: true, container: new(pipeline.Container), }, @@ -391,7 +391,7 @@ func TestLinux_StreamService(t *testing.T) { WithVelaClient(_client), ) if err != nil { - t.Errorf("unable to create executor engine: %v", err) + t.Errorf("unable to create %s executor engine: %v", test.name, err) } if !test.container.Empty() { @@ -403,14 +403,14 @@ func TestLinux_StreamService(t *testing.T) { if test.failure { if err == nil { - t.Errorf("StreamService should have returned err") + t.Errorf("%s StreamService should have returned err", test.name) } return // continue to next test } if err != nil { - t.Errorf("StreamService returned err: %v", err) + t.Errorf("%s StreamService returned err: %v", test.name, err) } }) } @@ -433,7 +433,7 @@ func TestLinux_DestroyService(t *testing.T) { _runtime, err := docker.NewMock() if err != nil { - t.Errorf("unable to create runtime engine: %v", err) + t.Errorf("unable to create docker runtime engine: %v", err) } // setup tests @@ -443,7 +443,7 @@ func TestLinux_DestroyService(t *testing.T) { container *pipeline.Container }{ { - name: "basic service container", + name: "docker-basic service container", failure: false, container: &pipeline.Container{ ID: "service_github_octocat_1_postgres", @@ -458,7 +458,7 @@ func TestLinux_DestroyService(t *testing.T) { }, }, { - name: "service container with ignoring name not found", + name: "docker-service container with ignoring name not found", failure: true, container: &pipeline.Container{ ID: "service_github_octocat_1_ignorenotfound", @@ -486,21 +486,21 @@ func TestLinux_DestroyService(t *testing.T) { WithVelaClient(_client), ) if err != nil { - t.Errorf("unable to create executor engine: %v", err) + t.Errorf("unable to create %s executor engine: %v", test.name, err) } err = _engine.DestroyService(context.Background(), test.container) if test.failure { if err == nil { - t.Errorf("DestroyService should have returned err") + t.Errorf("%s DestroyService should have returned err", test.name) } return // continue to next test } if err != nil { - t.Errorf("DestroyService returned err: %v", err) + t.Errorf("%s DestroyService returned err: %v", test.name, err) } }) } diff --git a/executor/linux/stage_test.go b/executor/linux/stage_test.go index 2beeba805..c1d05fbec 100644 --- a/executor/linux/stage_test.go +++ b/executor/linux/stage_test.go @@ -58,7 +58,7 @@ func TestLinux_CreateStage(t *testing.T) { _runtime, err := docker.NewMock() if err != nil { - t.Errorf("unable to create runtime engine: %v", err) + t.Errorf("unable to create docker runtime engine: %v", err) } // setup tests @@ -68,7 +68,7 @@ func TestLinux_CreateStage(t *testing.T) { stage *pipeline.Stage }{ { - name: "basic stage", + name: "docker-basic stage", failure: false, stage: &pipeline.Stage{ Name: "echo", @@ -86,7 +86,7 @@ func TestLinux_CreateStage(t *testing.T) { }, }, { - name: "stage with step container with image not found", + name: "docker-stage with step container with image not found", failure: true, stage: &pipeline.Stage{ Name: "echo", @@ -104,7 +104,7 @@ func TestLinux_CreateStage(t *testing.T) { }, }, { - name: "empty stage", + name: "docker-empty stage", failure: true, stage: new(pipeline.Stage), }, @@ -122,14 +122,14 @@ func TestLinux_CreateStage(t *testing.T) { WithVelaClient(_client), ) if err != nil { - t.Errorf("unable to create executor engine: %v", err) + t.Errorf("unable to create %s executor engine: %v", test.name, err) } if len(test.stage.Name) > 0 { // run create to init steps to be created properly err = _engine.CreateBuild(context.Background()) if err != nil { - t.Errorf("unable to create build: %v", err) + t.Errorf("unable to create %s build: %v", test.name, err) } } @@ -137,14 +137,14 @@ func TestLinux_CreateStage(t *testing.T) { if test.failure { if err == nil { - t.Errorf("CreateStage should have returned err") + t.Errorf("%s CreateStage should have returned err", test.name) } return // continue to next test } if err != nil { - t.Errorf("CreateStage returned err: %v", err) + t.Errorf("%s CreateStage returned err: %v", test.name, err) } }) } @@ -167,7 +167,7 @@ func TestLinux_PlanStage(t *testing.T) { _runtime, err := docker.NewMock() if err != nil { - t.Errorf("unable to create runtime engine: %v", err) + t.Errorf("unable to create docker runtime engine: %v", err) } testMap := new(sync.Map) @@ -192,7 +192,7 @@ func TestLinux_PlanStage(t *testing.T) { stageMap *sync.Map }{ { - name: "basic stage", + name: "docker-basic stage", failure: false, stage: &pipeline.Stage{ Name: "echo", @@ -211,7 +211,7 @@ func TestLinux_PlanStage(t *testing.T) { stageMap: new(sync.Map), }, { - name: "basic stage with nil stage map", + name: "docker-basic stage with nil stage map", failure: false, stage: &pipeline.Stage{ Name: "echo", @@ -231,7 +231,7 @@ func TestLinux_PlanStage(t *testing.T) { stageMap: testMap, }, { - name: "basic stage with error stage map", + name: "docker-basic stage with error stage map", failure: true, stage: &pipeline.Stage{ Name: "echo", @@ -264,21 +264,21 @@ func TestLinux_PlanStage(t *testing.T) { WithVelaClient(_client), ) if err != nil { - t.Errorf("unable to create executor engine: %v", err) + t.Errorf("unable to create %s executor engine: %v", test.name, err) } err = _engine.PlanStage(context.Background(), test.stage, test.stageMap) if test.failure { if err == nil { - t.Errorf("PlanStage should have returned err") + t.Errorf("%s PlanStage should have returned err", test.name) } return // continue to next test } if err != nil { - t.Errorf("PlanStage returned err: %v", err) + t.Errorf("%s PlanStage returned err: %v", test.name, err) } }) } @@ -301,7 +301,7 @@ func TestLinux_ExecStage(t *testing.T) { _runtime, err := docker.NewMock() if err != nil { - t.Errorf("unable to create runtime engine: %v", err) + t.Errorf("unable to create docker runtime engine: %v", err) } streamRequests, done := message.MockStreamRequestsWithCancel(context.Background()) @@ -314,7 +314,7 @@ func TestLinux_ExecStage(t *testing.T) { stage *pipeline.Stage }{ { - name: "basic stage", + name: "docker-basic stage", failure: false, stage: &pipeline.Stage{ Name: "echo", @@ -332,7 +332,7 @@ func TestLinux_ExecStage(t *testing.T) { }, }, { - name: "stage with step container with image not found", + name: "docker-stage with step container with image not found", failure: true, stage: &pipeline.Stage{ Name: "echo", @@ -350,7 +350,7 @@ func TestLinux_ExecStage(t *testing.T) { }, }, { - name: "stage with step container with bad number", + name: "docker-stage with step container with bad number", failure: true, stage: &pipeline.Stage{ Name: "echo", @@ -385,21 +385,21 @@ func TestLinux_ExecStage(t *testing.T) { withStreamRequests(streamRequests), ) if err != nil { - t.Errorf("unable to create executor engine: %v", err) + t.Errorf("unable to create %s executor engine: %v", test.name, err) } err = _engine.ExecStage(context.Background(), test.stage, stageMap) if test.failure { if err == nil { - t.Errorf("ExecStage should have returned err") + t.Errorf("%s ExecStage should have returned err", test.name) } return // continue to next test } if err != nil { - t.Errorf("ExecStage returned err: %v", err) + t.Errorf("%s ExecStage returned err: %v", test.name, err) } }) } @@ -422,7 +422,7 @@ func TestLinux_DestroyStage(t *testing.T) { _runtime, err := docker.NewMock() if err != nil { - t.Errorf("unable to create runtime engine: %v", err) + t.Errorf("unable to create docker runtime engine: %v", err) } // setup tests @@ -432,7 +432,7 @@ func TestLinux_DestroyStage(t *testing.T) { stage *pipeline.Stage }{ { - name: "basic stage", + name: "docker-basic stage", failure: false, stage: &pipeline.Stage{ Name: "echo", @@ -463,21 +463,21 @@ func TestLinux_DestroyStage(t *testing.T) { WithVelaClient(_client), ) if err != nil { - t.Errorf("unable to create executor engine: %v", err) + t.Errorf("unable to create %s executor engine: %v", test.name, err) } err = _engine.DestroyStage(context.Background(), test.stage) if test.failure { if err == nil { - t.Errorf("DestroyStage should have returned err") + t.Errorf("%s DestroyStage should have returned err", test.name) } return // continue to next test } if err != nil { - t.Errorf("DestroyStage returned err: %v", err) + t.Errorf("%s DestroyStage returned err: %v", test.name, err) } }) } diff --git a/executor/linux/step_test.go b/executor/linux/step_test.go index 7c283acc4..b0f4a4007 100644 --- a/executor/linux/step_test.go +++ b/executor/linux/step_test.go @@ -41,7 +41,7 @@ func TestLinux_CreateStep(t *testing.T) { _runtime, err := docker.NewMock() if err != nil { - t.Errorf("unable to create runtime engine: %v", err) + t.Errorf("unable to create docker runtime engine: %v", err) } // setup tests @@ -51,7 +51,7 @@ func TestLinux_CreateStep(t *testing.T) { container *pipeline.Container }{ { - name: "init step container", + name: "docker-init step container", failure: false, container: &pipeline.Container{ ID: "step_github_octocat_1_init", @@ -64,7 +64,7 @@ func TestLinux_CreateStep(t *testing.T) { }, }, { - name: "basic step container", + name: "docker-basic step container", failure: false, container: &pipeline.Container{ ID: "step_github_octocat_1_echo", @@ -77,7 +77,7 @@ func TestLinux_CreateStep(t *testing.T) { }, }, { - name: "step container with image not found", + name: "docker-step container with image not found", failure: true, container: &pipeline.Container{ ID: "step_github_octocat_1_echo", @@ -90,7 +90,7 @@ func TestLinux_CreateStep(t *testing.T) { }, }, { - name: "empty step container", + name: "docker-empty step container", failure: true, container: new(pipeline.Container), }, @@ -108,21 +108,21 @@ func TestLinux_CreateStep(t *testing.T) { WithVelaClient(_client), ) if err != nil { - t.Errorf("unable to create executor engine: %v", err) + t.Errorf("unable to create %s executor engine: %v", test.name, err) } err = _engine.CreateStep(context.Background(), test.container) if test.failure { if err == nil { - t.Errorf("CreateStep should have returned err") + t.Errorf("%s CreateStep should have returned err", test.name) } return // continue to next test } if err != nil { - t.Errorf("CreateStep returned err: %v", err) + t.Errorf("%s CreateStep returned err: %v", test.name, err) } }) } @@ -145,7 +145,7 @@ func TestLinux_PlanStep(t *testing.T) { _runtime, err := docker.NewMock() if err != nil { - t.Errorf("unable to create runtime engine: %v", err) + t.Errorf("unable to create docker runtime engine: %v", err) } // setup tests @@ -155,7 +155,7 @@ func TestLinux_PlanStep(t *testing.T) { container *pipeline.Container }{ { - name: "basic step container", + name: "docker-basic step container", failure: false, container: &pipeline.Container{ ID: "step_github_octocat_1_echo", @@ -168,7 +168,7 @@ func TestLinux_PlanStep(t *testing.T) { }, }, { - name: "step container with nil environment", + name: "docker-step container with nil environment", failure: true, container: &pipeline.Container{ ID: "step_github_octocat_1_echo", @@ -181,7 +181,7 @@ func TestLinux_PlanStep(t *testing.T) { }, }, { - name: "empty step container", + name: "docker-empty step container", failure: true, container: new(pipeline.Container), }, @@ -199,21 +199,21 @@ func TestLinux_PlanStep(t *testing.T) { WithVelaClient(_client), ) if err != nil { - t.Errorf("unable to create executor engine: %v", err) + t.Errorf("unable to create %s executor engine: %v", test.name, err) } err = _engine.PlanStep(context.Background(), test.container) if test.failure { if err == nil { - t.Errorf("PlanStep should have returned err") + t.Errorf("%s PlanStep should have returned err", test.name) } return // continue to next test } if err != nil { - t.Errorf("PlanStep returned err: %v", err) + t.Errorf("%s PlanStep returned err: %v", test.name, err) } }) } @@ -236,7 +236,7 @@ func TestLinux_ExecStep(t *testing.T) { _runtime, err := docker.NewMock() if err != nil { - t.Errorf("unable to create runtime engine: %v", err) + t.Errorf("unable to create docker runtime engine: %v", err) } streamRequests, done := message.MockStreamRequestsWithCancel(context.Background()) @@ -249,7 +249,7 @@ func TestLinux_ExecStep(t *testing.T) { container *pipeline.Container }{ { - name: "init step container", + name: "docker-init step container", failure: false, container: &pipeline.Container{ ID: "step_github_octocat_1_init", @@ -262,7 +262,7 @@ func TestLinux_ExecStep(t *testing.T) { }, }, { - name: "basic step container", + name: "docker-basic step container", failure: false, container: &pipeline.Container{ ID: "step_github_octocat_1_echo", @@ -275,7 +275,7 @@ func TestLinux_ExecStep(t *testing.T) { }, }, { - name: "detached step container", + name: "docker-detached step container", failure: false, container: &pipeline.Container{ ID: "step_github_octocat_1_echo", @@ -289,7 +289,7 @@ func TestLinux_ExecStep(t *testing.T) { }, }, { - name: "step container with image not found", + name: "docker-step container with image not found", failure: true, container: &pipeline.Container{ ID: "step_github_octocat_1_echo", @@ -302,7 +302,7 @@ func TestLinux_ExecStep(t *testing.T) { }, }, { - name: "empty step container", + name: "docker-empty step container", failure: true, container: new(pipeline.Container), }, @@ -321,7 +321,7 @@ func TestLinux_ExecStep(t *testing.T) { withStreamRequests(streamRequests), ) if err != nil { - t.Errorf("unable to create executor engine: %v", err) + t.Errorf("unable to create %s executor engine: %v", test.name, err) } if !test.container.Empty() { @@ -333,14 +333,14 @@ func TestLinux_ExecStep(t *testing.T) { if test.failure { if err == nil { - t.Errorf("ExecStep should have returned err") + t.Errorf("%s ExecStep should have returned err", test.name) } return // continue to next test } if err != nil { - t.Errorf("ExecStep returned err: %v", err) + t.Errorf("%s ExecStep returned err: %v", test.name, err) } }) } @@ -368,7 +368,7 @@ func TestLinux_StreamStep(t *testing.T) { _runtime, err := docker.NewMock() if err != nil { - t.Errorf("unable to create runtime engine: %v", err) + t.Errorf("unable to create docker runtime engine: %v", err) } // setup tests @@ -379,7 +379,7 @@ func TestLinux_StreamStep(t *testing.T) { container *pipeline.Container }{ { - name: "init step container", + name: "docker-init step container", failure: false, logs: _logs, container: &pipeline.Container{ @@ -393,7 +393,7 @@ func TestLinux_StreamStep(t *testing.T) { }, }, { - name: "basic step container", + name: "docker-basic step container", failure: false, logs: _logs, container: &pipeline.Container{ @@ -407,7 +407,7 @@ func TestLinux_StreamStep(t *testing.T) { }, }, { - name: "step container with name not found", + name: "docker-step container with name not found", failure: true, logs: _logs, container: &pipeline.Container{ @@ -421,7 +421,7 @@ func TestLinux_StreamStep(t *testing.T) { }, }, { - name: "empty step container", + name: "docker-empty step container", failure: true, logs: _logs, container: new(pipeline.Container), @@ -441,7 +441,7 @@ func TestLinux_StreamStep(t *testing.T) { WithVelaClient(_client), ) if err != nil { - t.Errorf("unable to create executor engine: %v", err) + t.Errorf("unable to create %s executor engine: %v", test.name, err) } if !test.container.Empty() { @@ -453,14 +453,14 @@ func TestLinux_StreamStep(t *testing.T) { if test.failure { if err == nil { - t.Errorf("StreamStep should have returned err") + t.Errorf("%s StreamStep should have returned err", test.name) } return // continue to next test } if err != nil { - t.Errorf("StreamStep returned err: %v", err) + t.Errorf("%s StreamStep returned err: %v", test.name, err) } }) } @@ -483,7 +483,7 @@ func TestLinux_DestroyStep(t *testing.T) { _runtime, err := docker.NewMock() if err != nil { - t.Errorf("unable to create runtime engine: %v", err) + t.Errorf("unable to create docker runtime engine: %v", err) } // setup tests @@ -493,7 +493,7 @@ func TestLinux_DestroyStep(t *testing.T) { container *pipeline.Container }{ { - name: "init step container", + name: "docker-init step container", failure: false, container: &pipeline.Container{ ID: "step_github_octocat_1_init", @@ -506,7 +506,7 @@ func TestLinux_DestroyStep(t *testing.T) { }, }, { - name: "basic step container", + name: "docker-basic step container", failure: false, container: &pipeline.Container{ ID: "step_github_octocat_1_echo", @@ -519,7 +519,7 @@ func TestLinux_DestroyStep(t *testing.T) { }, }, { - name: "step container with ignoring name not found", + name: "docker-step container with ignoring name not found", failure: true, container: &pipeline.Container{ ID: "step_github_octocat_1_ignorenotfound", @@ -545,21 +545,21 @@ func TestLinux_DestroyStep(t *testing.T) { WithVelaClient(_client), ) if err != nil { - t.Errorf("unable to create executor engine: %v", err) + t.Errorf("unable to create %s executor engine: %v", test.name, err) } err = _engine.DestroyStep(context.Background(), test.container) if test.failure { if err == nil { - t.Errorf("DestroyStep should have returned err") + t.Errorf("%s DestroyStep should have returned err", test.name) } return // continue to next test } if err != nil { - t.Errorf("DestroyStep returned err: %v", err) + t.Errorf("%s DestroyStep returned err: %v", test.name, err) } }) }