From ff8b012604b6f18036d65e1b7b970eb9e017ed77 Mon Sep 17 00:00:00 2001 From: Andrew Kroh Date: Thu, 29 Aug 2024 15:04:06 -0400 Subject: [PATCH] make test-stack-command pass --- scripts/test-stack-command.sh | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/scripts/test-stack-command.sh b/scripts/test-stack-command.sh index b057ae16b..5e8b63283 100755 --- a/scripts/test-stack-command.sh +++ b/scripts/test-stack-command.sh @@ -32,7 +32,12 @@ default_version() { clean_status_output() { local output_file="$1" - cat "${output_file}" | grep "│" | tr -d ' ' + # This removes the 'IMAGE BUILD DATE" and 'VCS REF' columns and + # removes the whitespace between columns. + grep "│" "${output_file}" \ + | sed 's/│/|/g' \ + | cut -d '|' -f 1-4,7- \ + | tr -d ' ' } trap cleanup EXIT @@ -90,20 +95,20 @@ curl --cacert "${ELASTIC_PACKAGE_CA_CERT}" -f "${ELASTIC_PACKAGE_KIBANA_HOST}/lo # Check status with running services cat < "${OUTPUT_PATH_STATUS}/expected_running.txt" Status of Elastic stack services: -╭──────────────────┬─────────┬───────────────────╮ -│ SERVICE │ VERSION │ STATUS │ -├──────────────────┼─────────┼───────────────────┤ -│ elastic-agent │ ${EXPECTED_VERSION} │ running (healthy) │ -│ elasticsearch │ ${EXPECTED_VERSION} │ running (healthy) │ -│ fleet-server │ ${EXPECTED_VERSION} │ running (healthy) │ -│ kibana │ ${EXPECTED_VERSION} │ running (healthy) │ -│ package-registry │ latest │ running (healthy) │ -╰──────────────────┴─────────┴───────────────────╯ +╭──────────────────┬─────────────────────┬───────────────────┬───────────────────┬────────────╮ +│ SERVICE │ VERSION │ STATUS │ IMAGE BUILD DATE │ VCS REF │ +├──────────────────┼─────────────────────┼───────────────────┼───────────────────┼────────────┤ +│ elastic-agent │ ${EXPECTED_VERSION} │ running (healthy) │ 2024-08-22T02:44Z │ b96a4ca8fa │ +│ elasticsearch │ ${EXPECTED_VERSION} │ running (healthy) │ 2024-08-22T13:26Z │ 1362d56865 │ +│ fleet-server │ ${EXPECTED_VERSION} │ running (healthy) │ 2024-08-22T02:44Z │ b96a4ca8fa │ +│ kibana │ ${EXPECTED_VERSION} │ running (healthy) │ 2024-08-22T11:09Z │ cdcdfddd3f │ +│ package-registry │ latest │ running (healthy) │ │ │ +╰──────────────────┴─────────────────────┴───────────────────┴───────────────────┴────────────╯ EOF elastic-package stack status -v 2> "${OUTPUT_PATH_STATUS}/running.txt" -# Remove spaces to avoid issues with spaces between columns +# Remove dates, commit IDs, and spaces to avoid issues. clean_status_output "${OUTPUT_PATH_STATUS}/expected_running.txt" > "${OUTPUT_PATH_STATUS}/expected_no_spaces.txt" clean_status_output "${OUTPUT_PATH_STATUS}/running.txt" > "${OUTPUT_PATH_STATUS}/running_no_spaces.txt"