Skip to content

Commit

Permalink
Use 'envtest.WaitForCRDs' (#1730)
Browse files Browse the repository at this point in the history
This removes 'testutils.WaitForCRDs' in favor of 'envtest.WaitForCRDs' as this function will be removed from kuttl in a future release.

Signed-off-by: Jan Schlicht <jan@d2iq.com>
  • Loading branch information
Jan Schlicht committed Nov 5, 2020
1 parent 7e4bea7 commit 7d20994
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions pkg/kudoctl/cmd/init_integration_test.go
Expand Up @@ -12,6 +12,7 @@ import (
"path/filepath"
"strings"
"testing"
"time"

testutils "github.com/kudobuilder/kuttl/pkg/test/utils"
"github.com/spf13/afero"
Expand All @@ -23,6 +24,7 @@ import (
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/client-go/kubernetes"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/envtest"
"sigs.k8s.io/yaml"

"github.com/kudobuilder/kudo/pkg/kudoctl/clog"
Expand Down Expand Up @@ -130,7 +132,10 @@ func TestIntegInitForCRDs(t *testing.T) {
err = cmd.run()
assert.NoError(t, err)
// WaitForCRDs to be created... the init cmd did NOT wait
assert.NoError(t, testutils.WaitForCRDs(testenv.DiscoveryClient, crds))
assert.NoError(t, envtest.WaitForCRDs(testenv.Config, crds, envtest.CRDInstallOptions{
PollInterval: 100 * time.Millisecond,
MaxTime: 10 * time.Second,
}))
defer func() {
assert.NoError(t, deleteObjects(crds, testClient))
}()
Expand Down Expand Up @@ -196,7 +201,10 @@ func TestIntegInitWithNameSpace(t *testing.T) {
}()

// WaitForCRDs to be created... the init cmd did NOT wait
assert.NoError(t, testutils.WaitForCRDs(testenv.DiscoveryClient, crds))
assert.NoError(t, envtest.WaitForCRDs(testenv.Config, crds, envtest.CRDInstallOptions{
PollInterval: 100 * time.Millisecond,
MaxTime: 10 * time.Second,
}))

// make sure that the controller lives in the correct namespace
kclient = getKubeClient(t)
Expand Down Expand Up @@ -344,7 +352,10 @@ func TestInitWithServiceAccount(t *testing.T) {
}()

// WaitForCRDs to be created... the init cmd did NOT wait
assert.NoError(t, testutils.WaitForCRDs(testenv.DiscoveryClient, crds))
assert.NoError(t, envtest.WaitForCRDs(testenv.Config, crds, envtest.CRDInstallOptions{
PollInterval: 100 * time.Millisecond,
MaxTime: 10 * time.Second,
}))

// make sure that the controller lives in the correct namespace
kclient = getKubeClient(t)
Expand Down Expand Up @@ -398,7 +409,10 @@ func TestReInitFails(t *testing.T) {
assert.NoError(t, err)

// WaitForCRDs to be created... the init cmd did NOT wait
assert.NoError(t, testutils.WaitForCRDs(testenv.DiscoveryClient, crds))
assert.NoError(t, envtest.WaitForCRDs(testenv.Config, crds, envtest.CRDInstallOptions{
PollInterval: 100 * time.Millisecond,
MaxTime: 10 * time.Second,
}))
defer func() {
assert.NoError(t, deleteObjects(crds, testClient))
}()
Expand Down

0 comments on commit 7d20994

Please sign in to comment.