Skip to content
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

Tests: Enable Acceptance Tests #103

Merged
merged 1 commit into from
Sep 18, 2024

Conversation

m-ildefons
Copy link
Contributor

@m-ildefons m-ildefons commented Aug 26, 2024

Enable acceptance tests and fix existing tests and providers

  1. Enable running acceptance tests on make test command when the user
    places a kubeconfig file into the repository. This kubeconfig is
    necessary since the acceptance tests are checked against a real
    Harvester cluster. If the kubeconfig file is missing, only unit tests
    are run, which doesn't require a Harvester cluster.
  2. Fix existing tests. Some existing acceptance tests where using
    invalid terraform resources. These are fixed
  3. Fix volume and network resource providers. Running acceptance tests
    revealed bugs in the volume and network resource providers. Both were
    using an incorrect method to determine if a resource had been deleted
    in Harvester. The bug was that the resource providers were waiting
    for a deletion event, despite the fact that the respective
    controllers don't emit such an event. The fix is to observe the
    resource through a periodic read.
  4. Fix propagating the cluster network name of a network resource into
    the terraform state. The terraform state needs to keep track of this
    property to determine if the resource definition has changed.
    Otherwise the resource will always count as modified, which is in
    some cases wrong. This bug was also revealed by the acceptance tests.

Related-To: harvester/harvester#6415

Enable acceptance tests and fix existing tests.

1) Enable running acceptance tests on `make test` command when the user
   places a kubeconfig file into the repository. This kubeconfig is
   necessary since the acceptance tests are checked against a real
   Harvester cluster. If the kubeconfig file is missing, only unit tests
   are run, which doesn't require a Harvester cluster.
2) Fix existing tests. Some existing acceptance tests where using
   invalid terraform resources. These are fixed
3) Fix volume and network resource providers. Running acceptance tests
   revealed bugs in the volume and network resource providers. Both were
   using an incorrect method to determine if a resource had been deleted
   in Harvester. The bug was that the resource providers were waiting
   for a deletion event, despite the fact that the respective
   controllers don't emit such an event. The fix is to observe the
   resource through a periodic read.
4) Fix propagating the cluster network name of a network resource into
   the terraform state. The terraform state needs to keep track of this
   property to determine if the resource definition has changed.
   Otherwise the resource will always count as modified, which is in
   some cases wrong. This bug was also revealed by the acceptance tests.

Signed-off-by: Moritz Röhrich <[email protected]>
@m-ildefons m-ildefons added bug Something isn't working enhancement New feature or request labels Aug 26, 2024
@m-ildefons m-ildefons self-assigned this Aug 26, 2024
@m-ildefons m-ildefons requested a review from bk201 August 27, 2024 07:24
Copy link
Member

@FrankYang0529 FrankYang0529 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks for the great fix.

@FrankYang0529 FrankYang0529 merged commit 55ee9e6 into harvester:master Sep 18, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants