Skip to content

Commit 3764b28

Browse files
committed
Lower the bar of success for SNO
1 parent 57b45b4 commit 3764b28

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

pkg/monitortests/cli/adm_upgrade/status/monitortest.go

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,16 @@ import (
88
"strings"
99
"time"
1010

11+
clientconfigv1 "github.com/openshift/client-go/config/clientset/versioned"
1112
"github.com/openshift/origin/pkg/monitortestframework"
1213
exutil "github.com/openshift/origin/test/extended/util"
1314
"k8s.io/apimachinery/pkg/util/errors"
1415
"k8s.io/apimachinery/pkg/util/wait"
1516
"k8s.io/client-go/kubernetes"
17+
"k8s.io/client-go/rest"
1618

1719
"github.com/openshift/origin/pkg/monitor/monitorapi"
1820
"github.com/openshift/origin/pkg/test/ginkgo/junitapi"
19-
"k8s.io/client-go/rest"
2021
)
2122

2223
type snapshot struct {
@@ -28,6 +29,7 @@ type monitor struct {
2829
collectionDone chan struct{}
2930
ocAdmUpgradeStatus map[time.Time]*snapshot
3031
notSupportedReason error
32+
isSNO bool
3133
}
3234

3335
func NewOcAdmUpgradeStatusChecker() monitortestframework.MonitorTest {
@@ -50,6 +52,16 @@ func (w *monitor) PrepareCollection(ctx context.Context, adminRESTConfig *rest.C
5052
w.notSupportedReason = &monitortestframework.NotSupportedError{Reason: "platform MicroShift not supported"}
5153
return w.notSupportedReason
5254
}
55+
clientconfigv1client, err := clientconfigv1.NewForConfig(adminRESTConfig)
56+
if err != nil {
57+
return err
58+
}
59+
60+
if ok, err := exutil.IsSingleNode(ctx, clientconfigv1client); err != nil {
61+
return fmt.Errorf("unable to determine if cluster is single node: %v", err)
62+
} else {
63+
w.isSNO = ok
64+
}
5365
return nil
5466
}
5567

@@ -115,14 +127,17 @@ func (w *monitor) CollectData(ctx context.Context, storageDir string, beginning,
115127
}
116128

117129
var failures []string
130+
var total int
118131
for when, observed := range w.ocAdmUpgradeStatus {
132+
total++
119133
if observed.err != nil {
120134
failures = append(failures, fmt.Sprintf("- %s: %v", when.Format(time.RFC3339), observed.err))
121135
}
122136
}
123137

124-
// TODO: Zero failures is too strict for at least SNO clusters
125-
if len(failures) > 0 {
138+
// Zero failures is too strict for at least SNO clusters
139+
p := (len(failures) / total) * 100
140+
if (!w.isSNO && p > 0) || (w.isSNO && p > 10) {
126141
noFailures.FailureOutput = &junitapi.FailureOutput{
127142
Message: fmt.Sprintf("oc adm upgrade status failed %d times (of %d)", len(failures), len(w.ocAdmUpgradeStatus)),
128143
Output: strings.Join(failures, "\n"),

0 commit comments

Comments
 (0)