Skip to content

Commit

Permalink
fix: tests
Browse files Browse the repository at this point in the history
  • Loading branch information
devthejo committed Nov 10, 2022
1 parent 7632606 commit 15e8056
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions cmd/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package main_test
import (
"testing"

"github.com/SocialGouv/rollout-status/pkg/config"
"github.com/SocialGouv/rollout-status/pkg/status"
"github.com/stretchr/testify/assert"
appsv1 "k8s.io/api/apps/v1"
Expand All @@ -13,7 +14,7 @@ const IgnoredByMock = "any-value"

func TestNotFound(t *testing.T) {
wrapper := mockWrapper([]appsv1.Deployment{}, []appsv1.StatefulSet{}, []appsv1.ReplicaSet{}, []v1.Pod{})
rolloutStatus := status.TestRollout(wrapper, "any-ns", "foo=bar")
rolloutStatus := status.TestRollout(wrapper, "any-ns", "foo=bar", &config.Options{})

re, ok := rolloutStatus.Error.(status.RolloutError)
assert.True(t, ok)
Expand All @@ -24,15 +25,15 @@ func TestNotFound(t *testing.T) {

func TestSuccess(t *testing.T) {
wrapper := mockWrapperFromAssets(t.Name())
rolloutStatus := status.TestRollout(wrapper, IgnoredByMock, IgnoredByMock)
rolloutStatus := status.TestRollout(wrapper, IgnoredByMock, IgnoredByMock, &config.Options{})

assert.False(t, rolloutStatus.Continue)
assert.Nil(t, rolloutStatus.Error)
}

func TestContainerCreating(t *testing.T) {
wrapper := mockWrapperFromAssets(t.Name())
rolloutStatus := status.TestRollout(wrapper, IgnoredByMock, IgnoredByMock)
rolloutStatus := status.TestRollout(wrapper, IgnoredByMock, IgnoredByMock, &config.Options{})

re, ok := rolloutStatus.Error.(status.RolloutError)
assert.True(t, ok)
Expand All @@ -43,7 +44,7 @@ func TestContainerCreating(t *testing.T) {

func TestInitContainer(t *testing.T) {
wrapper := mockWrapperFromAssets(t.Name())
rolloutStatus := status.TestRollout(wrapper, IgnoredByMock, IgnoredByMock)
rolloutStatus := status.TestRollout(wrapper, IgnoredByMock, IgnoredByMock, &config.Options{})

re, ok := rolloutStatus.Error.(status.RolloutError)
assert.True(t, ok)
Expand All @@ -54,7 +55,7 @@ func TestInitContainer(t *testing.T) {

func assertRolloutFailure(t *testing.T, expectedMessage string) {
wrapper := mockWrapperFromAssets(t.Name())
rolloutStatus := status.TestRollout(wrapper, IgnoredByMock, IgnoredByMock)
rolloutStatus := status.TestRollout(wrapper, IgnoredByMock, IgnoredByMock, &config.Options{})

re, ok := rolloutStatus.Error.(status.RolloutError)
assert.True(t, ok)
Expand Down

0 comments on commit 15e8056

Please sign in to comment.