Skip to content

Commit

Permalink
add seed jobs tests
Browse files Browse the repository at this point in the history
  • Loading branch information
brokenpip3 committed Jun 2, 2024
1 parent cd67bb7 commit db19ca8
Showing 1 changed file with 29 additions and 5 deletions.
34 changes: 29 additions & 5 deletions test/bats/1-deploy.bats
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ diag() {
--set jenkins.latestPlugins=true \
--set jenkins.image="jenkins/jenkins:2.452.1-lts" \
--set jenkins.backup.makeBackupBeforePodDeletion=false \
--set jenkins.seedJobs[0].id=seed-job \
--set jenkins.seedJobs[0].targets="cicd/jobs/*.jenkins" \
--set jenkins.seedJobs[0].description="jobs-from-operator-repo" \
--set jenkins.seedJobs[0].repositoryBranch=master \
--set jenkins.seedJobs[0].repositoryUrl=https://github.com/jenkinsci/kubernetes-operator \
--set jenkins.seedJobs[0].buildPeriodically="10 * * * *" \
jenkins-operator/jenkins-operator --version=$(cat VERSION.txt | sed 's/v//')
assert_success
assert ${HELM} status default
Expand Down Expand Up @@ -118,7 +124,25 @@ diag() {
}

#bats test_tags=phase:helm,scenario:vanilla
@test "1.10 Helm: upgrade from main branch same values" {
@test "1.10 Helm: check Jenkins seed job status and logs" {
[[ ! -f "chart/jenkins-operator/deploy.tmp" ]] && skip "Jenkins helm chart have not been deployed correctly"
run verify "there is 1 deployment named 'seed-job-agent-jenkins'"
assert_success

run verify "there is 1 pod named 'seed-job-agent-jenkins-'"
assert_success

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

run ${KUBECTL} logs -l app=seed-job-agent-selector
assert_success
assert_output --partial 'INFO: Connected'

}

#bats test_tags=phase:helm,scenario:vanilla
@test "1.11 Helm: upgrade from main branch same values" {
run echo ${DETIK_CLIENT_NAMESPACE}
run echo ${OPERATOR_IMAGE}
run ${HELM} upgrade default \
Expand All @@ -134,7 +158,7 @@ diag() {
}

#bats test_tags=phase:helm,scenario:vanilla
@test "1.11 Helm: check Jenkins operator pods status again" {
@test "1.12 Helm: check Jenkins operator pods status again" {
[[ ! -f "chart/jenkins-operator/deploy.tmp" ]] && skip "Jenkins helm chart have not been deployed correctly"
run verify "there is 1 deployment named 'default-jenkins-operator'"
assert_success
Expand All @@ -147,7 +171,7 @@ diag() {
}

#bats test_tags=phase:helm,scenario:vanilla
@test "1.12 Helm: check Jenkins operator pods status" {
@test "1.13 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 'default-jenkins-operator'"
assert_success
Expand All @@ -160,7 +184,7 @@ diag() {
}

#bats test_tags=phase:helm,scenario:vanilla
@test "1.13 Helm: check Jenkins Pod status" {
@test "1.14 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
Expand All @@ -170,7 +194,7 @@ diag() {
}

#bats test_tags=phase:helm,scenario:vanilla
@test "1.14 Helm: clean" {
@test "1.15 Helm: clean" {
run ${HELM} uninstall default
assert_success
# Wait for the complete removal
Expand Down

0 comments on commit db19ca8

Please sign in to comment.