Skip to content
This repository has been archived by the owner on Feb 22, 2022. It is now read-only.

Enable testing charts with test values #4157

Merged
merged 7 commits into from
Mar 22, 2018

Conversation

unguiculus
Copy link
Member

@unguiculus unguiculus commented Mar 14, 2018

What this PR does / why we need it:

Enables testing charts with test values.

  • The first commit refactors changed.sh. I ran Shellcheck across it and applied fixes. Some variable were upper, some were lower case. I made that consistent: lower case for script variables, upper case for environment variables.
  • The second commit updates changed.sh such that the script installs and tests the chart for any *-values.yaml found in the ci folder within the chart's directory.

Which issue this PR fixes:

Fixes #3943

@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. approved Indicates a PR has been approved by an approver from all required OWNERS files. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Mar 14, 2018
@unguiculus unguiculus force-pushed the feature/test-values branch 5 times, most recently from 0a57940 to 569ca27 Compare March 14, 2018 21:41
@unguiculus
Copy link
Member Author

unguiculus commented Mar 14, 2018

/retest

@unguiculus unguiculus force-pushed the feature/test-values branch 5 times, most recently from f6039c8 to 4c08467 Compare March 15, 2018 07:03
@unguiculus
Copy link
Member Author

I added a simple chart with a test that just logs a value. The ci folder contains two values files. The chart is installed and tested twice, once for each of the values files. You can verif that by the different test output in the CI log. The chart will be removed before merging.

You may want to review the commits separately. The actual change in logic is in the second commit.

cc @kubernetes/charts-maintainers @kubernetes/helm-maintainers

Copy link
Contributor

@mattfarina mattfarina left a comment

Choose a reason for hiding this comment

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

These are my quick nits and questions. I'll do a little more testing. I generally like the direction.

.editorconfig Outdated
charset = utf-8

[*.{yml,yaml}]
indent_size = 2
Copy link
Contributor

Choose a reason for hiding this comment

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

While I'm a fan of editorconfig to bring about consistency, is there a reason it's in this PR? I ask because it doesn't seem to fit everything else.

Copy link
Member Author

Choose a reason for hiding this comment

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

I agree. This is unrelated. I'll remove it.

"ok-to-test" label. This can also be done by commenting "/ok-to-test" on the pull request.
In order for the tests to be kicked off one of the
[Kubernetes member](https://github.com/orgs/kubernetes/people) must add the
"ok-to-test" label. This can also be done by commenting "/ok-to-test" on the pull request.
Copy link
Contributor

Choose a reason for hiding this comment

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

The tests are triggered automatically when someone is a member of the Kubernetes GitHub org or when a member adds the like /ok-to-test is a comment to tell the bot it's ok. Could we get the docs updated to reflect. both cases?

Copy link
Member Author

@unguiculus unguiculus Mar 16, 2018

Choose a reason for hiding this comment

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

Not related to this PR, but I'll change that.

test/changed.sh Outdated

# Exit early if no charts have changed
if [ -z "$CHANGED_FOLDERS" ]; then
exit 0
if [[ -z "$changed_folders" ]]; then
Copy link
Contributor

Choose a reason for hiding this comment

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

I noticed you changed the casing on variables in the shell script. If I understand the k8s practice, which I could be wrong about, uppercase variables are for those which are not mutated (essentially constants) and lowercase variables are the ones that change (e.g., in loops). It might be good to follow that convention. Thoughts?

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm all for conventions. In any case the casing was a mixture and not clear as it was. To me, a constant is something that is explicitly initialized as such. It should then probably be made readonly as well. The question is whether any variable qualifies as a constant in its actual sense just because it is never changed after it was assigned. According to Google's Shell Style Guide, a constant should be declared at the top of the file. I would agree with that and would change the casing back where this applies.

@mattfarina
Copy link
Contributor

screen shot 2018-03-16 at 9 55 57 am

I cleaned these up manually but it doesn't look like cleanup is happening.

@unguiculus
Copy link
Member Author

You can see in the log that clean-up happens. I bet these are leftovers from my tests when clean-up failed in some cases.

@unguiculus unguiculus force-pushed the feature/test-values branch 4 times, most recently from 88dfdd7 to 9b153d5 Compare March 18, 2018 12:37
@unguiculus unguiculus changed the title [WIP] Enable testing charts with test values Enable testing charts with test values Mar 19, 2018
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Mar 19, 2018
@mattfarina
Copy link
Contributor

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Mar 22, 2018
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mattfarina, unguiculus

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:
  • OWNERS [mattfarina,unguiculus]

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

@k8s-ci-robot k8s-ci-robot merged commit b5c3e51 into helm:master Mar 22, 2018
@unguiculus unguiculus deleted the feature/test-values branch March 22, 2018 20:53
joshuacox added a commit to joshuacox/charts that referenced this pull request Mar 24, 2018
* upstream/master: (944 commits)
  Rename service port to http (helm#4442)
  [stable/neo4j] Change the image of the initContainer examples (helm#4269)
  move burrow to stable repo (helm#3481)
  Upgrade kube-state-metrics to 1.2.0, add new collectors (helm#4146)
  Add review guidelines around pvcs (helm#4223)
  [stable/parse] Release 0.3.10 (helm#4389)
  [stable/phabricator] Release 0.5.19 (helm#4433)
  Support exposing jmx and additional ports (helm#4072)
  Add default of "" for string comparison (helm#4420)
  [incubator/kafka] Makes readiness probe configurable (helm#3948)
  Published stash chart 0.7.0-rc.1 (helm#4410)
  Enable testing charts with test values (helm#4157)
  [incubator/kafka] Fix initContainer failure which did not error (helm#4400)
  [stable/etcd-operator] deployment typos and add tolerations (helm#4139)
  Typo fix in coscale/README.md (helm#4306)
  Typo fix in concourse/README.md (helm#4303)
  Typo fix in cockroachdb/README.md (helm#4302)
  [stable/jenkins] Bump appVersion (helm#4177)
  Typo fix in cluster-autoscaler/README.md (helm#4301)
  [stable/traefik] Bump appVersion to 1.5.4 (helm#4206)
  ...
rolanddb pushed a commit to Eneco/charts that referenced this pull request Apr 9, 2018
* Refactor and fix shellcheck issues

* Make constants readonly and uppercase

* Remove .editorconfig

* Enable testing charts with test values

* Remove dummy chart
ichtar pushed a commit to Bestmile/charts that referenced this pull request May 15, 2018
* Refactor and fix shellcheck issues

* Make constants readonly and uppercase

* Remove .editorconfig

* Enable testing charts with test values

* Remove dummy chart
voron pushed a commit to dysnix/helm-charts that referenced this pull request Sep 5, 2018
* Refactor and fix shellcheck issues

* Make constants readonly and uppercase

* Remove .editorconfig

* Enable testing charts with test values

* Remove dummy chart

Signed-off-by: voron <av@arilot.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm Indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Proposal: Enable testing and linting charts with test values.
3 participants