|
5 | 5 | "fmt" |
6 | 6 | "os" |
7 | 7 | "path/filepath" |
| 8 | + "strings" |
8 | 9 | "time" |
9 | 10 |
|
10 | 11 | "github.com/openshift/origin/pkg/monitortestframework" |
@@ -43,6 +44,7 @@ func snapshotOcAdmUpgradeStatus(ch chan *snapshot) { |
43 | 44 | // how to do pass that to exutil.NewCLI* or if it is even possible. It seems to work this way though. |
44 | 45 | oc := exutil.NewCLIWithoutNamespace("adm-upgrade-status").AsAdmin() |
45 | 46 | now := time.Now() |
| 47 | + // TODO: Consider retrying on brief apiserver unavailability |
46 | 48 | cmd := oc.Run("adm", "upgrade", "status").EnvVar("OC_ENABLE_CMD_UPGRADE_STATUS", "true") |
47 | 49 | out, err := cmd.Output() |
48 | 50 | ch <- &snapshot{when: now, out: out, err: err} |
@@ -77,7 +79,29 @@ func (w *monitor) CollectData(ctx context.Context, storageDir string, beginning, |
77 | 79 | // The framework cancels the context it gave StartCollection before it calls CollectData, but we need to wait for |
78 | 80 | // the collection goroutines spawned in StartedCollection to finish |
79 | 81 | <-w.collectionDone |
80 | | - return nil, nil, nil |
| 82 | + |
| 83 | + noFailures := &junitapi.JUnitTestCase{ |
| 84 | + Name: "[sig-cli][OCPFeatureGate:UpgradeStatus] oc amd upgrade status never fails", |
| 85 | + } |
| 86 | + |
| 87 | + var failures []string |
| 88 | + for when, observed := range w.ocAdmUpgradeStatus { |
| 89 | + if observed.err != nil { |
| 90 | + failures = append(failures, fmt.Sprintf("- %s: %v", when.Format(time.RFC3339), observed.err)) |
| 91 | + } |
| 92 | + } |
| 93 | + |
| 94 | + // TODO: Zero failures is too strict for at least SNO clusters |
| 95 | + if len(failures) > 0 { |
| 96 | + noFailures.FailureOutput = &junitapi.FailureOutput{ |
| 97 | + Message: fmt.Sprintf("oc adm upgrade status failed %d times (of %d)", len(failures), len(w.ocAdmUpgradeStatus)), |
| 98 | + Output: strings.Join(failures, "\n"), |
| 99 | + } |
| 100 | + } |
| 101 | + |
| 102 | + // TODO: Maybe utilize Intervals somehow and do tests in ComputeComputedIntervals and EvaluateTestsFromConstructedIntervals |
| 103 | + |
| 104 | + return nil, []*junitapi.JUnitTestCase{noFailures}, nil |
81 | 105 | } |
82 | 106 |
|
83 | 107 | func (*monitor) ConstructComputedIntervals(ctx context.Context, startingIntervals monitorapi.Intervals, recordedResources monitorapi.ResourcesMap, beginning, end time.Time) (monitorapi.Intervals, error) { |
|
0 commit comments