Skip to content

Commit

Permalink
Adding skip test when the SMCP it's not the latest (#640)
Browse files Browse the repository at this point in the history
* Adding skip test when the SMCP it's not the latest

improve skip test if is not executed against the latest SMCP version

* Delete non used func
  • Loading branch information
fjglira authored Jan 12, 2024
1 parent e768b2b commit dd9d291
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pkg/tests/ossm/smm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"testing"

"github.com/maistra/maistra-test-tool/pkg/util/check/assert"
"github.com/maistra/maistra-test-tool/pkg/util/env"
"github.com/maistra/maistra-test-tool/pkg/util/ns"
"github.com/maistra/maistra-test-tool/pkg/util/oc"
"github.com/maistra/maistra-test-tool/pkg/util/retry"
Expand Down Expand Up @@ -89,6 +90,10 @@ 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")
}

t.Cleanup(func() {
oc.RecreateNamespace(t, meshNamespace)
})
Expand Down
4 changes: 4 additions & 0 deletions pkg/util/env/env.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ func GetSMCPVersion() version.Version {
return version.ParseVersion(getenv("SMCP_VERSION", "v2.5"))
}

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

func GetArch() string {
return getenv("OCP_ARCH", "x86")
}
Expand Down
1 change: 1 addition & 0 deletions scripts/runtests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ main() {

if [ -z "$SMCP_VERSION" ]; then
for ver in "${SUPPORTED_VERSIONS[@]}"; do
export OPERATOR_VERSION="$ver"
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 dd9d291

Please sign in to comment.