4
4
"context"
5
5
"encoding/json"
6
6
"fmt"
7
- "path/filepath"
8
7
"testing"
9
8
10
9
. "github.com/onsi/ginkgo/v2"
@@ -17,15 +16,13 @@ import (
17
16
"github.com/stretchr/testify/require"
18
17
apimeta "k8s.io/apimachinery/pkg/api/meta"
19
18
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
20
- "k8s.io/apimachinery/pkg/runtime"
21
19
"k8s.io/apimachinery/pkg/types"
22
20
"k8s.io/apimachinery/pkg/util/rand"
23
21
featuregatetesting "k8s.io/component-base/featuregate/testing"
24
22
"k8s.io/utils/pointer"
25
23
ctrl "sigs.k8s.io/controller-runtime"
26
24
"sigs.k8s.io/controller-runtime/pkg/client"
27
25
"sigs.k8s.io/controller-runtime/pkg/client/fake"
28
- "sigs.k8s.io/controller-runtime/pkg/envtest"
29
26
30
27
operatorsv1alpha1 "github.com/operator-framework/operator-controller/api/v1alpha1"
31
28
"github.com/operator-framework/operator-controller/internal/catalogmetadata"
@@ -1057,27 +1054,6 @@ func verifyConditionsInvariants(op *operatorsv1alpha1.Operator) {
1057
1054
}
1058
1055
1059
1056
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
-
1081
1057
ctx := context .Background ()
1082
1058
fakeCatalogClient := testutil .NewFakeCatalogClient (testBundleList )
1083
1059
reconciler := & controllers.OperatorReconciler {
@@ -1106,7 +1082,7 @@ func TestOperatorUpgrade(t *testing.T) {
1106
1082
},
1107
1083
}
1108
1084
// Create an operator
1109
- err = cl .Create (ctx , operator )
1085
+ err : = cl .Create (ctx , operator )
1110
1086
require .NoError (t , err )
1111
1087
1112
1088
// Run reconcile
@@ -1199,7 +1175,7 @@ func TestOperatorUpgrade(t *testing.T) {
1199
1175
},
1200
1176
}
1201
1177
// Create an operator
1202
- err = cl .Create (ctx , operator )
1178
+ err : = cl .Create (ctx , operator )
1203
1179
require .NoError (t , err )
1204
1180
1205
1181
// Run reconcile
0 commit comments