This is an automated email from the ASF dual-hosted git repository.

pcongiusti pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-k.git


The following commit(s) were added to refs/heads/main by this push:
     new 4093bf4cc fix(test): add apache-snapshot catalog as the test may run 
agains a camel-k-runtime snaphost release
4093bf4cc is described below

commit 4093bf4cc97a483e2c64162559b810c10d587548
Author: Claudio Miranda <clau...@claudius.com.br>
AuthorDate: Wed Feb 7 18:19:12 2024 +0000

    fix(test): add apache-snapshot catalog as the test may run agains a 
camel-k-runtime snaphost release
---
 pkg/controller/integrationplatform/catalog.go      | 2 +-
 pkg/controller/integrationplatform/catalog_test.go | 8 ++++++--
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/pkg/controller/integrationplatform/catalog.go 
b/pkg/controller/integrationplatform/catalog.go
index 91ab24c68..7be5aabb5 100644
--- a/pkg/controller/integrationplatform/catalog.go
+++ b/pkg/controller/integrationplatform/catalog.go
@@ -65,7 +65,7 @@ func (action *catalogAction) Handle(ctx context.Context, 
platform *v1.Integratio
                                
v1.IntegrationPlatformConditionCamelCatalogAvailable,
                                corev1.ConditionFalse,
                                
v1.IntegrationPlatformConditionCamelCatalogAvailableReason,
-                               fmt.Sprintf("camel catalog %s not available, 
please review given runtime version", runtimeSpec.Version))
+                               fmt.Sprintf("camel catalog %s not available, 
please review given runtime version. Error: %s", runtimeSpec.Version, err))
 
                        return platform, nil
                }
diff --git a/pkg/controller/integrationplatform/catalog_test.go 
b/pkg/controller/integrationplatform/catalog_test.go
index e005f0e89..a6a8f0b8e 100644
--- a/pkg/controller/integrationplatform/catalog_test.go
+++ b/pkg/controller/integrationplatform/catalog_test.go
@@ -30,6 +30,7 @@ import (
        "github.com/apache/camel-k/v2/pkg/resources"
        "github.com/apache/camel-k/v2/pkg/util/defaults"
        "github.com/apache/camel-k/v2/pkg/util/log"
+       "github.com/apache/camel-k/v2/pkg/util/maven"
        "github.com/apache/camel-k/v2/pkg/util/test"
        "github.com/rs/xid"
        "github.com/stretchr/testify/assert"
@@ -81,6 +82,9 @@ func TestCreateCatalog(t *testing.T) {
 
        ip.Status.Phase = v1.IntegrationPlatformPhaseCreateCatalog
        ip.Spec.Build.RuntimeVersion = defaults.DefaultRuntimeVersion
+       if strings.Contains(ip.Spec.Build.RuntimeVersion, "SNAPSHOT") {
+               maven.DefaultMavenRepositories = 
"https://repo.maven.apache.org/maven2@id=central,https://repository.apache.org/content/repositories/snapshots-group@snapshots@id=apache-snapshots";
+       }
 
        c, err := test.NewFakeClient(&ip)
        assert.Nil(t, err)
@@ -112,7 +116,7 @@ func TestCreateCatalog(t *testing.T) {
        assert.Nil(t, err)
        assert.NotNil(t, answer)
 
-       assert.Equal(t, v1.IntegrationPlatformPhaseReady, answer.Status.Phase)
+       assert.Equal(t, v1.IntegrationPlatformPhaseReady, answer.Status.Phase, 
"Error", answer.Status.Conditions[0].Message)
        assert.Equal(t, corev1.ConditionTrue, 
answer.Status.GetCondition(v1.IntegrationPlatformConditionCamelCatalogAvailable).Status)
 
        list := v1.NewCamelCatalogList()
@@ -218,5 +222,5 @@ func TestCreateCatalogError(t *testing.T) {
        assert.Equal(t, v1.IntegrationPlatformPhaseError, answer.Status.Phase)
        assert.Equal(t, corev1.ConditionFalse, 
answer.Status.GetCondition(v1.IntegrationPlatformConditionCamelCatalogAvailable).Status)
        assert.Equal(t, 
v1.IntegrationPlatformConditionCamelCatalogAvailableReason, 
answer.Status.GetCondition(v1.IntegrationPlatformConditionCamelCatalogAvailable).Reason)
-       assert.Equal(t, "camel catalog 0.0.0 not available, please review given 
runtime version", 
answer.Status.GetCondition(v1.IntegrationPlatformConditionCamelCatalogAvailable).Message)
+       assert.Contains(t, 
answer.Status.GetCondition(v1.IntegrationPlatformConditionCamelCatalogAvailable).Message,
 "camel catalog 0.0.0 not available, please review given runtime version. 
Error:")
 }

Reply via email to