forked from VirtusLab/jenkins-operator
-
Notifications
You must be signed in to change notification settings - Fork 236
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: latestplugin always true, add more complex bats tests, update de…
…vcontainers and make manifests (#857)
- Loading branch information
1 parent
0abc758
commit 5ddcf10
Showing
13 changed files
with
142 additions
and
36 deletions.
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
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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
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
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
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,88 @@ | ||
setup() { | ||
load 'test_helper' | ||
_common_setup | ||
} | ||
|
||
#bats test_tags=phase:helm | ||
@test "2.1 Install helm chart with options" { | ||
run ${HELM} dependency update chart/jenkins-operator | ||
assert_success | ||
run ${KUBECTL} label node jenkins-control-plane batstest=yep | ||
${HELM} status options && skip "Helm release 'options' already exists" | ||
run ${HELM} install options \ | ||
--set jenkins.namespace=${DETIK_CLIENT_NAMESPACE} \ | ||
--set namespace=${DETIK_CLIENT_NAMESPACE} \ | ||
--set operator.image=${OPERATOR_IMAGE} \ | ||
--set jenkins.latestPlugins=true \ | ||
--set jenkins.nodeSelector.batstest=yep \ | ||
--set jenkins.backup.makeBackupBeforePodDeletion=false \ | ||
chart/jenkins-operator | ||
assert_success | ||
assert ${HELM} status options | ||
touch "chart/jenkins-operator/deploy.tmp" | ||
} | ||
|
||
#bats test_tags=phase:helm | ||
@test "2.2 Helm: check Jenkins operator pods status" { | ||
[[ ! -f "chart/jenkins-operator/deploy.tmp" ]] && skip "Jenkins helm chart have not been deployed correctly" | ||
|
||
run verify "there is 1 deployment named 'options-jenkins-operator'" | ||
assert_success | ||
|
||
run verify "there is 1 pod named 'options-jenkins-operator-'" | ||
assert_success | ||
|
||
run try "at most 20 times every 10s to get pods named 'options-jenkins-operator-' and verify that '.status.containerStatuses[?(@.name==\"jenkins-operator\")].ready' is 'true'" | ||
assert_success | ||
} | ||
|
||
#bats test_tags=phase:helm | ||
@test "2.3 Helm: check Jenkins Pod status" { | ||
[[ ! -f "chart/jenkins-operator/deploy.tmp" ]] && skip "Jenkins helm chart have not been deployed correctly" | ||
|
||
run try "at most 20 times every 10s to get pods named 'jenkins-jenkins' and verify that '.status.containerStatuses[?(@.name==\"jenkins-master\")].ready' is 'true'" | ||
assert_success | ||
|
||
run try "at most 20 times every 5s to get pods named 'jenkins-jenkins' and verify that '.status.containerStatuses[?(@.name==\"jenkins-master\")].ready' is 'true'" | ||
assert_success | ||
} | ||
|
||
@test "2.4 check node selector" { | ||
[[ ! -f "chart/jenkins-operator/deploy.tmp" ]] && skip "Jenkins helm chart have not been deployed correctly" | ||
|
||
NODENAME=$(${KUBECTL} get pod jenkins-jenkins -o jsonpath={.spec.nodeName}) | ||
|
||
run ${KUBECTL} get node -l batstest=yep -o name | ||
assert_success | ||
assert_output "node/$NODENAME" | ||
} | ||
|
||
@test "2.5 check jenkins-plugin-cli command" { | ||
[[ ! -f "chart/jenkins-operator/deploy.tmp" ]] && skip "Jenkins helm chart have not been deployed correctly" | ||
|
||
run ${KUBECTL} logs -c jenkins-master jenkins-jenkins | ||
assert_success | ||
assert_output --partial 'jenkins-plugin-cli --verbose --latest true -f /var/lib/jenkins/base-plugins.txt' | ||
assert_output --partial 'jenkins-plugin-cli --verbose --latest true -f /var/lib/jenkins/user-plugins.txt' | ||
} | ||
|
||
|
||
@test "2.7 check backup" { | ||
[[ ! -f "chart/jenkins-operator/deploy.tmp" ]] && skip "Jenkins helm chart have not been deployed correctly" | ||
sleep 120 | ||
run ${KUBECTL} logs -l app.kubernetes.io/name=jenkins-operator --tail 10000 | ||
assert_success | ||
assert_output --partial "Performing backup '1'" | ||
assert_output --partial "Backup completed '1', updating status" | ||
} | ||
|
||
|
||
@test "2. Helm: Clean" { | ||
skip | ||
[[ ! -f "chart/jenkins-operator/deploy.tmp" ]] && skip "Jenkins helm chart have not been deployed correctly" | ||
|
||
run ${HELM} uninstall options | ||
assert_success | ||
|
||
rm "chart/jenkins-operator/deploy.tmp" | ||
} |
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