Skip to content

Commit

Permalink
[OSSM-6761] Use the correct Operator version (not SMCP version) (#701)
Browse files Browse the repository at this point in the history
* Use Operator version env to determine against which operator the tests are running
  • Loading branch information
mkralik3 authored Jul 1, 2024
1 parent 3674da7 commit 1bac8c8
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 12 deletions.
4 changes: 2 additions & 2 deletions pkg/tests/ossm/smm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ func TestSMMReconciliation(t *testing.T) {
t.Log("This test verifies whether the member-of label is added back to the namespace")
t.Log("See https://issues.redhat.com/browse/OSSM-1397")

if !env.GetSMCPVersion().Equals(env.GetOperatorVersion()) {
t.Skip("Skipped because This test case is only needed to be tested when the SMCP version is the latest version available in the Operator")
if !(env.GetSMCPVersion().Equals(env.GetOperatorVersion())) {
t.Skipf("Skipped because This test case is only needed to be tested when the SMCP version is the latest version available in the Operator. Operator version: %s SMCP version: %s", env.GetOperatorVersion(), env.GetSMCPVersion())
}

t.Cleanup(func() {
Expand Down
18 changes: 10 additions & 8 deletions pkg/tests/ossm/smoke_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,11 @@ func TestSmoke(t *testing.T) {
oc.RestartAllPodsAndWaitReady(t, ns)

checkSMCP(t, ns)

t.LogStep("Check that previous version CNI resources were pruned and needed resources were preserved")
t.Log("Related issue: https://issues.redhat.com/browse/OSSM-2101")
assertResourcesPruneUpgrade(t, fromVersion, toVersion)
if env.GetOperatorVersion().GreaterThanOrEqual(version.OPERATOR_2_6_0) {
t.LogStep("Check that previous version CNI resources were pruned and needed resources were preserved")
t.Log("Related issue: https://issues.redhat.com/browse/OSSM-2101")
assertResourcesPruneUpgrade(t, fromVersion, toVersion)
}
})

t.NewSubTest(fmt.Sprintf("install smcp %s", toVersion)).Run(func(t TestHelper) {
Expand Down Expand Up @@ -123,10 +124,11 @@ func TestSmoke(t *testing.T) {
"SMCP resources are deleted",
"Still waiting for resources to be deleted from namespace"))
})

t.LogStep("Check that CNI resources were pruned")
t.Log("Related issue: https://issues.redhat.com/browse/OSSM-2101")
assertResourcePruneDelete(t, toVersion)
if env.GetOperatorVersion().GreaterThanOrEqual(version.OPERATOR_2_6_0) {
t.LogStep("Check that CNI resources were pruned")
t.Log("Related issue: https://issues.redhat.com/browse/OSSM-2101")
assertResourcePruneDelete(t, toVersion)
}
})

})
Expand Down
2 changes: 1 addition & 1 deletion pkg/util/env/env.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func GetSMCPVersion() version.Version {
}

func GetOperatorVersion() version.Version {
return version.ParseVersion(getenv("OPERATOR_VERSION", "v2.6"))
return version.ParseVersion(getenv("OPERATOR_VERSION", "2.6.0"))
}

func GetArch() string {
Expand Down
6 changes: 6 additions & 0 deletions pkg/util/version/operator_version.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package version

var (
OPERATOR_2_5_2 = ParseVersion("2.5.2")
OPERATOR_2_6_0 = ParseVersion("2.6.0")
)
2 changes: 1 addition & 1 deletion scripts/runtests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ main() {

if [ -z "$SMCP_VERSION" ]; then
for ver in "${SUPPORTED_VERSIONS[@]}"; do
export OPERATOR_VERSION="$ver"
export OPERATOR_VERSION="$OPERATOR_VERSION"
export SMCP_VERSION="$ver"
export OUTPUT_DIR="${OUTPUT_DIR_BASE}/${SMCP_VERSION}" # also used in env.GetOutputDir(), so must be exported
export LOG_FILE="$OUTPUT_DIR/output.log"
Expand Down

0 comments on commit 1bac8c8

Please sign in to comment.