@@ -40,13 +40,16 @@ const (
4040 OsdClusterID = "CLUSTERID"
4141
4242 // Type of cluster test is run on
43- ClusterType = "CLUSTER_TYPE"
44- // OpenShift Dedicated Cluster
45- OsdCluster = "OSD"
46- // OpenShift Container Platform Cluster
47- OcpCluster = "OCP"
48- // ROSA Hosted Hypershift Cluster
49- HypershiftCluster = "HYPERSHIFT"
43+ ClusterTypeEnvVar = "CLUSTER_TYPE"
44+ )
45+
46+ type ClusterType string
47+
48+ const (
49+ OsdCluster ClusterType = "OSD"
50+ OcpCluster ClusterType = "OCP"
51+ HypershiftCluster ClusterType = "HYPERSHIFT"
52+ UndefinedCluster ClusterType = "UNDEFINED"
5053)
5154
5255func GetCodeFlareSDKVersion () string {
@@ -74,8 +77,23 @@ func GetOsdClusterId() (string, bool) {
7477 return os .LookupEnv (OsdClusterID )
7578}
7679
77- func GetClusterType () (string , bool ) {
78- return os .LookupEnv (ClusterType )
80+ func GetClusterType (t Test ) ClusterType {
81+ clusterType , ok := os .LookupEnv (ClusterTypeEnvVar )
82+ if ! ok {
83+ t .T ().Logf ("Expected environment variable %s not found, cluster type is not defined." , ClusterTypeEnvVar )
84+ return UndefinedCluster
85+ }
86+ switch clusterType {
87+ case "OSD" :
88+ return OsdCluster
89+ case "OCP" :
90+ return OcpCluster
91+ case "HYPERSHIFT" :
92+ return HypershiftCluster
93+ default :
94+ t .T ().Logf ("Expected environment variable %s contains unexpected value: '%s'" , ClusterTypeEnvVar , clusterType )
95+ return UndefinedCluster
96+ }
7997}
8098
8199func IsOsd () bool {
@@ -92,20 +110,3 @@ func lookupEnvOrDefault(key, value string) string {
92110 }
93111 return value
94112}
95-
96- func DetermineClusterType () string {
97- clusterType , ok := GetClusterType ()
98- if ! ok {
99- return ""
100- }
101- switch clusterType {
102- case "OSD" :
103- return OsdCluster
104- case "OCP" :
105- return OcpCluster
106- case "HYPERSHIFT" :
107- return HypershiftCluster
108- default :
109- return ""
110- }
111- }
0 commit comments