@@ -37,7 +37,7 @@ const (
3737var pollDuration = time .Minute
3838var pollInterval = time .Second
3939
40- func testInit (t * testing.T ) (* ocv1alpha1.ClusterExtension , string , * catalogd.Catalog ) {
40+ func testInit (t * testing.T ) (* ocv1alpha1.ClusterExtension , * catalogd.Catalog ) {
4141 var err error
4242 extensionCatalog , err := createTestCatalog (context .Background (), testCatalogName , os .Getenv (testCatalogRefEnvVar ))
4343 require .NoError (t , err )
@@ -48,7 +48,7 @@ func testInit(t *testing.T) (*ocv1alpha1.ClusterExtension, string, *catalogd.Cat
4848 Name : clusterExtensionName ,
4949 },
5050 }
51- return clusterExtension , clusterExtensionName , extensionCatalog
51+ return clusterExtension , extensionCatalog
5252}
5353
5454func testCleanup (t * testing.T , cat * catalogd.Catalog , clusterExtension * ocv1alpha1.ClusterExtension ) {
@@ -68,7 +68,7 @@ func TestClusterExtensionInstallRegistry(t *testing.T) {
6868 t .Log ("When a cluster extension is installed from a catalog" )
6969 t .Log ("When the extension bundle format is registry+v1" )
7070
71- clusterExtension , clusterExtensionName , extensionCatalog := testInit (t )
71+ clusterExtension , extensionCatalog := testInit (t )
7272 defer testCleanup (t , extensionCatalog , clusterExtension )
7373 defer getArtifactsOutput (t )
7474
@@ -83,7 +83,7 @@ func TestClusterExtensionInstallRegistry(t *testing.T) {
8383 t .Log ("By eventually reporting a successful resolution and bundle path" )
8484 require .EventuallyWithT (t , func (ct * assert.CollectT ) {
8585 assert .NoError (ct , c .Get (context .Background (), types.NamespacedName {Name : clusterExtension .Name }, clusterExtension ))
86- assert .Len (ct , clusterExtension .Status .Conditions , 6 )
86+ assert .Len (ct , clusterExtension .Status .Conditions , 9 )
8787 cond := apimeta .FindStatusCondition (clusterExtension .Status .Conditions , ocv1alpha1 .TypeResolved )
8888 if ! assert .NotNil (ct , cond ) {
8989 return
@@ -94,6 +94,18 @@ func TestClusterExtensionInstallRegistry(t *testing.T) {
9494 assert .Equal (ct , & ocv1alpha1.BundleMetadata {Name : "prometheus-operator.2.0.0" , Version : "2.0.0" }, clusterExtension .Status .ResolvedBundle )
9595 }, pollDuration , pollInterval )
9696
97+ t .Log ("By eventually reporting a successful unpacked" )
98+ require .EventuallyWithT (t , func (ct * assert.CollectT ) {
99+ assert .NoError (ct , c .Get (context .Background (), types.NamespacedName {Name : clusterExtension .Name }, clusterExtension ))
100+ cond := apimeta .FindStatusCondition (clusterExtension .Status .Conditions , rukpakv1alpha2 .TypeUnpacked )
101+ if ! assert .NotNil (ct , cond ) {
102+ return
103+ }
104+ assert .Equal (ct , metav1 .ConditionTrue , cond .Status )
105+ assert .Equal (ct , rukpakv1alpha2 .ReasonUnpackSuccessful , cond .Reason )
106+ assert .Contains (ct , cond .Message , "Successfully unpacked" )
107+ }, pollDuration , pollInterval )
108+
97109 t .Log ("By eventually installing the package successfully" )
98110 require .EventuallyWithT (t , func (ct * assert.CollectT ) {
99111 assert .NoError (ct , c .Get (context .Background (), types.NamespacedName {Name : clusterExtension .Name }, clusterExtension ))
@@ -103,29 +115,16 @@ func TestClusterExtensionInstallRegistry(t *testing.T) {
103115 }
104116 assert .Equal (ct , metav1 .ConditionTrue , cond .Status )
105117 assert .Equal (ct , ocv1alpha1 .ReasonSuccess , cond .Reason )
106- assert .Contains (ct , cond .Message , "installed from " )
118+ assert .Contains (ct , cond .Message , "Instantiated bundle " )
107119 assert .NotEmpty (ct , clusterExtension .Status .InstalledBundle )
108-
109- bd := rukpakv1alpha2.BundleDeployment {}
110- assert .NoError (ct , c .Get (context .Background (), types.NamespacedName {Name : clusterExtensionName }, & bd ))
111- isUnpackSuccessful := apimeta .FindStatusCondition (bd .Status .Conditions , rukpakv1alpha2 .TypeUnpacked )
112- if ! assert .NotNil (ct , isUnpackSuccessful ) {
113- return
114- }
115- assert .Equal (ct , rukpakv1alpha2 .ReasonUnpackSuccessful , isUnpackSuccessful .Reason )
116- installed := apimeta .FindStatusCondition (bd .Status .Conditions , rukpakv1alpha2 .TypeInstalled )
117- if ! assert .NotNil (ct , installed ) {
118- return
119- }
120- assert .Equal (ct , rukpakv1alpha2 .ReasonInstallationSucceeded , installed .Reason )
121120 }, pollDuration , pollInterval )
122121}
123122
124123func TestClusterExtensionInstallReResolvesWhenNewCatalog (t * testing.T ) {
125124 t .Log ("When a cluster extension is installed from a catalog" )
126125 t .Log ("It resolves again when a new catalog is available" )
127126
128- clusterExtension , _ , extensionCatalog := testInit (t )
127+ clusterExtension , extensionCatalog := testInit (t )
129128 defer testCleanup (t , extensionCatalog , clusterExtension )
130129 defer getArtifactsOutput (t )
131130
@@ -154,7 +153,7 @@ func TestClusterExtensionInstallReResolvesWhenNewCatalog(t *testing.T) {
154153 }
155154 assert .Equal (ct , metav1 .ConditionFalse , cond .Status )
156155 assert .Equal (ct , ocv1alpha1 .ReasonResolutionFailed , cond .Reason )
157- assert .Equal (ct , fmt .Sprintf ("no package %q found" , pkgName ), cond . Message )
156+ assert .Contains (ct , cond . Message , fmt .Sprintf ("no package %q found" , pkgName ))
158157 }, pollDuration , pollInterval )
159158
160159 t .Log ("By creating an ClusterExtension catalog with the desired package" )
@@ -184,10 +183,11 @@ func TestClusterExtensionInstallReResolvesWhenNewCatalog(t *testing.T) {
184183}
185184
186185func TestClusterExtensionBlockInstallNonSuccessorVersion (t * testing.T ) {
186+ t .Skip ("Skipping tests related to upgrades" )
187187 t .Log ("When a cluster extension is installed from a catalog" )
188188 t .Log ("When resolving upgrade edges" )
189189
190- clusterExtension , _ , extensionCatalog := testInit (t )
190+ clusterExtension , extensionCatalog := testInit (t )
191191 defer testCleanup (t , extensionCatalog , clusterExtension )
192192 defer getArtifactsOutput (t )
193193
@@ -229,10 +229,11 @@ func TestClusterExtensionBlockInstallNonSuccessorVersion(t *testing.T) {
229229}
230230
231231func TestClusterExtensionForceInstallNonSuccessorVersion (t * testing.T ) {
232+ t .Skip ("Skipping tests related to upgrades" )
232233 t .Log ("When a cluster extension is installed from a catalog" )
233234 t .Log ("When resolving upgrade edges" )
234235
235- clusterExtension , _ , extensionCatalog := testInit (t )
236+ clusterExtension , extensionCatalog := testInit (t )
236237 defer testCleanup (t , extensionCatalog , clusterExtension )
237238 defer getArtifactsOutput (t )
238239
@@ -275,9 +276,10 @@ func TestClusterExtensionForceInstallNonSuccessorVersion(t *testing.T) {
275276}
276277
277278func TestClusterExtensionInstallSuccessorVersion (t * testing.T ) {
279+ t .Skip ("Skipping tests related to upgrades" )
278280 t .Log ("When a cluster extension is installed from a catalog" )
279281 t .Log ("When resolving upgrade edges" )
280- clusterExtension , _ , extensionCatalog := testInit (t )
282+ clusterExtension , extensionCatalog := testInit (t )
281283 defer testCleanup (t , extensionCatalog , clusterExtension )
282284 defer getArtifactsOutput (t )
283285
0 commit comments