tests: Make use of tests/libsecret
What this PR does
Change tests that involve defining simple Secret objects to use tests/libsecret package
Affected test suites:
- compute/credentials.go
- storage/export.go
- virtctl/credentials.go
- vmi_configuration_test.gp
- vmi_lifecycle_test.go
Before this PR:
E2E tests created the secret in-line, some added the kubevirt.io/secret label and some dont.
After this PR: E2E tests create the secret object using libsecret, all tests use the same expected configuration.
Fixes #
Why we need it and why it was done in this way
The following tradeoffs were made:
The following alternatives were considered:
Links to places where the discussion took place:
Special notes for your reviewer
The global test suite deletes cleanup that runs after each test delete secrets who has kubevirt.io/secret label.
It is not clear why this filtering is necessary, therefore we should revisit it and maybe remove the filtering so that all secrets in Kubevirt tests namespaces will get deleted by the global tests suite clean up.
Checklist
This checklist is not enforcing, but it's a reminder of items that could be relevant to every PR. Approvers are expected to review this list.
- [ ] Design: A design document was considered and is present (link) or not required
- [ ] PR: The PR description is expressive enough and will help future contributors
- [ ] Code: Write code that humans can understand and Keep it simple
- [ ] Refactor: You have left the code cleaner than you found it (Boy Scout Rule)
- [ ] Upgrade: Impact of this change on upgrade flows was considered and addressed if required
- [ ] Testing: New code requires new unit tests. New features and bug fixes require at least on e2e test
- [ ] Documentation: A user-guide update was considered and is present (link) or not required. You want a user-guide update if it's a user facing feature / API change.
- [ ] Community: Announcement to kubevirt-dev was considered
Release note
NONE
/hold Based on https://github.com/kubevirt/kubevirt/pull/11545. Wait until it is merged
/sig code-quality
rebased
https://github.com/kubevirt/kubevirt/pull/11545 is merged
/unhold
sig-storage passed but it seems to failed on teardown https://prow.ci.kubevirt.io/view/gs/kubevirt-prow/pr-logs/pull/kubevirt_kubevirt/11547/pull-kubevirt-e2e-k8s-1.29-sig-storage/1783101831979732992#1:build-log.txt%3A4576-4580
/test pull-kubevirt-e2e-k8s-1.29-sig-storage /test pull-kubevirt-e2e-k8s-1.29-sig-compute
It looks good. I think including the generalization I sent will be a good addition to this change. And it will be better to include it here over going again over all the callers and change them later.
I think we can do it as a follow up, lets not block this PR on it.
Rebased
Changes: Rebased on #11854
Changes: Change tests to use libsecret.StringData{} and libsecret.Data{}
Rebased
[APPROVALNOTIFIER] This PR is APPROVED
This pull-request has been approved by: enp0s3
The full list of commands accepted by this bot can be found here.
The pull request process is described here
- ~~tests/OWNERS~~ [enp0s3]
Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment
Required labels detected, running phase 2 presubmits: /test pull-kubevirt-e2e-windows2016 /test pull-kubevirt-e2e-kind-sriov /test pull-kubevirt-e2e-k8s-1.30-ipv6-sig-network /test pull-kubevirt-e2e-k8s-1.28-sig-network /test pull-kubevirt-e2e-k8s-1.28-sig-storage /test pull-kubevirt-e2e-k8s-1.28-sig-compute /test pull-kubevirt-e2e-k8s-1.28-sig-operator /test pull-kubevirt-e2e-k8s-1.29-sig-network /test pull-kubevirt-e2e-k8s-1.29-sig-storage /test pull-kubevirt-e2e-k8s-1.29-sig-compute /test pull-kubevirt-e2e-k8s-1.29-sig-operator
@ormergi: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:
| Test name | Commit | Details | Required | Rerun command |
|---|---|---|---|---|
| pull-kubevirt-e2e-k8s-1.29-sig-performance | 5c7bff135037553185654c6a16e65beb63b25a93 | link | true | /test pull-kubevirt-e2e-k8s-1.29-sig-performance |
| pull-kubevirt-e2e-kind-1.27-vgpu | a818efdbafdb69e357e9a5868716ed3077ce5c53 | link | false | /test pull-kubevirt-e2e-kind-1.27-vgpu |
| pull-kubevirt-check-tests-for-flakes | 0528c9395581219a81c487338ddfd66755bb78ee | link | false | /test pull-kubevirt-check-tests-for-flakes |
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.
/retest-required
This bot automatically retries required jobs that failed/flaked on approved PRs.
Silence the bot with an /lgtm cancel or /hold comment for consistent failures.