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

End-to-end test for garbage collection #2577

Merged
merged 3 commits into from
Nov 6, 2019
Merged

End-to-end test for garbage collection #2577

merged 3 commits into from
Nov 6, 2019

Conversation

squaremo
Copy link
Member

@squaremo squaremo commented Nov 4, 2019

This adds a test for syncing with garbage collection switched on. To make it easier to add arbitrary arguments to the flux deployment, it also adds a mechanism for turning the output of fluxctl install into a kustomization and patching it.

@squaremo squaremo changed the title End-to-end test for garbage collection [WIP] End-to-end test for garbage collection Nov 4, 2019
# This generates the base descriptions, which we'll then patch with a kustomization
$fluxctl_install_cmd --namespace "${FLUX_NAMESPACE}" -o "${kustomtmp}" 2>&3
cp ${E2E_DIR}/fixtures/{kustomization,e2e_patch}.yaml "${kustomtmp}/"
kubectl apply -k "${kustomtmp}" >&3
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice!!

@squaremo squaremo changed the title [WIP] End-to-end test for garbage collection End-to-end test for garbage collection Nov 5, 2019
@squaremo squaremo marked this pull request as ready for review November 5, 2019 14:45
test/e2e/13_sync_gc.bats Outdated Show resolved Hide resolved
This changes the `fluxctl install` installation to use a
kustomization, rather than sed. This is a little more robust; but the
motivation is more that it will enable more complicated patches, like
mounting volumes.

_En passant_, the kubectl rollout during flux installation gets a
timeout, so it can fail fast. Well, faster than twenty minutes.
This adds the ability to give an alternate kustomization when
installing flux, and uses that to test flux with garbage collection.
The test runner `bats` installs its own trap(s), and in doing so,
appears to interfere with the trap `defer.bash` sets. So, instead of
setting the trap within the sourced file, require the
deferred-command-runner to be invoked explicitly. `run.bash` can set a
trap to do so; the tests must call `run_deferred` (formerly `on_exit`)
in their teardown function.
mkdir "${kustomtmp}/base"
# This generates the base manifests, which we'll then patch with a kustomization
echo ">>> writing base configuration to ${kustomtmp}" >&3
echo ">>> writing base configuration to ${kustomtmp}/base" >&3
Copy link
Member Author

Choose a reason for hiding this comment

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

Related, just, to the change immediately above.

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.

💯 for using teardown as an alternative trap.

@squaremo squaremo merged commit 0bc318b into master Nov 6, 2019
@squaremo squaremo deleted the e2e/sync-gc branch November 6, 2019 11:59
2opremio added a commit to 2opremio/flux that referenced this pull request Nov 8, 2019
fluxcd#2577 introduced a regression,
( at https://github.com/fluxcd/flux/pull/2577/files#diff-e76b06a8940cf68dbf66b91380d3dc28L58 )
causing the end-to-end tests to use the latest Flux release instead
of the local version.
@2opremio 2opremio added this to the 1.16.0 milestone Nov 21, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants