Add integration test for OCI registry mTLS #8569
Apologies for the delay in this PR, I was away and occupied with other commitments, which took me longer than expected to get back to this. I'll make an effort to stay more engaged with the project and contribute more consistently going forward.
This doesn't check if the happy-path deletion worked. deleteChart only logs on failure, so a problem in the uninstall finalizer wouldn't fail the test. testSecretBasedAuth uses Require() for both the delete and the wait for the Chart to disappear.
What about doing the in-line delete and wait with Require, and keep the Cleanup registration as the best-effort fallback for failure paths?
waitForTestRelease treats a non-empty Status.Error as "not ready yet" and keeps waiting, so a broken mTLS path would result as a suite timeout with the real error buried somewhere in the logs. An mTLS pull has nothing to wait on, so a first-attempt error is already a genuine failure here. testChartOrdering has the strict watch variant that fails on the first Status.Error, which would give a faster and clearer failure here.
Getting the ID here is just done to pass it to docker rm and docker port later on, but the name is already unique. Moreover, if inspect fails, the container leaks because the Cleanup is registered after it. Registering the removal by name right after docker run and dropping the inspect would be simpler and slightly more robust.
This works, but reads a bit awkward.
What about removing the strings.Contains and changing the statement inside the if like so:
as.Require().Containsf(out, "No such container", failed to remove stale mTLS registry container: %v", err)
This looks like it repeats quite a bit from issueServerCertsWithSelfSignedCA. Might be worth refactoring them into a helper for CA + signer + server cert. The mTLS variant could add the client profile and the client cert on top.
Isn't this pushChartToLocalRegistry with one push option swapped? What about having a single pushChart(hostPort int, opts ...action.PushOpt)?
Assertion messages read best when they state the expectation, e.g. "mTLS registry should start" rather than the failure, and the log lines in the cleanups should be capitalized like the rest of the file ("Failed to remove ...").
Apologies for the delay in this PR, I was away and occupied with other commitments, which took me longer than expected to get back to this. I'll make an effort to stay more engaged with the project and contribute more consistently going forward.
No worries at all! Thanks for picking this up, once again!
Fair point.
I kept them separate to avoid touching the self-signed path, but a shared helper makes sense.
Yeah the two are almost identical. I'll collapse them into one pusChart.
Returning the error here aborts the poll on transient errors. You already have the log line above, so what about just returning nil here and retry?
You need to rebase, once again, to pick up the CI fix for the lint job 🙏
Fixed, thanks
Thank you!
twz123
DeeBi9
Description
Follow-up to PR #6888, where integration test coverage for the new mTLS support when pulling Helm charts from OCI registries was discussed.
No production code or documentation changes are included; this is test-only coverage.
Closes #8562
<!--
Summarize your changes. Give context, mention alternatives considered, and what is
deliberately left out. It must not contradict the commit messages. When you rewrite
commits after a review round, re-read this description and update it, too.
Use "Fixes #N" only if this pull request resolves an issue. Otherwise, use "See #N".
-->
Type of change
How has this been tested?
<!-- Describe what was verified, and how. Provide instructions so we can reproduce. -->
Verified locally with:
go test ./inttest/addons -run '^TestAddonsSuite$' -count=1 -vChecklist