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 10, 2022
1 parent 01d6942 commit 5e55425
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 5e55425

Please sign in to comment.