diff --git a/test/e2e/e2e_test.go b/test/e2e/e2e_test.go index 67131b1465b..012a982db4b 100644 --- a/test/e2e/e2e_test.go +++ b/test/e2e/e2e_test.go @@ -42,7 +42,6 @@ import ( "k8s.io/kubernetes/test/e2e/framework/testfiles" e2etestingmanifests "k8s.io/kubernetes/test/e2e/testing-manifests" testfixtures "k8s.io/kubernetes/test/fixtures" - "k8s.io/kubernetes/test/utils/image" // test sources _ "k8s.io/kubernetes/test/e2e/apimachinery" @@ -83,16 +82,11 @@ func handleFlags() { func TestMain(m *testing.M) { var versionFlag bool flag.CommandLine.BoolVar(&versionFlag, "version", false, "Displays version information.") + listConformanceTests := flag.CommandLine.Bool("list-conformance-tests", false, "If true, will show list of conformance tests.") // Register test flags, then parse flags. handleFlags() - if framework.TestContext.ListImages { - for _, v := range image.GetImageConfigs() { - fmt.Println(v.GetE2EImage()) - } - os.Exit(0) - } if versionFlag { fmt.Printf("%s\n", version.Get()) os.Exit(0) @@ -103,7 +97,7 @@ func TestMain(m *testing.M) { testfiles.AddFileSource(testfixtures.GetTestFixturesFS()) testfiles.AddFileSource(conformancetestdata.GetConformanceTestdataFS()) - if framework.TestContext.ListConformanceTests { + if *listConformanceTests { var tests []struct { Testname string `yaml:"testname"` Codename string `yaml:"codename"` diff --git a/test/e2e/framework/test_context.go b/test/e2e/framework/test_context.go index 04c4c03fe02..4e53791daae 100644 --- a/test/e2e/framework/test_context.go +++ b/test/e2e/framework/test_context.go @@ -41,6 +41,7 @@ import ( kubeletconfig "k8s.io/kubernetes/pkg/kubelet/apis/config" "k8s.io/kubernetes/test/e2e/framework/internal/junit" + "k8s.io/kubernetes/test/utils/image" "k8s.io/kubernetes/test/utils/kubeconfig" ) @@ -345,7 +346,6 @@ func RegisterCommonFlags(flags *flag.FlagSet) { flags.StringVar(&TestContext.NonblockingTaints, "non-blocking-taints", `node-role.kubernetes.io/control-plane,node-role.kubernetes.io/master`, "Nodes with taints in this comma-delimited list will not block the test framework from starting tests. The default taint 'node-role.kubernetes.io/master' is DEPRECATED and will be removed from the list in a future release.") flags.BoolVar(&TestContext.ListImages, "list-images", false, "If true, will show list of images used for running tests.") - flags.BoolVar(&TestContext.ListConformanceTests, "list-conformance-tests", false, "If true, will show list of conformance tests.") flags.StringVar(&TestContext.KubectlPath, "kubectl-path", "kubectl", "The kubectl binary to use. For development, you might use 'cluster/kubectl.sh' here.") flags.StringVar(&TestContext.ProgressReportURL, "progress-report-url", "", "The URL to POST progress updates to as the suite runs to assist in aiding integrations. If empty, no messages sent.") @@ -462,6 +462,13 @@ func AfterReadingAllFlags(t *TestContextType) { fs.Set("stderrthreshold", "10" /* higher than any of the severities -> none pass the threshold */) klog.SetOutput(ginkgo.GinkgoWriter) + if t.ListImages { + for _, v := range image.GetImageConfigs() { + fmt.Println(v.GetE2EImage()) + } + os.Exit(0) + } + // Only set a default host if one won't be supplied via kubeconfig if len(t.Host) == 0 && len(t.KubeConfig) == 0 { // Check if we can use the in-cluster config