Skip to content

Commit

Permalink
feat(trait): allow usage of semver for camel.runtime-version
Browse files Browse the repository at this point in the history
Closes #5311
  • Loading branch information
squakez committed Apr 5, 2024
1 parent 3757cac commit 0c47c3d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/trait/camel.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ func (t *camelTrait) Apply(e *Environment) error {
}
}

e.RuntimeVersion = t.RuntimeVersion
e.RuntimeVersion = e.CamelCatalog.Runtime.Version

if e.Integration != nil {
e.Integration.Status.RuntimeVersion = e.CamelCatalog.Runtime.Version
Expand Down
16 changes: 16 additions & 0 deletions pkg/trait/camel_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -230,3 +230,19 @@ func TestCamelMatches(t *testing.T) {
t2.RuntimeVersion = "3.2.1"
assert.False(t, t1.Matches(&t2))
}

func TestCamelCatalogSemver(t *testing.T) {
trait, environment := createNominalCamelTest(true)
trait.RuntimeVersion = "2.x"
environment.CamelCatalog.CamelCatalogSpec.Runtime.Version = "2.16.0"

configured, condition, err := trait.Configure(environment)
require.NoError(t, err)
assert.Nil(t, condition)
assert.True(t, configured)

err = trait.Apply(environment)
require.NoError(t, err)
// 2.x will translate with 2.16.0 as it is already existing
assert.Equal(t, environment.CamelCatalog.CamelCatalogSpec.Runtime.Version, environment.RuntimeVersion)
}

0 comments on commit 0c47c3d

Please sign in to comment.