@@ -86,12 +86,8 @@ func setupEnvTest(t *testing.T) (string, error) {
8686 os .Setenv ("HOME" , homeDir )
8787 }
8888
89- // Use the remote-bucket flag to keep up with openshift/api's divergence
90- // More info:
91- // https://github.com/openshift/api/pull/1774,
92- // https://github.com/openshift/api/blob/master/tools/publish-kubebuilder-tools/README.md#using-the-archives
93- // https://groups.google.com/a/redhat.com/g/aos-devel/c/JXtIlYlFbDA
94- cmd := exec .Command (setupEnvTestBinPath , "use" , k8sVersion , "--index" , "https://raw.githubusercontent.com/openshift/api/master/envtest-releases.yaml" )
89+ // Explanation for flags: https://groups.google.com/a/redhat.com/g/aos-devel/c/JXtIlYlFbDA
90+ cmd := exec .Command (setupEnvTestBinPath , "use" , k8sVersion , "-p" , "path" , "--index" , "https://raw.githubusercontent.com/openshift/api/master/envtest-releases.yaml" )
9591 t .Log ("Setting up EnvTest: $" , cmd )
9692
9793 // We want to consume the path of where setup-envtest installed the
@@ -117,11 +113,9 @@ func NewTestEnv(t *testing.T) *envtest.Environment {
117113 return & envtest.Environment {
118114 CRDInstallOptions : envtest.CRDInstallOptions {
119115 Paths : []string {
120- filepath .Join (".." , ".." , "vendor" , "github.com" , "openshift" , "api" , "config" , "v1" ),
121- filepath .Join (".." , ".." , "vendor" , "github.com" , "openshift" , "api" , "operator" , "v1alpha1" ),
116+ filepath .Join (".." , ".." , "vendor" , "github.com" , "openshift" , "api" , "operator" , "v1" , "zz_generated.crd-manifests" ),
122117 filepath .Join (".." , ".." , "vendor" , "github.com" , "openshift" , "api" , "operator" , "v1alpha1" , "zz_generated.crd-manifests" ),
123118 filepath .Join (".." , ".." , "vendor" , "github.com" , "openshift" , "api" , "config" , "v1" , "zz_generated.crd-manifests" ),
124- filepath .Join (".." , ".." , "vendor" , "github.com" , "openshift" , "api" , "config" , "v1alpha1" , "zz_generated.crd-manifests" ),
125119 filepath .Join (".." , ".." , "vendor" , "github.com" , "openshift" , "api" , "machineconfiguration" , "v1" , "zz_generated.crd-manifests" ),
126120 filepath .Join (".." , ".." , "vendor" , "github.com" , "openshift" , "api" , "machineconfiguration" , "v1alpha1" , "zz_generated.crd-manifests" ),
127121 },
@@ -220,6 +214,10 @@ func CheckCleanEnvironment(t *testing.T, clientSet *ClientSet) {
220214 nodeConfigList , err := clientSet .ConfigV1Interface .Nodes ().List (ctx , metav1.ListOptions {})
221215 require .NoError (t , err )
222216 require .Len (t , nodeConfigList .Items , 0 )
217+
218+ clusterImagePolicyList , err := clientSet .ConfigV1Interface .ClusterImagePolicies ().List (ctx , metav1.ListOptions {})
219+ require .NoError (t , err )
220+ require .Len (t , clusterImagePolicyList .Items , 0 )
223221 // ###########################
224222 // END: config.openshift.io/v1
225223 // ###########################
@@ -261,6 +259,9 @@ func CleanEnvironment(t *testing.T, clientSet *ClientSet) {
261259
262260 err = clientSet .MachineConfigs ().DeleteCollection (ctx , metav1.DeleteOptions {}, metav1.ListOptions {})
263261 require .NoError (t , err )
262+
263+ err = clientSet .MachineOSConfigs ().DeleteCollection (ctx , metav1.DeleteOptions {}, metav1.ListOptions {})
264+ require .NoError (t , err )
264265 // ######################################
265266 // END: machineconfiguration.openshift.io
266267 // ######################################
@@ -312,6 +313,9 @@ func CleanEnvironment(t *testing.T, clientSet *ClientSet) {
312313
313314 err = clientSet .ConfigV1Interface .Nodes ().DeleteCollection (ctx , metav1.DeleteOptions {}, metav1.ListOptions {})
314315 require .NoError (t , err )
316+
317+ err = clientSet .ConfigV1Interface .ClusterImagePolicies ().DeleteCollection (ctx , metav1.DeleteOptions {}, metav1.ListOptions {})
318+ require .NoError (t , err )
315319 // ###########################
316320 // END: config.openshift.io/v1
317321 // ###########################
@@ -346,6 +350,9 @@ func CreateObjects(t *testing.T, clientSet *ClientSet, objs ...runtime.Object) {
346350 case * mcfgv1.KubeletConfig :
347351 _ , err := clientSet .KubeletConfigs ().Create (ctx , tObj , metav1.CreateOptions {})
348352 require .NoError (t , err )
353+ case * mcfgv1.MachineOSConfig :
354+ _ , err := clientSet .MachineOSConfigs ().Create (ctx , tObj , metav1.CreateOptions {})
355+ require .NoError (t , err )
349356 case * corev1.Secret :
350357 _ , err := clientSet .Secrets (tObj .GetNamespace ()).Create (ctx , tObj , metav1.CreateOptions {})
351358 require .NoError (t , err )
@@ -361,6 +368,9 @@ func CreateObjects(t *testing.T, clientSet *ClientSet, objs ...runtime.Object) {
361368 case * configv1.Image :
362369 _ , err := clientSet .ConfigV1Interface .Images ().Create (ctx , tObj , metav1.CreateOptions {})
363370 require .NoError (t , err )
371+ case * configv1.ClusterImagePolicy :
372+ _ , err := clientSet .ConfigV1Interface .ClusterImagePolicies ().Create (ctx , tObj , metav1.CreateOptions {})
373+ require .NoError (t , err )
364374 case * configv1.FeatureGate :
365375 originalStatus := tObj .Status
366376 cObj , err := clientSet .FeatureGates ().Create (ctx , tObj , metav1.CreateOptions {})
0 commit comments