Uploaded image for project: 'OCP Technical Release Team'
  1. OCP Technical Release Team
  2. TRT-1518

Create test for restarted containers

XMLWordPrintable

    • Icon: Story Story
    • Resolution: Done
    • Icon: Normal Normal
    • None
    • None
    • None
    • None
    • False
    • Hide

      None

      Show
      None
    • False
    • None
    • None
    • None
    • None

      deads@fedora:~/workspaces/origin/src/github.com/openshift/origin$ git diff
      diff --git a/pkg/monitortests/node/watchpods/collection.go b/pkg/monitortests/node/watchpods/collection.go
      index 19b9c071df..e7ac1aa19d 100644
      — a/pkg/monitortests/node/watchpods/collection.go
      +++ b/pkg/monitortests/node/watchpods/collection.go
      @@ -296,6 +296,19 @@ func startPodMonitoring(ctx context.Context, recorderWriter monitorapi.RecorderW
                              }
       
                              if containerStatus.RestartCount != oldContainerStatus.RestartCount {
      +                               if containerStatus.RestartCount > 3 {
      +                                       // david says fail
      +                                       whyItFailed := ""
      +                                       if containerStatus.State.Terminated != nil

      { +                                               whyItFailed = containerStatus.State.Terminated.Message +                                       }

      +                                       intervals = append(intervals, monitorapi.NewInterval(monitorapi.SourcePodMonitor, monitorapi.Error).
      +                                               Locator(monitorapi.NewLocator().ContainerFromPod(pod, containerName)).
      +                                               Message(
      +                                                       monitorapi.NewMessage().Reason(monitorapi.ContainerReasonRestarted).HumanMessage(whyItFailed),
      +                                               ).BuildNow())
      +                               }
      +
                                      intervals = append(intervals, monitorapi.NewInterval(monitorapi.SourcePodMonitor, monitorapi.Warning).
                                              Locator(monitorapi.NewLocator().ContainerFromPod(pod, containerName)).
                                              Message(
      diff --git a/pkg/monitortests/node/watchpods/monitortest.go b/pkg/monitortests/node/watchpods/monitortest.go
      index 5f85f96b26..98d00cd746 100644
      — a/pkg/monitortests/node/watchpods/monitortest.go
      +++ b/pkg/monitortests/node/watchpods/monitortest.go
      @@ -44,7 +44,8 @@ func (*podWatcher) ConstructComputedIntervals(ctx context.Context, startingInter
       }
       
       func (*podWatcher) EvaluateTestsFromConstructedIntervals(ctx context.Context, finalIntervals monitorapi.Intervals) ([]*junitapi.JUnitTestCase, error)

      { -       return nil, nil +       junit = append(junit, failIfRestartCountTooHighFound(startingIntervals, beginning, end)...) +       return junit, nil  }

       
       func (*podWatcher) WriteContentToStorage(ctx context.Context, storageDir, timeSuffix string, finalIntervals monitorapi.Intervals, finalResourceState monitorapi.ResourcesMap) error {

              Unassigned Unassigned
              deads@redhat.com David Eads
              None
              None
              None
              None
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: