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

Add helm test integration #415

Merged
merged 1 commit into from
Jun 8, 2020
Merged

Conversation

seaneagan
Copy link
Contributor

@seaneagan seaneagan commented May 12, 2020

Fixes #369.

@hiddeco

@seaneagan seaneagan force-pushed the helm_test_integration branch 2 times, most recently from 48f1352 to c723f86 Compare May 14, 2020 19:20
@seaneagan seaneagan force-pushed the helm_test_integration branch 4 times, most recently from d05f64d to b2a0946 Compare May 19, 2020 17:31
@seaneagan seaneagan force-pushed the helm_test_integration branch 2 times, most recently from d01db3e to 2b9fc59 Compare May 26, 2020 15:10
.circleci/config.yml Outdated Show resolved Hide resolved
@seaneagan seaneagan force-pushed the helm_test_integration branch 7 times, most recently from a84615c to a2fcab2 Compare May 28, 2020 21:30
@seaneagan seaneagan force-pushed the helm_test_integration branch 6 times, most recently from b95bbe2 to 6ec9a29 Compare May 29, 2020 19:57
@seaneagan seaneagan marked this pull request as ready for review May 29, 2020 20:22
@hiddeco hiddeco added the enhancement New feature or request label Jun 1, 2020
@seaneagan seaneagan marked this pull request as draft June 1, 2020 13:55
@seaneagan seaneagan force-pushed the helm_test_integration branch from 6ec9a29 to 4fb2f43 Compare June 4, 2020 20:13
poll_until_equals 'release deploy' 'True' "kubectl -n $DEMO_NAMESPACE get helmrelease/podinfo-helm-repository -o jsonpath='{.status.conditions[?(@.type==\"Released\")].status}'"

if [ $HELM_VERSION = "v2" ]; then
test_exists_jq_filter='.info.status | has("last_test_suite_run")'
Copy link
Contributor Author

@seaneagan seaneagan Jun 4, 2020

Choose a reason for hiding this comment

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

there is currently a race condition where the observed generation is set, immediately followed by the lock opening up for the next chart sync interval loop, and the informer cache is not updated yet with the observed generation change, which results in an upgrade, which causes "last_test_suite_run" to be unset, which causes this test to fail. This is resolved by #444 which runs a harmless dry run compare, instead of a direct upgrade.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed the race condition by using polling in the test.

@seaneagan seaneagan marked this pull request as ready for review June 4, 2020 20:57
@@ -406,14 +433,14 @@ func (r *Release) upgrade(client helm.Client, hr *v1.HelmRelease, chart chart, v
ResetValues: !hr.GetReuseValues(),
SkipCRDs: hr.Spec.SkipCRDs,
MaxHistory: hr.GetMaxHistory(),
Wait: hr.Spec.Wait || hr.Spec.Rollback.Enable,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

existing behavior is that wait only defaults to true on upgrades (not installs) when rollbacks are enabled. It seemed better to me for the config to be statically determined, and not depend on current action (install vs upgrade), so I implemented that for when tests are enabled, and then I just made the behavior match when rollbacks are enabled. This does mean wait may be turned on for some installs where it wasn't before. Let me know what you think.

Copy link
Member

Choose a reason for hiding this comment

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

This is 👌, I would have made the same change if I had to further extend the waiting behaviour.

@seaneagan seaneagan force-pushed the helm_test_integration branch from 4fb2f43 to 04d8675 Compare June 5, 2020 21:31
chart:
repository: https://stefanprodan.github.io/podinfo
name: podinfo
version: 3.2.0
Copy link
Member

Choose a reason for hiding this comment

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

Should we use 4.0.1 here?

Copy link
Member

Choose a reason for hiding this comment

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

Wouldn't hurt to update things to a newer podinfo version, but can be taken care of in a a separate PR to change the other fixtures as well.

Copy link
Member

@hiddeco hiddeco left a comment

Choose a reason for hiding this comment

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

Lengthy PR! But tidy, clean, and extensively documented.

LGTM @seaneagan 🥇

@hiddeco hiddeco merged commit a3beeaf into fluxcd:master Jun 8, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

helm test integration
3 participants