Skip to content

Commit

Permalink
tests: add mocked runtime tests
Browse files Browse the repository at this point in the history
  • Loading branch information
cognifloyd committed May 12, 2022
1 parent 4a84cfd commit ecf511e
Showing 1 changed file with 42 additions and 16 deletions.
58 changes: 42 additions & 16 deletions runtime/setup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,30 +11,56 @@ import (
)

func TestRuntime_Setup_Docker(t *testing.T) {
// setup types
_setup := &Setup{
Driver: constants.DriverDocker,
tests := []struct {
name string
mock bool
}{
{name: "standard", mock: false},
{name: "mocked", mock: true},
}

// run test
_, err := _setup.Docker()
if err != nil {
t.Errorf("Docker returned err: %v", err)
// run tests
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
// setup types
_setup := &Setup{
Mock: test.mock,
Driver: constants.DriverDocker,
}

_, err := _setup.Docker()
if err != nil {
t.Errorf("Docker returned err: %v", err)
}
})
}
}

func TestRuntime_Setup_Kubernetes(t *testing.T) {
// setup types
_setup := &Setup{
Driver: constants.DriverKubernetes,
ConfigFile: "testdata/config",
Namespace: "docker",
tests := []struct {
name string
mock bool
}{
{name: "standard", mock: false},
{name: "mocked", mock: true},
}

// run test
_, err := _setup.Kubernetes()
if err != nil {
t.Errorf("Kubernetes returned err: %v", err)
// run tests
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
// setup types
_setup := &Setup{
Mock: test.mock,
Driver: constants.DriverKubernetes,
ConfigFile: "testdata/config",
Namespace: "docker",
}

_, err := _setup.Kubernetes()
if err != nil {
t.Errorf("Kubernetes returned err: %v", err)
}
})
}
}

Expand Down

0 comments on commit ecf511e

Please sign in to comment.