Skip to content

[FLINK-37669][HELM] Add Helm chart unit tests to flink kubernetes operator #971

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

ChenYi015
Copy link

@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
$ # Before
$ tree helm/flink-kubernetes-operator  
helm/flink-kubernetes-operator
├── Chart.yaml
├── conf
│   ├── flink-conf.yaml
│   ├── log4j-console.properties
│   └── log4j-operator.properties
├── crds
│   ├── flinkdeployments.flink.apache.org-v1.yml
│   ├── flinksessionjobs.flink.apache.org-v1.yml
│   └── flinkstatesnapshots.flink.apache.org-v1.yml
├── templates
│   ├── _helpers.tpl
│   ├── flink-operator.yaml
│   ├── rbac.yaml
│   ├── serviceaccount.yaml
│   └── webhook.yaml

$ # After
helm/flink-kubernetes-operator
├── Chart.yaml
├── conf
│   ├── flink-conf.yaml
│   ├── log4j-console.properties
│   └── log4j-operator.properties
├── crds
│   ├── flinkdeployments.flink.apache.org-v1.yml
│   ├── flinksessionjobs.flink.apache.org-v1.yml
│   └── flinkstatesnapshots.flink.apache.org-v1.yml
├── templates
│   ├── _helpers.tpl
│   ├── certmanager
│   │   ├── _helpers.tpl
│   │   ├── certificate.yaml
│   │   └── issuer.yaml
│   ├── controller
│   │   ├── _helpers.tpl
│   │   ├── configmap.yaml
│   │   └── deployment.yaml
│   ├── flink
│   │   ├── _helpers.tpl
│   │   ├── role.yaml
│   │   └── role_binding.yaml
│   ├── rbac
│   │   ├── _helpers.tpl
│   │   ├── cluster_role.yaml
│   │   ├── cluster_role_binding.yaml
│   │   ├── role.yaml
│   │   ├── role_binding.yaml
│   │   └── service_account.yaml
│   └── webhook
│       ├── _helpers.tpl
│       ├── mutating_webhook_configuration.yaml
│       ├── secret.yaml
│       ├── service.yaml
│       └── validating_webhook_configuration.yaml
├── tests
│   ├── certmanager
│   │   ├── certificate_test.yaml
│   │   └── issuer_test.yaml
│   ├── controller
│   │   ├── configmap_test.yaml
│   │   └── deployment_test.yaml
│   ├── flink
│   │   ├── role_binding_test.yaml
│   │   └── role_test.yaml
│   ├── rbac
│   │   ├── cluster_role_binding_test.yaml
│   │   ├── cluster_role_test.yaml
│   │   ├── role_binding_test.yaml
│   │   └── role_test.yaml
│   └── webhook
│       ├── mutating_webhook_configuration_test.yaml
│       ├── secret_test.yaml
│       ├── service_test.yaml
│       └── validating_webhook_configuratioin_test.yaml

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/certmanager/certificate_test.yaml
 PASS  Test Cert Manager Issuer helm/flink-kubernetes-operator/tests/certmanager/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:        321.49ms

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

1 participant