Skip to content

Commit da2223b

Browse files
author
Mikalai Radchuk
committed
fixup! Add operator upgrade tests
1 parent 6799037 commit da2223b

File tree

1 file changed

+2
-26
lines changed

1 file changed

+2
-26
lines changed

internal/controllers/operator_controller_test.go

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import (
44
"context"
55
"encoding/json"
66
"fmt"
7-
"path/filepath"
87
"testing"
98

109
. "github.com/onsi/ginkgo/v2"
@@ -17,15 +16,13 @@ import (
1716
"github.com/stretchr/testify/require"
1817
apimeta "k8s.io/apimachinery/pkg/api/meta"
1918
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
20-
"k8s.io/apimachinery/pkg/runtime"
2119
"k8s.io/apimachinery/pkg/types"
2220
"k8s.io/apimachinery/pkg/util/rand"
2321
featuregatetesting "k8s.io/component-base/featuregate/testing"
2422
"k8s.io/utils/pointer"
2523
ctrl "sigs.k8s.io/controller-runtime"
2624
"sigs.k8s.io/controller-runtime/pkg/client"
2725
"sigs.k8s.io/controller-runtime/pkg/client/fake"
28-
"sigs.k8s.io/controller-runtime/pkg/envtest"
2926

3027
operatorsv1alpha1 "github.com/operator-framework/operator-controller/api/v1alpha1"
3128
"github.com/operator-framework/operator-controller/internal/catalogmetadata"
@@ -1057,27 +1054,6 @@ func verifyConditionsInvariants(op *operatorsv1alpha1.Operator) {
10571054
}
10581055

10591056
func TestOperatorUpgrade(t *testing.T) {
1060-
// bootstrapping test environment
1061-
var err error
1062-
testEnv := &envtest.Environment{
1063-
CRDDirectoryPaths: []string{
1064-
filepath.Join("..", "..", "config", "crd", "bases"),
1065-
filepath.Join("..", "..", "testdata", "crds")},
1066-
ErrorIfCRDPathMissing: true,
1067-
}
1068-
1069-
cfg, err = testEnv.Start()
1070-
require.NoError(t, err)
1071-
assert.NotNil(t, cfg)
1072-
1073-
sch = runtime.NewScheme()
1074-
require.NoError(t, operatorsv1alpha1.AddToScheme(sch))
1075-
require.NoError(t, rukpakv1alpha1.AddToScheme(sch))
1076-
1077-
cl, err = client.New(cfg, client.Options{Scheme: sch})
1078-
require.NoError(t, err)
1079-
assert.NotNil(t, cl)
1080-
10811057
ctx := context.Background()
10821058
fakeCatalogClient := testutil.NewFakeCatalogClient(testBundleList)
10831059
reconciler := &controllers.OperatorReconciler{
@@ -1106,7 +1082,7 @@ func TestOperatorUpgrade(t *testing.T) {
11061082
},
11071083
}
11081084
// Create an operator
1109-
err = cl.Create(ctx, operator)
1085+
err := cl.Create(ctx, operator)
11101086
require.NoError(t, err)
11111087

11121088
// Run reconcile
@@ -1199,7 +1175,7 @@ func TestOperatorUpgrade(t *testing.T) {
11991175
},
12001176
}
12011177
// Create an operator
1202-
err = cl.Create(ctx, operator)
1178+
err := cl.Create(ctx, operator)
12031179
require.NoError(t, err)
12041180

12051181
// Run reconcile

0 commit comments

Comments
 (0)