From c49c1cbf2a3b1d5e5ce5a8ea6a2186ceeea651fa Mon Sep 17 00:00:00 2001 From: mmetc <92726601+mmetc@users.noreply.github.com> Date: Mon, 9 Jan 2023 16:18:06 +0100 Subject: [PATCH] fix alert context CI when feature flags are enabled (#1979) --- tests/README.md | 4 ++++ tests/bats/81_alert_context.bats | 10 +++++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/tests/README.md b/tests/README.md index ce8f0b187..018ca71cd 100644 --- a/tests/README.md +++ b/tests/README.md @@ -296,6 +296,10 @@ can have separated `$output` and `$stderr` variables. The above is better explained in the bats-core tutorial. If you have not read it yet, now is a good time. +For convenience, the `rune` function is an alias for `run --separate-stderr`, which +can be used in most cases. For example, you don't want extraneous log messages in +the way when you check the output of a command. + The `$output` variable gets special treatment with the [bats-support](https://github.com/bats-core/bats-support) and [bats-assert][https://github.com/bats-core/bats-assert) plugins and can be diff --git a/tests/bats/81_alert_context.bats b/tests/bats/81_alert_context.bats index 56463131a..5dbcc7334 100644 --- a/tests/bats/81_alert_context.bats +++ b/tests/bats/81_alert_context.bats @@ -57,11 +57,11 @@ teardown() { sleep 2 rm -f -- "${tmpfile}" - run -0 cscli alerts list -o json - run -0 jq '.[0].id' <(output) + rune -0 cscli alerts list -o json + rune -0 jq '.[0].id' <(output) ALERT_ID="$output" - run -0 cscli alerts inspect "$ALERT_ID" -o json - run -0 jq -c '.meta | sort_by(.key) | map([.key,.value])' <(output) + rune -0 cscli alerts inspect "$ALERT_ID" -o json + rune -0 jq -c '.meta | sort_by(.key) | map([.key,.value])' <(output) assert_json '[["source_host","[\"sd-126005\"]"],["source_ip","[\"1.1.1.172\"]"],["target_user","[\"netflix\"]"]]' -} \ No newline at end of file +}