// init initialize the extended testing suite. // You can set these environment variables to configure extended tests: // KUBECONFIG - Path to kubeconfig containing embedded authinfo // TEST_REPORT_DIR - If set, JUnit output will be written to this directory for each test // TEST_REPORT_FILE_NAME - If set, will determine the name of the file that JUnit output is written to func InitTest() { // Add hooks to skip all kubernetes or origin tests ginkgo.BeforeEach(checkSuiteSkips) e2e.RegisterCommonFlags() e2e.RegisterClusterFlags() extendedOutputDir := filepath.Join(os.TempDir(), "openshift-extended-tests") os.MkdirAll(extendedOutputDir, 0777) TestContext.DeleteNamespace = os.Getenv("DELETE_NAMESPACE") != "false" TestContext.VerifyServiceAccount = true TestContext.RepoRoot = os.Getenv("KUBE_REPO_ROOT") TestContext.KubeVolumeDir = os.Getenv("VOLUME_DIR") if len(TestContext.KubeVolumeDir) == 0 { TestContext.KubeVolumeDir = "/var/lib/origin/volumes" } TestContext.KubectlPath = "kubectl" TestContext.KubeConfig = KubeConfigPath() os.Setenv("KUBECONFIG", TestContext.KubeConfig) // load and set the host variable for kubectl clientConfig := clientcmd.NewNonInteractiveDeferredLoadingClientConfig(&clientcmd.ClientConfigLoadingRules{ExplicitPath: TestContext.KubeConfig}, &clientcmd.ConfigOverrides{}) cfg, err := clientConfig.ClientConfig() if err != nil { FatalErr(err) } TestContext.Host = cfg.Host reportDir = os.Getenv("TEST_REPORT_DIR") reportFileName = os.Getenv("TEST_REPORT_FILE_NAME") if reportFileName == "" { reportFileName = "junit" } quiet = os.Getenv("TEST_OUTPUT_QUIET") == "true" flag.StringVar(&TestContext.OutputDir, "extended-tests-output-dir", extendedOutputDir, "Output directory for interesting/useful test data, like performance data, benchmarks, and other metrics.") // Ensure that Kube tests run privileged (like they do upstream) TestContext.CreateTestingNS = createTestingNS }
func init() { framework.RegisterCommonFlags() framework.RegisterClusterFlags() }