Update controller initializer funcs to take Context

This commit is contained in:
Mike Dame
2021-04-22 14:08:24 -04:00
parent 6a71f85ccf
commit 80dcf7df1b
11 changed files with 309 additions and 294 deletions

View File

@@ -17,6 +17,7 @@ limitations under the License.
package app
import (
"context"
"testing"
"time"
@@ -104,7 +105,7 @@ func possibleDiscoveryResource() []*metav1.APIResourceList {
}
}
type controllerInitFunc func(ControllerContext) (controller.Interface, bool, error)
type controllerInitFunc func(context.Context, ControllerContext) (controller.Interface, bool, error)
func TestController_DiscoveryError(t *testing.T) {
controllerInitFuncMap := map[string]controllerInitFunc{
@@ -143,7 +144,7 @@ func TestController_DiscoveryError(t *testing.T) {
InformersStarted: make(chan struct{}),
}
for funcName, controllerInit := range controllerInitFuncMap {
_, _, err := controllerInit(ctx)
_, _, err := controllerInit(context.TODO(), ctx)
if test.expectedErr != (err != nil) {
t.Errorf("%v test failed for use case: %v", funcName, name)
}