@@ -16,12 +16,6 @@ import (
1616 configv1 "github.com/openshift/api/config/v1"
1717 configclient "github.com/openshift/client-go/config/clientset/versioned"
1818 "github.com/openshift/library-go/pkg/operator/resource/resourceread"
19- "github.com/openshift/origin/pkg/monitor/backenddisruption"
20- "github.com/openshift/origin/pkg/monitor/monitorapi"
21- "github.com/openshift/origin/pkg/monitortestlibrary/disruptionlibrary"
22- "github.com/openshift/origin/pkg/test/ginkgo/junitapi"
23- exutil "github.com/openshift/origin/test/extended/util"
24- "github.com/openshift/origin/test/extended/util/image"
2519 corev1 "k8s.io/api/core/v1"
2620 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2721 utilnet "k8s.io/apimachinery/pkg/util/net"
@@ -30,6 +24,13 @@ import (
3024 "k8s.io/client-go/rest"
3125 "k8s.io/kubernetes/test/e2e/framework/service"
3226 k8simage "k8s.io/kubernetes/test/utils/image"
27+
28+ "github.com/openshift/origin/pkg/monitor/backenddisruption"
29+ "github.com/openshift/origin/pkg/monitor/monitorapi"
30+ "github.com/openshift/origin/pkg/monitortestlibrary/disruptionlibrary"
31+ "github.com/openshift/origin/pkg/test/ginkgo/junitapi"
32+ exutil "github.com/openshift/origin/test/extended/util"
33+ "github.com/openshift/origin/test/extended/util/image"
3334)
3435
3536var (
@@ -52,7 +53,7 @@ func init() {
5253
5354type availability struct {
5455 namespaceName string
55- notSupportedReason string
56+ notSupportedReason * monitortestframework. NotSupportedError
5657 kubeClient kubernetes.Interface
5758
5859 disruptionChecker * disruptionlibrary.Availability
@@ -81,8 +82,8 @@ func (w *availability) StartCollection(ctx context.Context, adminRESTConfig *res
8182 return fmt .Errorf ("unable to determine if cluster is MicroShift: %v" , err )
8283 }
8384 if isMicroShift {
84- w .notSupportedReason = "platform MicroShift not supported"
85- return nil
85+ w .notSupportedReason = & monitortestframework. NotSupportedError { Reason : "platform MicroShift not supported" }
86+ return w . notSupportedReason
8687 }
8788
8889 configClient , err := configclient .NewForConfig (adminRESTConfig )
@@ -104,21 +105,27 @@ func (w *availability) StartCollection(ctx context.Context, adminRESTConfig *res
104105 infra .Status .PlatformStatus .Type == configv1 .BareMetalPlatformType ||
105106 infra .Status .PlatformStatus .Type == configv1 .OpenStackPlatformType ||
106107 infra .Status .PlatformStatus .Type == configv1 .NonePlatformType {
107- w .notSupportedReason = fmt .Sprintf ("platform %q is not supported" , infra .Status .PlatformStatus .Type )
108+ w .notSupportedReason = & monitortestframework.NotSupportedError {
109+ Reason : fmt .Sprintf ("platform %q is not supported" , infra .Status .PlatformStatus .Type ),
110+ }
108111 }
109112 // single node clusters are not supported because the replication controller has 2 replicas with anti-affinity for running on the same node.
110113 if infra .Status .ControlPlaneTopology == configv1 .SingleReplicaTopologyMode {
111- w .notSupportedReason = fmt .Sprintf ("topology %q is not supported" , infra .Status .ControlPlaneTopology )
114+ w .notSupportedReason = & monitortestframework.NotSupportedError {
115+ Reason : fmt .Sprintf ("topology %q is not supported" , infra .Status .ControlPlaneTopology ),
116+ }
112117 }
113118 nodeList , err := w .kubeClient .CoreV1 ().Nodes ().List (ctx , metav1.ListOptions {})
114119 if err != nil {
115120 return err
116121 }
117122 if len (nodeList .Items ) < 2 {
118- w .notSupportedReason = fmt .Sprintf ("insufficient nodes for service load balancers" )
123+ w .notSupportedReason = & monitortestframework.NotSupportedError {
124+ Reason : fmt .Sprintf ("insufficient nodes for service load balancers" ),
125+ }
119126 }
120- if len ( w .notSupportedReason ) > 0 {
121- return nil
127+ if w .notSupportedReason != nil {
128+ return w . notSupportedReason
122129 }
123130
124131 actualNamespace , err := w .kubeClient .CoreV1 ().Namespaces ().Create (context .Background (), namespace , metav1.CreateOptions {})
@@ -231,8 +238,8 @@ func (w *availability) StartCollection(ctx context.Context, adminRESTConfig *res
231238}
232239
233240func (w * availability ) CollectData (ctx context.Context , storageDir string , beginning , end time.Time ) (monitorapi.Intervals , []* junitapi.JUnitTestCase , error ) {
234- if len ( w .notSupportedReason ) > 0 {
235- return nil , nil , nil
241+ if w .notSupportedReason != nil {
242+ return nil , nil , w . notSupportedReason
236243 }
237244 // we failed and indicated it during setup.
238245 if w .disruptionChecker == nil {
@@ -242,13 +249,13 @@ func (w *availability) CollectData(ctx context.Context, storageDir string, begin
242249 return w .disruptionChecker .CollectData (ctx )
243250}
244251
245- func (* availability ) ConstructComputedIntervals (ctx context.Context , startingIntervals monitorapi.Intervals , recordedResources monitorapi.ResourcesMap , beginning , end time.Time ) (monitorapi.Intervals , error ) {
246- return nil , nil
252+ func (w * availability ) ConstructComputedIntervals (ctx context.Context , startingIntervals monitorapi.Intervals , recordedResources monitorapi.ResourcesMap , beginning , end time.Time ) (monitorapi.Intervals , error ) {
253+ return nil , w . notSupportedReason
247254}
248255
249256func (w * availability ) EvaluateTestsFromConstructedIntervals (ctx context.Context , finalIntervals monitorapi.Intervals ) ([]* junitapi.JUnitTestCase , error ) {
250- if len ( w .notSupportedReason ) > 0 {
251- return nil , nil
257+ if w .notSupportedReason != nil {
258+ return nil , w . notSupportedReason
252259 }
253260 if w .suppressJunit {
254261 return nil , nil
@@ -261,8 +268,8 @@ func (w *availability) EvaluateTestsFromConstructedIntervals(ctx context.Context
261268 return w .disruptionChecker .EvaluateTestsFromConstructedIntervals (ctx , finalIntervals )
262269}
263270
264- func (* availability ) WriteContentToStorage (ctx context.Context , storageDir , timeSuffix string , finalIntervals monitorapi.Intervals , finalResourceState monitorapi.ResourcesMap ) error {
265- return nil
271+ func (w * availability ) WriteContentToStorage (ctx context.Context , storageDir , timeSuffix string , finalIntervals monitorapi.Intervals , finalResourceState monitorapi.ResourcesMap ) error {
272+ return w . notSupportedReason
266273}
267274
268275func (w * availability ) Cleanup (ctx context.Context ) error {
0 commit comments