Skip to content

Commit ff8b012

Browse files
committed
make test-stack-command pass
1 parent d8f0c97 commit ff8b012

File tree

1 file changed

+16
-11
lines changed

1 file changed

+16
-11
lines changed

Diff for: scripts/test-stack-command.sh

+16-11
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,12 @@ default_version() {
3232

3333
clean_status_output() {
3434
local output_file="$1"
35-
cat "${output_file}" | grep "" | tr -d ' '
35+
# This removes the 'IMAGE BUILD DATE" and 'VCS REF' columns and
36+
# removes the whitespace between columns.
37+
grep "" "${output_file}" \
38+
| sed 's/│/|/g' \
39+
| cut -d '|' -f 1-4,7- \
40+
| tr -d ' '
3641
}
3742

3843
trap cleanup EXIT
@@ -90,20 +95,20 @@ curl --cacert "${ELASTIC_PACKAGE_CA_CERT}" -f "${ELASTIC_PACKAGE_KIBANA_HOST}/lo
9095
# Check status with running services
9196
cat <<EOF > "${OUTPUT_PATH_STATUS}/expected_running.txt"
9297
Status of Elastic stack services:
93-
╭──────────────────┬─────────┬───────────────────╮
94-
│ SERVICE │ VERSION │ STATUS │
95-
├──────────────────┼─────────┼───────────────────┤
96-
│ elastic-agent │ ${EXPECTED_VERSION} │ running (healthy) │
97-
│ elasticsearch │ ${EXPECTED_VERSION} │ running (healthy) │
98-
│ fleet-server │ ${EXPECTED_VERSION} │ running (healthy) │
99-
│ kibana │ ${EXPECTED_VERSION} │ running (healthy) │
100-
│ package-registry │ latest │ running (healthy) │
101-
╰──────────────────┴─────────┴───────────────────╯
98+
╭──────────────────┬─────────────────────┬───────────────────┬───────────────────┬────────────╮
99+
│ SERVICE │ VERSION │ STATUS │ IMAGE BUILD DATE │ VCS REF
100+
├──────────────────┼─────────────────────┼───────────────────┼───────────────────┼────────────┤
101+
│ elastic-agent │ ${EXPECTED_VERSION} │ running (healthy) │ 2024-08-22T02:44Z │ b96a4ca8fa
102+
│ elasticsearch │ ${EXPECTED_VERSION} │ running (healthy) │ 2024-08-22T13:26Z │ 1362d56865
103+
│ fleet-server │ ${EXPECTED_VERSION} │ running (healthy) │ 2024-08-22T02:44Z │ b96a4ca8fa
104+
│ kibana │ ${EXPECTED_VERSION} │ running (healthy) │ 2024-08-22T11:09Z │ cdcdfddd3f
105+
│ package-registry │ latest │ running (healthy) │ │
106+
╰──────────────────┴─────────────────────┴───────────────────┴───────────────────┴────────────╯
102107
EOF
103108

104109
elastic-package stack status -v 2> "${OUTPUT_PATH_STATUS}/running.txt"
105110

106-
# Remove spaces to avoid issues with spaces between columns
111+
# Remove dates, commit IDs, and spaces to avoid issues.
107112
clean_status_output "${OUTPUT_PATH_STATUS}/expected_running.txt" > "${OUTPUT_PATH_STATUS}/expected_no_spaces.txt"
108113
clean_status_output "${OUTPUT_PATH_STATUS}/running.txt" > "${OUTPUT_PATH_STATUS}/running_no_spaces.txt"
109114

0 commit comments

Comments
 (0)