feat: add json format output to cron:list command

This makes it easier to parse output in a machine-readable format - such as when interacting with cron tasks via jq for writing tests.
This commit is contained in:
Jose Diaz-Gonzalez
2023-07-02 04:36:08 -04:00
parent afc318526c
commit 820883e60c
6 changed files with 66 additions and 16 deletions

View File

@@ -177,6 +177,26 @@ teardown() {
assert_failure
}
@test "(cron) cron:list --format json" {
run deploy_app python dokku@dokku.me:$TEST_APP template_cron_file_valid
echo "output: $output"
echo "status: $status"
assert_success
run /bin/bash -c "dokku cron:list $TEST_APP --format json"
echo "output: $output"
echo "status: $status"
assert_success
assert_output_exists
cron_id="$(dokku cron:list $TEST_APP --format json | jq -r '.[0].id')"
run /bin/bash -c "echo $cron_id"
echo "output: $output"
echo "status: $status"
assert_success
assert_output_exists
}
template_cron_file_invalid() {
local APP="$1"
local APP_REPO_DIR="$2"