Skip to content

Commit

Permalink
Call k8s SetupMock in executor Build test
Browse files Browse the repository at this point in the history
  • Loading branch information
cognifloyd committed Feb 21, 2023
1 parent bb5e020 commit d183498
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions executor/linux/build_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1529,6 +1529,14 @@ func TestLinux_ExecBuild(t *testing.T) {
// go-vela/server has logic to set it to an expected state.
_engine.build.SetStatus("running")

// Kubernetes runtime needs to set up the Mock after CreateBuild is called
if test.runtime == constants.DriverKubernetes {
err = _runtime.(kubernetes.MockKubernetesRuntime).SetupMock()
if err != nil {
t.Errorf("Kubernetes runtime SetupMock returned err: %v", err)
}
}

err = _engine.ExecBuild(context.Background())

if test.failure {
Expand Down Expand Up @@ -2092,6 +2100,14 @@ func TestLinux_DestroyBuild(t *testing.T) {
t.Errorf("%s unable to create build: %v", test.name, err)
}

// Kubernetes runtime needs to set up the Mock after CreateBuild is called
if test.runtime == constants.DriverKubernetes {
err = _runtime.(kubernetes.MockKubernetesRuntime).SetupMock()
if err != nil {
t.Errorf("Kubernetes runtime SetupMock returned err: %v", err)
}
}

err = _engine.DestroyBuild(context.Background())

if test.failure {
Expand Down

0 comments on commit d183498

Please sign in to comment.