diff --git a/tests/3-continuous_manage_queues_validation.bats b/tests/3-continuous_manage_queues_validation.bats index 45754f72..671d45e8 100755 --- a/tests/3-continuous_manage_queues_validation.bats +++ b/tests/3-continuous_manage_queues_validation.bats @@ -5,36 +5,37 @@ load libs/shared_setup setup () { export WORKSPACE=$gitdir - # Some dummy variables just for the sake of the tests. + # Some dummy variables just for the sake of the letting the script proceed through the validation. export jiraclicmd=jiracli export jiraserver=https://tracker.moodle.org export jirauser=jirauser export jirapass=jirapass - # Just do a dry run. Because if the test tries to actually connect to the server it will fail. - # But we'll confirm validation succeeds when the dry run message comes up. - export dryrun=1 + ci_run source tracker_automations/continuous_manage_queues/lib.sh } @test "tracker_automations/continuous_manage_queues/continuous_manage_queues.sh: Current date < release date" { - export releasedate=$(date -d "+10day" +%Y-%m-%d) - ci_run tracker_automations/continuous_manage_queues/continuous_manage_queues.sh + releasedate=$(date -d "+10day" +%Y-%m-%d) + + run_param_validation $releasedate # Assert result. - assert_output --partial "Dry-run enabled, no changes will be performed to the tracker" + assert_output --partial "Parameters validated." } @test "tracker_automations/continuous_manage_queues/continuous_manage_queues.sh: Current date = on-sync date" { - export releasedate=$(date -d "-28day" +%Y-%m-%d) - ci_run tracker_automations/continuous_manage_queues/continuous_manage_queues.sh + releasedate=$(date -d "-28day" +%Y-%m-%d) + + run_param_validation $releasedate # Assert result. - assert_output --partial "Dry-run enabled, no changes will be performed to the tracker" + assert_output --partial "Parameters validated." } @test "tracker_automations/continuous_manage_queues/continuous_manage_queues.sh: Current date > on-sync date" { - export releasedate=$(date -d "-29day" +%Y-%m-%d) - ci_run tracker_automations/continuous_manage_queues/continuous_manage_queues.sh + releasedate=$(date -d "-29day" +%Y-%m-%d) + + run_param_validation $releasedate # Assert result. assert_failure @@ -42,9 +43,10 @@ setup () { } @test "tracker_automations/continuous_manage_queues/continuous_manage_queues.sh: Invalid release date format" { - export releasedate=$(date +%m-%d-%Y) - export lastweekdate=$(date +%Y-%m-%d) - ci_run tracker_automations/continuous_manage_queues/continuous_manage_queues.sh + releasedate=$(date +%m-%d-%Y) + lastweekdate=$(date +%Y-%m-%d) + + run_param_validation $releasedate $lastweekdate # Assert result. assert_failure @@ -52,9 +54,10 @@ setup () { } @test "tracker_automations/continuous_manage_queues/continuous_manage_queues.sh: Invalid last week date format" { - export releasedate=$(date -d "+7day" +%Y-%m-%d) - export lastweekdate=$(date +%m-%d-%Y) - ci_run tracker_automations/continuous_manage_queues/continuous_manage_queues.sh + releasedate=$(date -d "+7day" +%Y-%m-%d) + lastweekdate=$(date +%m-%d-%Y) + + run_param_validation $releasedate $lastweekdate # Assert result. assert_failure