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

Enhance PR Workflow with Integration Tests Using Kind Cluster #259

Merged
merged 1 commit into from
Jul 29, 2024

Conversation

ibakshay
Copy link
Contributor

@ibakshay ibakshay commented Jul 29, 2024

This pull request improves our testing process by introducing integration tests to the existing PR workflow. Key changes include:

  1. Automated creation of a Kind cluster within the workflow to set up the integration test environment.
  2. Execution of integration tests in the locally created Kind cluster.
  3. Automated deletion of the Kind cluster upon workflow completion, ensuring clean-up of resources.

Local Testing:

This workflow can be tested locally using the act tool with the following command:

act pull_request --container-architecture linux/amd64 -P default=catthehacker/ubuntu:act-latest --job helm-lint-test --workflows .github/workflows/helm-lint-test.yaml --eventpath act_pull_request.json

Required Files:

  1. act_pull_request.json with the following content:
{
  "pull_request": {
    "number": "10",
    "head": {
      "ref": "<branch-name>",
      "sha": "<sha>"
    },
    "base": { "ref": "main" }
  },
  "repository": {
    "name": "greenhouse-extensions",
    "default_branch": "main",
    "owner": { "login": "cloudoperators" }
  }
}
  1. .secrets file with the following content:
GITHUB_TOKEN=<PAT_TOKEN>

relates to #141

Copy link
Contributor

@kengou kengou left a comment

Choose a reason for hiding this comment

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

LGTM 🚀

@uwe-mayer
Copy link
Contributor

Related:

cloudoperators/greenhouse#106

@richardtief
Copy link
Member

richardtief commented Jul 29, 2024

Awesome! What if a plugin does not provide chart tests? Does the workflow then fail?

@ibakshay
Copy link
Contributor Author

Awesome! What if a plugin does not provide chart tests? Does the workflow then fail?

No, the workflow won't fail. The chart tests will only run if the tests are there in the templates/tests folder.

Example output when no tests are present

| ...Successfully got an update from the "alerts" chart repository
| Update Complete. ⎈Happy Helming!⎈
| Saving 1 charts
| Downloading cert-manager from repo https://charts.jetstack.io
| Deleting outdated charts
| Installing chart "cert-manager => (version: \"1.11.1\", path: \"cert-manager/charts/v1.11.0/cert-manager\")"...
| Creating namespace "cert-manager-vhe2cxypzc"...
| namespace/cert-manager-vhe2cxypzc created
| NAME: cert-manager-vhe2cxypzc
| LAST DEPLOYED: Mon Jul 29 13:42:59 2024
| NAMESPACE: cert-manager-vhe2cxypzc
| STATUS: deployed
| REVISION: 1
| TEST SUITE: None
| deployment "cert-manager-vhe2cxypzc" successfully rolled out
| deployment "cert-manager-vhe2cxypzc-cainjector" successfully rolled out
| deployment "cert-manager-vhe2cxypzc-webhook" successfully rolled out
| NAME: cert-manager-vhe2cxypzc
| LAST DEPLOYED: Mon Jul 29 13:42:59 2024
| NAMESPACE: cert-manager-vhe2cxypzc
| STATUS: deployed
| REVISION: 1
| TEST SUITE: None # <--------------------

Copy link
Member

@richardtief richardtief left a comment

Choose a reason for hiding this comment

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

All good. Let's get this in.

@ibakshay ibakshay merged commit 3bf0f87 into main Jul 29, 2024
2 checks passed
@ibakshay ibakshay deleted the helm-integration-test-on-pr branch July 29, 2024 13:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants