Skip to content

Commit a270fa0

Browse files
committed
Force using mirrored images in disruption tests
1 parent 88b5c9e commit a270fa0

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

cmd/openshift-tests/openshift-tests.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@ import (
1414
"github.com/openshift/origin/pkg/cmd/openshift-tests/disruption"
1515
"github.com/openshift/origin/pkg/cmd/openshift-tests/images"
1616
"github.com/openshift/origin/pkg/cmd/openshift-tests/monitor"
17-
run2 "github.com/openshift/origin/pkg/cmd/openshift-tests/monitor/run"
17+
run_monitor "github.com/openshift/origin/pkg/cmd/openshift-tests/monitor/run"
1818
"github.com/openshift/origin/pkg/cmd/openshift-tests/monitor/timeline"
1919
risk_analysis "github.com/openshift/origin/pkg/cmd/openshift-tests/risk-analysis"
2020
"github.com/openshift/origin/pkg/cmd/openshift-tests/run"
2121
run_disruption "github.com/openshift/origin/pkg/cmd/openshift-tests/run-disruption"
2222
run_test "github.com/openshift/origin/pkg/cmd/openshift-tests/run-test"
2323
run_upgrade "github.com/openshift/origin/pkg/cmd/openshift-tests/run-upgrade"
24-
"github.com/openshift/origin/pkg/resourcewatch/cmd"
24+
run_resourcewatch "github.com/openshift/origin/pkg/resourcewatch/cmd"
2525
testginkgo "github.com/openshift/origin/pkg/test/ginkgo"
2626
exutil "github.com/openshift/origin/test/extended/util"
2727
"github.com/sirupsen/logrus"
@@ -79,11 +79,11 @@ func main() {
7979
images.NewImagesCommand(),
8080
run_test.NewRunTestCommand(ioStreams),
8181
dev.NewDevCommand(),
82-
run2.NewRunMonitorCommand(ioStreams),
82+
run_monitor.NewRunMonitorCommand(ioStreams),
8383
monitor.NewMonitorCommand(ioStreams),
8484
disruption.NewDisruptionCommand(ioStreams),
8585
risk_analysis.NewTestFailureRiskAnalysisCommand(),
86-
cmd.NewRunResourceWatchCommand(),
86+
run_resourcewatch.NewRunResourceWatchCommand(),
8787
timeline.NewTimelineCommand(ioStreams),
8888
run_disruption.NewRunInClusterDisruptionMonitorCommand(ioStreams),
8989
)

pkg/cmd/openshift-tests/monitor/run/run_monitor_command.go

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import (
1111

1212
"github.com/openshift/origin/pkg/monitortestframework"
1313

14-
"github.com/openshift/origin/pkg/clioptions/imagesetup"
1514
"github.com/openshift/origin/pkg/monitor/monitorapi"
1615
"github.com/openshift/origin/test/extended/util/image"
1716

@@ -30,6 +29,7 @@ type RunMonitorFlags struct {
3029
DisplayFromNow bool
3130
ExactMonitorTests []string
3231
DisableMonitorTests []string
32+
FromRepository string
3333

3434
genericclioptions.IOStreams
3535
}
@@ -89,6 +89,7 @@ func (f *RunMonitorFlags) BindFlags(flags *pflag.FlagSet) {
8989
flags.StringSliceVar(&f.ExactMonitorTests, "monitor", f.ExactMonitorTests,
9090
fmt.Sprintf("list of exactly which monitors to enable. All others will be disabled. Current monitors are: [%s]", strings.Join(monitorNames, ", ")))
9191
flags.StringSliceVar(&f.DisableMonitorTests, "disable-monitor", f.DisableMonitorTests, "list of monitors to disable. Defaults for others will be honored.")
92+
flags.StringVar(&f.FromRepository, "from-repository", f.FromRepository, "A container image repository to retrieve test images from.")
9293
}
9394

9495
func (f *RunMonitorFlags) ToOptions() (*RunMonitorOptions, error) {
@@ -113,6 +114,7 @@ func (f *RunMonitorFlags) ToOptions() (*RunMonitorOptions, error) {
113114
DisplayFilterFn: displayFilterFn,
114115
MonitorTests: monitorTestRegistry,
115116
IOStreams: f.IOStreams,
117+
FromRepository: f.FromRepository,
116118
}, nil
117119
}
118120

@@ -140,6 +142,7 @@ type RunMonitorOptions struct {
140142
ArtifactDir string
141143
DisplayFilterFn monitorapi.EventIntervalMatchesFunc
142144
MonitorTests monitortestframework.MonitorTestRegistry
145+
FromRepository string
143146

144147
genericclioptions.IOStreams
145148
}
@@ -148,9 +151,11 @@ type RunMonitorOptions struct {
148151
// events accumulated to Out. When the user hits CTRL+C or signals termination the
149152
// condition intervals (all non-instantaneous events) are reported to Out.
150153
func (o *RunMonitorOptions) Run() error {
154+
// set globals so that helpers will create pods with the mapped images if we create them from this process.
155+
image.InitializeImages(o.FromRepository)
156+
151157
fmt.Fprintf(o.Out, "Starting the monitor.\n")
152158

153-
image.InitializeImages(imagesetup.DefaultTestImageMirrorLocation)
154159
restConfig, err := monitor.GetMonitorRESTConfig()
155160
if err != nil {
156161
return err
@@ -176,12 +181,15 @@ func (o *RunMonitorOptions) Run() error {
176181
}()
177182
signal.Notify(abortCh, syscall.SIGINT, syscall.SIGTERM)
178183

184+
monitorTestInfo := monitortestframework.MonitorTestInitializationInfo{
185+
ClusterStabilityDuringTest: monitortestframework.Stable,
186+
}
179187
recorder := monitor.WrapWithJSONLRecorder(monitor.NewRecorder(), o.Out, o.DisplayFilterFn)
180188
m := monitor.NewMonitor(
181189
recorder,
182190
restConfig,
183191
o.ArtifactDir,
184-
o.MonitorTests,
192+
defaultmonitortests.NewMonitorTestsFor(monitorTestInfo),
185193
)
186194
if err := m.Start(ctx); err != nil {
187195
return err

0 commit comments

Comments
 (0)