Skip to content

Commit

Permalink
Merge branch 'master' into dependabot/github_actions/actions-c54e66f61f
Browse files Browse the repository at this point in the history
  • Loading branch information
brokenpip3 authored Mar 16, 2024
2 parents a9bcfba + 1a7dc91 commit 25d0699
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 22 deletions.
2 changes: 1 addition & 1 deletion test/bats/1-deploy.bats
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ diag() {
--set jenkins.latestPlugins=true \
--set jenkins.image="jenkins/jenkins:2.440.1-lts" \
--set jenkins.backup.makeBackupBeforePodDeletion=false \
jenkins-operator/jenkins-operator --version=$(cat ../../VERSION.txt | sed 's/v//')
jenkins-operator/jenkins-operator --version=$(cat VERSION.txt | sed 's/v//')
assert_success
assert ${HELM} status default
touch "chart/jenkins-operator/deploy.tmp"
Expand Down
16 changes: 5 additions & 11 deletions test/bats/2-deploy-with-more-options.bats
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ setup() {
}

#bats test_tags=phase:helm,scenario:more-options
@test "2.2 Helm Install helm chart with options" {
#assert_success
@test "2.2 Helm: install helm chart with options" {
run ${KUBECTL} label node jenkins-control-plane batstest=yep
assert_success
run ${HELM} install options \
--set jenkins.namespace=${DETIK_CLIENT_NAMESPACE} \
--set namespace=${DETIK_CLIENT_NAMESPACE} \
Expand All @@ -31,7 +31,7 @@ setup() {
--set jenkins.nodeSelector.batstest=yep \
--set jenkins.image="jenkins/jenkins:2.440.1-lts" \
--set jenkins.backup.makeBackupBeforePodDeletion=false \
jenkins-operator/jenkins-operator --version=$(cat ../../VERSION.txt | sed 's/v//')
jenkins-operator/jenkins-operator --version=$(cat VERSION.txt | sed 's/v//')
assert_success
assert ${HELM} status options
touch "chart/jenkins-operator/deploy.tmp"
Expand All @@ -55,10 +55,10 @@ setup() {
@test "2.4 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'"
run try "at most 20 times every 5s to get pods named 'jenkins-jenkins' and verify that '.status.containerStatuses[?(@.name==\"backup\")].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'"
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
}

Expand Down Expand Up @@ -95,12 +95,6 @@ setup() {

#bats test_tags=phase:helm,scenario:more-options
@test "2.9 Helm: upgrade from main branch same value" {
# The kind storage class provider needs some sec to delete the old pvc
sleep 30
#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} upgrade options \
--set jenkins.namespace=${DETIK_CLIENT_NAMESPACE} \
--set namespace=${DETIK_CLIENT_NAMESPACE} \
Expand Down
19 changes: 9 additions & 10 deletions test/bats/3-deploy-with-webhook.bats
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ setup() {
--set jenkins.image="jenkins/jenkins:2.440.1-lts" \
--set jenkins.backup.makeBackupBeforePodDeletion=true \
--set webhook.enabled=true \
jenkins-operator/jenkins-operator --version=$(cat ../../VERSION.txt | sed 's/v//')
jenkins-operator/jenkins-operator --version=$(cat VERSION.txt | sed 's/v//')
assert_success
assert ${HELM} status webhook
touch "chart/jenkins-operator/deploy.tmp"
Expand All @@ -50,16 +50,16 @@ setup() {

run try "at most 20 times every 10s to get pods named 'webhook-jenkins-operator-' and verify that '.status.containerStatuses[?(@.name==\"jenkins-operator\")].ready' is 'true'"
assert_success

run ${KUBECTL} rollout restart deployment webhook-jenkins-operator
assert_success
}

#bats test_tags=phase:helm,scenario:webhook
@test "3.4 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'"
run try "at most 30 times every 10s to get pods named 'jenkins-jenkins' and verify that '.status.containerStatuses[?(@.name==\"jenkins-master\")].ready' is 'true'"
assert_success
}

Expand All @@ -81,8 +81,7 @@ setup() {
@test "3.7 Helm: upgrade from main branch same value" {
run ${HELM} dependency update chart/jenkins-operator
assert_success
${HELM} status webhook && skip "Helm release 'webhook' already exists"
run ${HELM} install webhook \
run ${HELM} upgrade webhook \
--set jenkins.namespace=${DETIK_CLIENT_NAMESPACE} \
--set namespace=${DETIK_CLIENT_NAMESPACE} \
--set operator.image=${OPERATOR_IMAGE} \
Expand All @@ -93,6 +92,7 @@ setup() {
chart/jenkins-operator
assert_success
assert ${HELM} status webhook
sleep 10
touch "chart/jenkins-operator/deploy.tmp"
}

Expand All @@ -116,9 +116,6 @@ setup() {

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
}

#bats test_tags=phase:helm,scenario:webhook
Expand Down Expand Up @@ -147,3 +144,5 @@ setup() {

rm "chart/jenkins-operator/deploy.tmp"
}

#TODO: add another test scenario while installing from kubectl apply

0 comments on commit 25d0699

Please sign in to comment.