diff --git a/pkg/monitortests/machines/watchmachines/machines.go b/pkg/monitortests/machines/watchmachines/machines.go index 35fe2235084e..7a67ce075190 100644 --- a/pkg/monitortests/machines/watchmachines/machines.go +++ b/pkg/monitortests/machines/watchmachines/machines.go @@ -41,10 +41,10 @@ func startMachineMonitoring(ctx context.Context, m monitorapi.RecorderWriter, cl newHasPhase := machine != nil && machine.Status.Phase != nil oldPhase := "" newPhase := "" - if oldHasPhase { + if oldHasPhase && *oldMachine.Status.Phase != "" { oldPhase = *oldMachine.Status.Phase } - if newHasPhase { + if newHasPhase && *machine.Status.Phase != "" { newPhase = *machine.Status.Phase } diff --git a/pkg/monitortests/machines/watchmachines/monitortest.go b/pkg/monitortests/machines/watchmachines/monitortest.go index e6ca1adc9e66..1d1a5b9f4592 100644 --- a/pkg/monitortests/machines/watchmachines/monitortest.go +++ b/pkg/monitortests/machines/watchmachines/monitortest.go @@ -3,9 +3,10 @@ package watchmachines import ( "context" "fmt" - machineClient "github.com/openshift/client-go/machine/clientset/versioned" "time" + machineClient "github.com/openshift/client-go/machine/clientset/versioned" + "github.com/openshift/origin/pkg/monitortestframework" "github.com/openshift/origin/pkg/monitor/monitorapi" @@ -72,16 +73,16 @@ func (*machineWatcher) ConstructComputedIntervals(ctx context.Context, startingI return eventInterval.Message.Reason == monitorapi.MachinePhaseChanged }) for _, phaseChange := range phaseChanges { - previousPhase := phaseChange.Message.Annotations[monitorapi.AnnotationPreviousPhase] + newPhase := phaseChange.Message.Annotations[monitorapi.AnnotationPhase] nodeName := phaseChange.Message.Annotations[monitorapi.AnnotationNode] constructedIntervals = append(constructedIntervals, monitorapi.NewInterval(monitorapi.SourceMachine, monitorapi.Info). Locator(phaseChange.Locator). Message(monitorapi.NewMessage().Reason(monitorapi.MachinePhase). Constructed(monitorapi.ConstructionOwnerMachineLifecycle). - WithAnnotation(monitorapi.AnnotationPhase, previousPhase). + WithAnnotation(monitorapi.AnnotationPhase, newPhase). WithAnnotation(monitorapi.AnnotationNode, nodeName). - HumanMessage(fmt.Sprintf("Machine is in %q", previousPhase))). + HumanMessage(fmt.Sprintf("Machine is in %q", newPhase))). Display(). Build(previousChangeTime, phaseChange.From), )