Skip to content

Commit

Permalink
make test-stack-command pass
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewkroh committed Aug 29, 2024
1 parent d8f0c97 commit ff8b012
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions scripts/test-stack-command.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -90,20 +95,20 @@ curl --cacert "${ELASTIC_PACKAGE_CA_CERT}" -f "${ELASTIC_PACKAGE_KIBANA_HOST}/lo
# Check status with running services
cat <<EOF > "${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"

Expand Down

0 comments on commit ff8b012

Please sign in to comment.