-
Notifications
You must be signed in to change notification settings - Fork 545
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ensure the $ARTIFACT_DIR variable is respected #2721
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -455,5 +455,5 @@ apiserver.key | |
|
||
!vendor/** | ||
test/e2e-local.image.tar | ||
|
||
test/e2e/.kube | ||
dist/ |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,8 +42,9 @@ type TestContext struct { | |
e2eClient *util.E2EKubeClient | ||
ssaClient *controllerclient.ServerSideApplier | ||
|
||
kubeconfigPath string | ||
artifactsDir string | ||
kubeconfigPath string | ||
artifactsDir string | ||
artifactsScriptPath string | ||
|
||
scheme *runtime.Scheme | ||
|
||
|
@@ -132,8 +133,7 @@ func (ctx TestContext) DumpNamespaceArtifacts(namespace string) error { | |
"KUBECONFIG=" + kubeconfigPath, | ||
} | ||
|
||
// compiled test binary running e2e tests is run from the root ./bin directory | ||
cmd := exec.Command("../test/e2e/collect-ci-artifacts.sh") | ||
cmd := exec.Command(ctx.artifactsScriptPath) | ||
cmd.Env = append(cmd.Env, envvars...) | ||
cmd.Stdout = os.Stdout | ||
cmd.Stderr = os.Stderr | ||
|
@@ -153,6 +153,17 @@ func setDerivedFields(ctx *TestContext) error { | |
return fmt.Errorf("nil RESTClient") | ||
} | ||
|
||
if ctx.artifactsDir == "" { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could this poorly interact with some downstream only code: https://github.com/openshift/operator-framework-olm/blob/master/staging/operator-lifecycle-manager/test/e2e/e2e_test.go#L69? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should be in the clear there as we're building up the junit reporter for ginkgo vs. telling either of the provisioner implementation where to dump testing artifacts when configured. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also: we could bubble up that downstream-only change to make upstream backwards-compatible to eliminate any skew between implementations (which might be relevant for any effort around ginkgo v1 -> v2)? |
||
if artifactsDir := os.Getenv("ARTIFACT_DIR"); artifactsDir != "" { | ||
ctx.artifactsDir = artifactsDir | ||
} | ||
} | ||
if ctx.artifactsScriptPath == "" { | ||
if scriptPath := os.Getenv("E2E_ARTIFACT_SCRIPT"); scriptPath != "" { | ||
ctx.artifactsScriptPath = scriptPath | ||
} | ||
} | ||
|
||
kubeClient, err := operatorclient.NewClientFromRestConfig(ctx.restConfig) | ||
if err != nil { | ||
return err | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,6 +42,12 @@ var ( | |
"dummy image to treat as an operator in tests", | ||
) | ||
|
||
collectArtifactsScriptPath = flag.String( | ||
"gather-artifacts-script-path", | ||
"./collect-ci-artifacts.sh", | ||
"configures the relative/absolute path to the script resposible for collecting CI artifacts", | ||
) | ||
|
||
testdataPath = flag.String( | ||
"test-data-dir", | ||
"./testdata", | ||
|
@@ -79,6 +85,9 @@ var _ = BeforeSuite(func() { | |
// This flag can be deprecated in favor of the kubeconfig provisioner: | ||
os.Setenv("KUBECONFIG", *kubeConfigPath) | ||
} | ||
if collectArtifactsScriptPath != nil && *collectArtifactsScriptPath != "" { | ||
os.Setenv("E2E_ARTIFACT_SCRIPT", *collectArtifactsScriptPath) | ||
} | ||
|
||
Comment on lines
+88
to
91
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note: just a hack to inject state so the ctx package can derive where to find the artifacts bash script path location. |
||
testNamespace = *namespace | ||
operatorNamespace = *olmNamespace | ||
|
@@ -114,6 +123,7 @@ var _ = BeforeSuite(func() { | |
HaveLen(1), | ||
ContainElement(Not(BeZero())), | ||
)) | ||
|
||
_, err := fetchCatalogSourceOnStatus(ctx.Ctx().OperatorClient(), "operatorhubio-catalog", operatorNamespace, catalogSourceRegistryPodSynced) | ||
Expect(err).NotTo(HaveOccurred()) | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I ran into a sourcing issue when running the
make e2e
command locally as it's working directory points to ./test/e2e, so there's some skew between the working directory when using the kind or kubeconfig provisioners.