Skip to content

Commit 497a5cc

Browse files
committed
skip test if not OSD
1 parent 3bdd35c commit 497a5cc

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

test/e2e/instascale_machinepool_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ func TestInstascaleMachinePool(t *testing.T) {
3333
test := With(t)
3434
test.T().Parallel()
3535

36+
if !IsOsd() {
37+
test.T().Skip("Skipping test as not running on an OSD cluster")
38+
}
39+
3640
namespace := test.NewTestNamespace()
3741

3842
// Test configuration

test/support/codeflare.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ limitations under the License.
1717
package support
1818

1919
import (
20+
"fmt"
2021
"os"
22+
"strconv"
2123
)
2224

2325
const (
@@ -38,6 +40,8 @@ const (
3840
InstaScaleOcmSecretNamespace = "INSTASCALE_OCM_SECRET_NAMESPACE"
3941
// Cluster ID for OSD cluster used in tests, used for testing InstaScale
4042
OsdClusterID = "CLUSTERID"
43+
// Determine if test is being run on an OSD cluster, used for testing InstaScale.
44+
IsOSD = "IS_OSD"
4145
)
4246

4347
func GetCodeFlareSDKVersion() string {
@@ -68,6 +72,16 @@ func GetOsdClusterId() (string, bool) {
6872
return os.LookupEnv(OsdClusterID)
6973
}
7074

75+
func IsOsd() bool {
76+
env := lookupEnvOrDefault(IsOSD, "false")
77+
osd, err := strconv.ParseBool(env)
78+
if err != nil {
79+
fmt.Errorf("error parsing IS_OSD variable, error: %v ", err)
80+
return false
81+
}
82+
return osd
83+
}
84+
7185
func lookupEnvOrDefault(key, value string) string {
7286
if v, ok := os.LookupEnv(key); ok {
7387
return v

0 commit comments

Comments
 (0)