This repository has been archived by the owner on Nov 1, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Add 'fluxctl install' e2e smoke test #2552
Merged
Merged
Changes from 3 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
5e7badf
Factor out polling functions in e2e test
2opremio 63f966e
Add test for smoke test for 'fluxctl install'
2opremio 97a0d06
Reducing e2e polling interval to 10s
2opremio c14cb77
Restore demo namespace env varible
2opremio 005ba5c
Parameterize polling retry count and wait period
2opremio File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#!/usr/bin/env bats | ||
|
||
load lib/install | ||
load lib/poll | ||
|
||
function setup() { | ||
install_git_srv | ||
install_tiller | ||
install_flux_with_helm | ||
} | ||
|
||
@test "Helm chart installation smoke test" { | ||
# The gitconfig secret must exist and have the right value | ||
poll_until_equals "gitconfig secret" "${GITCONFIG}" "kubectl get secrets -n "${FLUX_NAMESPACE}" gitconfig -ojsonpath={..data.gitconfig} | base64 --decode" | ||
|
||
# Test that the resources from https://github.com/fluxcd/flux-get-started are deployed | ||
poll_until_true 'namespace demo' 'kubectl describe ns/demo' | ||
poll_until_true 'workload podinfo' 'kubectl -n demo describe deployment/podinfo' | ||
poll_until_true 'mongodb HelmRelease' 'kubectl -n demo describe helmrelease/mongodb' | ||
} | ||
|
||
function teardown() { | ||
# For debugging purposes (in case the test fails) | ||
echo '>>> Flux logs' | ||
kubectl -n "${FLUX_NAMESPACE}" logs deployment/flux | ||
echo '>>> List pods' | ||
kubectl -n "${DEMO_NAMESPACE}" get pods | ||
echo '>>> Check workload' | ||
kubectl -n "${DEMO_NAMESPACE}" rollout status deployment/podinfo | ||
|
||
uninstall_flux_with_helm | ||
uninstall_tiller | ||
uninstall_git_srv | ||
kubectl delete namespace demo | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/usr/bin/env bats | ||
|
||
load lib/install | ||
load lib/poll | ||
|
||
function setup() { | ||
install_git_srv | ||
install_flux_with_fluxctl | ||
} | ||
|
||
@test "'fluxctl install' smoke test" { | ||
# Test that the resources from https://github.com/fluxcd/flux-get-started are deployed | ||
poll_until_true 'namespace demo' 'kubectl describe ns/demo' | ||
poll_until_true 'workload podinfo' 'kubectl -n demo describe deployment/podinfo' | ||
} | ||
|
||
function teardown() { | ||
# For debugging purposes (in case the test fails) | ||
echo '>>> Flux logs' | ||
kubectl -n "${FLUX_NAMESPACE}" logs deployment/flux | ||
echo '>>> List pods' | ||
kubectl -n "${DEMO_NAMESPACE}" get pods | ||
echo '>>> Check workload' | ||
kubectl -n "${DEMO_NAMESPACE}" rollout status deployment/podinfo | ||
|
||
uninstall_flux_with_fluxctl | ||
uninstall_git_srv | ||
kubectl delete namespace demo | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/usr/bin/env bash | ||
|
||
function poll_until_equals() { | ||
local what="$1" | ||
local expected="$2" | ||
local check_cmd="$3" | ||
poll_until_true "$what" "[ '$expected' = \"\$( $check_cmd )\" ]" | ||
} | ||
|
||
function poll_until_true() { | ||
2opremio marked this conversation as resolved.
Show resolved
Hide resolved
|
||
local what="$1" | ||
local check_cmd="$2" | ||
echo -n ">>> Waiting for $what " >&3 | ||
retries=24 | ||
count=0 | ||
until eval "$check_cmd"; do | ||
echo -n '.' >&3 | ||
sleep 5 | ||
count=$(($count + 1)) | ||
if [[ ${count} -eq ${retries} ]]; then | ||
echo ' No more retries left!' >&3 | ||
return 1 # fail | ||
fi | ||
done | ||
echo ' done' >&3 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is pretty horrible. I'm open for suggestions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this comment is also aimed at the sed expressions above (I tried to make a comment on the full block of code but it seems I failed)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't the
install
package already supportadditionalArguments
? What about instead of doing thesed
, we make a small adjustment tofluxctl install
to accept a string slice of additional arguments, and then utilize this here?There actually was someone on Slack yesterday who was wondering how he could use his own image with
fluxctl install
. So maybe adding an option to supply an own image tofluxctl install
wouldn't even be a bad idea.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like your suggestions. I initially incorporated
--extra-flux-arguments
, but @squaremo thought it was better to edit the output. See #2287 (review)@squaremo I still think there is a valid usecase here, could you reevaluate?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hiddeco regardless, I will fix this in a separate PR. Are you OK with the rest?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to run the output of
fluxctl install
through kustomize to do the patching you need?