Skip to content

Conversation

@ChenYi015
Copy link
Contributor

@ChenYi015 ChenYi015 commented Apr 14, 2025

What is the purpose of the change

(For example: This pull request adds a new feature to periodically create and maintain savepoints through the FlinkDeployment custom resource.)

Add Helm chart unit tests to flink kubernetes operator, see helm-unittest.

Brief change log

  • Reorganize the Helm chart directory
  • Add Helm chart unit tests
  • Update .helmignore to ingore helm unit test files
  • Setup CI workflow for running Helm unit tests

Verifying this change

This change added tests and can be verified as follows:

$ helm plugin install https://github.com/helm-unittest/helm-unittest.git --version 0.8.1

$ helm unittest helm/flink-kubernetes-operator --file "tests/**/*_test.yaml" --strict --debug

### Chart [ flink-kubernetes-operator ] helm/flink-kubernetes-operator

 PASS  Test Cert Manager Certificate    helm/flink-kubernetes-operator/tests/cert-manager/certificate_test.yaml
 PASS  Test Cert Manager Issuer helm/flink-kubernetes-operator/tests/cert-manager/issuer_test.yaml
 PASS  Test ConfigMap   helm/flink-kubernetes-operator/tests/controller/configmap_test.yaml
 PASS  Test Deployment  helm/flink-kubernetes-operator/tests/controller/deployment_test.yaml
 PASS  Test Flink Job RoleBinding       helm/flink-kubernetes-operator/tests/flink/role_binding_test.yaml
 PASS  Test Flink Job Role      helm/flink-kubernetes-operator/tests/flink/role_test.yaml
 PASS  Test Operator ClusterRoleBinding helm/flink-kubernetes-operator/tests/rbac/cluster_role_binding_test.yaml
 PASS  Test Operator ClusterRole        helm/flink-kubernetes-operator/tests/rbac/cluster_role_test.yaml
 PASS  Test Operator RoleBinding        helm/flink-kubernetes-operator/tests/rbac/role_binding_test.yaml
 PASS  Test Operator Role       helm/flink-kubernetes-operator/tests/rbac/role_test.yaml
 PASS  Test MutatingWebhookConfiguration        helm/flink-kubernetes-operator/tests/webhook/mutating_webhook_configuration_test.yaml
 PASS  Test Webhook Secret      helm/flink-kubernetes-operator/tests/webhook/secret_test.yaml
 PASS  Test Webhook Service     helm/flink-kubernetes-operator/tests/webhook/service_test.yaml
 PASS  Test ValidatingWebhookConfiguration      helm/flink-kubernetes-operator/tests/webhook/validating_webhook_configuratioin_test.yaml

Charts:      1 passed, 1 total
Test Suites: 14 passed, 14 total
Tests:       52 passed, 52 total
Snapshot:    0 passed, 0 total
Time:        748.057458ms

Does this pull request potentially affect one of the following parts:

  • Dependencies (does it add or upgrade a dependency): (no)
  • The public API, i.e., is any changes to the CustomResourceDescriptors: (no)
  • Core observer or reconciler logic that is regularly executed: (no)

Documentation

  • Does this pull request introduce a new feature? (yes)
  • If yes, how is the feature documented? (not documented)

@ChenYi015 ChenYi015 force-pushed the feature/helm-unittest branch from 545ca1a to f8507c6 Compare April 14, 2025 07:25
@gyfora
Copy link
Contributor

gyfora commented Apr 28, 2025

Why did you refactor the helm chart? Is that necessary for the tests to be added?

@ChenYi015
Copy link
Contributor Author

Why did you refactor the helm chart? Is that necessary for the tests to be added?

It is not strictly really necessary, but refactoring it would make it easier to write Helm unit tests. If each template file contains only one resource, there will be no need to select the document to test from a multi-document YAML file.

@gyfora
Copy link
Contributor

gyfora commented Apr 28, 2025

Makes sense, would it be possible to integrate the helm test into the maven build or at least the GitHub CI?

Copy link
Contributor

@gyfora gyfora left a comment

Choose a reason for hiding this comment

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

What would be a good way to compare and make sure that the helm chart did not change before and after the refactor?

@ChenYi015
Copy link
Contributor Author

Makes sense, would it be possible to integrate the helm test into the maven build or at least the GitHub CI?

Have raised PR #974 to add Helm lint and tests to the CI.

@gyfora
Copy link
Contributor

gyfora commented Apr 28, 2025

Makes sense, would it be possible to integrate the helm test into the maven build or at least the GitHub CI?

Have raised PR #974 to add Helm lint and tests to the CI.

Please include that commit in this PR so we can test together

@gyfora
Copy link
Contributor

gyfora commented Apr 30, 2025

Could you please rebase on the latest (minor) helm chart changes? Also please provide some comment / proof to show that the helm chart did not change during the refactoring that would speed up the review and we can merge it faster

@ChenYi015 ChenYi015 force-pushed the feature/helm-unittest branch from f8507c6 to 83766ff Compare June 6, 2025 15:05
@ChenYi015 ChenYi015 marked this pull request as draft June 6, 2025 15:15
@ChenYi015
Copy link
Contributor Author

Could you please rebase on the latest (minor) helm chart changes? Also please provide some comment / proof to show that the helm chart did not change during the refactoring that would speed up the review and we can merge it faster

Sorry for the late response. I have opened another ticket and created a new PR #985 to reorganize the Helm chart directory structure first, I will rebase this PR onto it after it gets merged.

@gyfora
Copy link
Contributor

gyfora commented Jun 10, 2025

I have merged the other PR, lets rebase this one :)

@ChenYi015 ChenYi015 force-pushed the feature/helm-unittest branch 2 times, most recently from a4a58d6 to 346e591 Compare June 11, 2025 18:40
@ChenYi015 ChenYi015 marked this pull request as ready for review June 11, 2025 18:40
@ChenYi015 ChenYi015 requested a review from gyfora June 11, 2025 18:43
Copy link
Contributor

@gyfora gyfora left a comment

Choose a reason for hiding this comment

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

Why are you making so many changes to the helm chart itself instead of just adding the tests?

@ChenYi015
Copy link
Contributor Author

Why are you making so many changes to the helm chart itself instead of just adding the tests?

Also did some refactoring to improve the Helm chart. I will split this PR into two smaller PRs and keep only unit tests in this PR.

@ChenYi015 ChenYi015 force-pushed the feature/helm-unittest branch from 346e591 to 3f21e0e Compare June 13, 2025 03:42
@gyfora
Copy link
Contributor

gyfora commented Aug 22, 2025

I see this CI error:

The action helm/[email protected] is not allowed in apache/flink-kubernetes-operator because all actions must be from a repository owned by your enterprise, created by GitHub, verified in the GitHub Marketplace, or match one of the patterns: 1Password/load-secrets-action@13f58eec611f8e5db52ec16247f58c508398f3e6, 1Password/load-secrets-action@581a835fb51b8e7ec56b71cf2ffddd7e68bb25e0, AdoptOpenJDK/install-jdk@*, BobAnkh/auto-generate-changelog@*, DavidAnson/markdownlint-cli2-action@992badcdf24e3b8eb7e87ff9287fe931bcb00c6e, DavidAnson/markdownlint-cli2-action@b4c9feab76d8025d1e83c653fa3990936df0e6c8, EnricoMi/publish-unit-test-result-action@*, JamesIves/github-pages-deploy-action@6c2d9db40f9296374acc17b90404b6e8864128c8, JamesIves/github-pages-deploy-action@881db5376404c5c8d621010bcbec0310b58d5e29, JustinBeckwith/linkinator-action@3d5ba091319fa7b0ac14703761eebb7d100e6f6d, Kesin11/actions-timeline@427ee2cf860166e404d0d69b4f2b24012bb7af4f, Kesin11/actions-timeline@a7eaabf426cda...

@ChenYi015
Copy link
Contributor Author

ChenYi015 commented Aug 27, 2025

Have pinned external GitHub actions with git hash according to GitHub Actions Policy.

@gyfora gyfora merged commit a57579c into apache:main Aug 28, 2025
233 of 235 checks passed
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.

2 participants