Using assertions

Using assertions for unit tests:

1. cmd/kube-controller-manager/app/controller_manager_test.go
2. pkg/controller/bootstrap/jws_test.go
3. pkg/controller/cloud/node_controller_test.go
4. pkg/controller/controller_utils_test.go
This commit is contained in:
Chen Li
2017-09-20 00:24:07 -05:00
parent 1797255cd2
commit fb9b29dbb1
7 changed files with 166 additions and 221 deletions

View File

@@ -24,6 +24,8 @@ import (
"testing"
"k8s.io/apimachinery/pkg/util/sets"
"github.com/stretchr/testify/assert"
)
func TestIsControllerEnabled(t *testing.T) {
@@ -73,9 +75,7 @@ func TestIsControllerEnabled(t *testing.T) {
for _, tc := range tcs {
actual := IsControllerEnabled(tc.controllerName, sets.NewString(tc.disabledByDefaultControllers...), tc.controllers...)
if actual != tc.expected {
t.Errorf("%v: expected %v, got %v", tc.name, tc.expected, actual)
}
assert.Equal(t, tc.expected, actual, "%v: expected %v, got %v", tc.name, tc.expected, actual)
}
}