kubevirt icon indicating copy to clipboard operation
kubevirt copied to clipboard

tests: Make use of tests/libsecret

Open ormergi opened this issue 2 years ago • 13 comments

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.

Release note

NONE

ormergi avatar Mar 19 '24 13:03 ormergi

/hold Based on https://github.com/kubevirt/kubevirt/pull/11545. Wait until it is merged

fossedihelm avatar Mar 19 '24 13:03 fossedihelm

/sig code-quality

ormergi avatar Mar 19 '24 13:03 ormergi

rebased

ormergi avatar Apr 24 '24 07:04 ormergi

https://github.com/kubevirt/kubevirt/pull/11545 is merged

/unhold

ormergi avatar Apr 24 '24 12:04 ormergi

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

ormergi avatar Apr 24 '24 18:04 ormergi

/test pull-kubevirt-e2e-k8s-1.29-sig-storage /test pull-kubevirt-e2e-k8s-1.29-sig-compute

ormergi avatar Apr 24 '24 18:04 ormergi

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.

ormergi avatar May 06 '24 16:05 ormergi

Rebased

ormergi avatar May 07 '24 05:05 ormergi

Changes: Rebased on #11854

ormergi avatar May 08 '24 14:05 ormergi

Changes: Change tests to use libsecret.StringData{} and libsecret.Data{}

ormergi avatar May 08 '24 14:05 ormergi

Rebased

ormergi avatar May 12 '24 07:05 ormergi

[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

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment Approvers can cancel approval by writing /approve cancel in a comment

kubevirt-bot avatar May 15 '24 09:05 kubevirt-bot

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

kubevirt-commenter-bot avatar May 15 '24 09:05 kubevirt-commenter-bot

@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.

kubevirt-bot avatar May 15 '24 10:05 kubevirt-bot

/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.

kubevirt-commenter-bot avatar May 15 '24 14:05 kubevirt-commenter-bot