@@ -360,71 +360,6 @@ func TestClusterExtensionInstallRegistry(t *testing.T) {
360360 }
361361}
362362
363- func TestClusterExtensionInstallFailsWithoutServiceAccount (t * testing.T ) {
364- t .Log ("When a cluster extension is installed from a catalog" )
365- t .Log ("And the ServiceAccount does not exist" )
366-
367- // Step 1: Setup test environment without creating an SA
368- clusterExtensionName := fmt .Sprintf ("clusterextension-%s" , rand .String (8 ))
369-
370- ns , err := createNamespace (context .Background (), clusterExtensionName )
371- require .NoError (t , err )
372-
373- extensionCatalog , err := createTestCatalog (context .Background (), testCatalogName , os .Getenv (testCatalogRefEnvVar ))
374- require .NoError (t , err )
375-
376- // Important: We do NOT create a ServiceAccount here
377- defer testCleanup (t , extensionCatalog , nil , nil , ns )
378- defer utils .CollectTestArtifacts (t , artifactName , c , cfg )
379-
380- // Step 2: Define the ClusterExtension with a non-existent SA
381- clusterExtension := & ocv1.ClusterExtension {
382- ObjectMeta : metav1.ObjectMeta {
383- Name : clusterExtensionName ,
384- },
385- Spec : ocv1.ClusterExtensionSpec {
386- Source : ocv1.SourceConfig {
387- SourceType : "Catalog" ,
388- Catalog : & ocv1.CatalogSource {
389- PackageName : "test" ,
390- Selector : & metav1.LabelSelector {
391- MatchLabels : map [string ]string {"olm.operatorframework.io/metadata.name" : extensionCatalog .Name },
392- },
393- },
394- },
395- Namespace : ns .Name ,
396- ServiceAccount : ocv1.ServiceAccountReference {
397- Name : "non-existent-sa" , // This SA does NOT exist
398- },
399- },
400- }
401-
402- t .Log ("By creating the ClusterExtension resource without a ServiceAccount" )
403- require .NoError (t , c .Create (context .Background (), clusterExtension ))
404-
405- // Step 3: Validate failure due to missing ServiceAccount
406- t .Log ("By eventually reporting an installation failure due to missing ServiceAccount" )
407- require .EventuallyWithT (t , func (ct * assert.CollectT ) {
408- assert .NoError (ct , c .Get (context .Background (), types.NamespacedName {Name : clusterExtension .Name }, clusterExtension ))
409-
410- // Validate that Progressing reports failure
411- cond := apimeta .FindStatusCondition (clusterExtension .Status .Conditions , ocv1 .TypeProgressing )
412- if assert .NotNil (ct , cond ) {
413- assert .Equal (ct , metav1 .ConditionTrue , cond .Status )
414- assert .Equal (ct , ocv1 .ReasonRetrying , cond .Reason )
415- assert .Contains (ct , cond .Message , "installation cannot proceed due to missing ServiceAccount" )
416- }
417-
418- // Validate that Installed condition is false
419- installCond := apimeta .FindStatusCondition (clusterExtension .Status .Conditions , ocv1 .TypeInstalled )
420- if assert .NotNil (ct , installCond ) {
421- assert .Equal (ct , metav1 .ConditionUnknown , installCond .Status )
422- assert .Equal (ct , ocv1 .ReasonFailed , installCond .Reason )
423- assert .Contains (ct , installCond .Message , "service account" )
424- }
425- }, pollDuration , pollInterval )
426- }
427-
428363func TestClusterExtensionInstallRegistryDynamic (t * testing.T ) {
429364 // NOTE: Like 'TestClusterExtensionInstallRegistry', this test also requires extra configuration in /etc/containers/registries.conf
430365 packageName := "dynamic"
0 commit comments