diff --git a/test/bats/1-deploy.bats b/test/bats/1-deploy.bats index 0ea6b91e0..7be9cba3c 100644 --- a/test/bats/1-deploy.bats +++ b/test/bats/1-deploy.bats @@ -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" diff --git a/test/bats/2-deploy-with-more-options.bats b/test/bats/2-deploy-with-more-options.bats index 4d7803d4c..43590eba6 100644 --- a/test/bats/2-deploy-with-more-options.bats +++ b/test/bats/2-deploy-with-more-options.bats @@ -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} \ @@ -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" @@ -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 } @@ -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} \ diff --git a/test/bats/3-deploy-with-webhook.bats b/test/bats/3-deploy-with-webhook.bats index 8ca41a722..e04bbc9b8 100644 --- a/test/bats/3-deploy-with-webhook.bats +++ b/test/bats/3-deploy-with-webhook.bats @@ -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" @@ -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 } @@ -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} \ @@ -93,6 +92,7 @@ setup() { chart/jenkins-operator assert_success assert ${HELM} status webhook + sleep 10 touch "chart/jenkins-operator/deploy.tmp" } @@ -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 @@ -147,3 +144,5 @@ setup() { rm "chart/jenkins-operator/deploy.tmp" } + +#TODO: add another test scenario while installing from kubectl apply