Skip to content

Commit

Permalink
fix(test): add apache-snapshot catalog as the test may run agains a c…
Browse files Browse the repository at this point in the history
…amel-k-runtime snaphost release
  • Loading branch information
claudio4j authored and squakez committed Feb 8, 2024
1 parent 5d28e26 commit 4093bf4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pkg/controller/integrationplatform/catalog.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
8 changes: 6 additions & 2 deletions pkg/controller/integrationplatform/catalog_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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:")
}

0 comments on commit 4093bf4

Please sign in to comment.