Skip to content

Commit ce0cbeb

Browse files
committed
make test-stack-command pass
1 parent 580af78 commit ce0cbeb

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

scripts/test-stack-command.sh

+15-11
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,11 @@ 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+
| cut -d '' -f 1-4,7- \
39+
| tr -d ' '
3640
}
3741

3842
trap cleanup EXIT
@@ -90,20 +94,20 @@ curl --cacert "${ELASTIC_PACKAGE_CA_CERT}" -f "${ELASTIC_PACKAGE_KIBANA_HOST}/lo
9094
# Check status with running services
9195
cat <<EOF > "${OUTPUT_PATH_STATUS}/expected_running.txt"
9296
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-
╰──────────────────┴─────────┴───────────────────╯
97+
╭──────────────────┬─────────────────────┬───────────────────┬───────────────────┬────────────╮
98+
│ SERVICE │ VERSION │ STATUS │ IMAGE BUILD DATE │ VCS REF
99+
├──────────────────┼─────────────────────┼───────────────────┼───────────────────┼────────────┤
100+
│ elastic-agent │ ${EXPECTED_VERSION} │ running (healthy) │ 2024-08-22T02:44Z │ b96a4ca8fa
101+
│ elasticsearch │ ${EXPECTED_VERSION} │ running (healthy) │ 2024-08-22T13:26Z │ 1362d56865
102+
│ fleet-server │ ${EXPECTED_VERSION} │ running (healthy) │ 2024-08-22T02:44Z │ b96a4ca8fa
103+
│ kibana │ ${EXPECTED_VERSION} │ running (healthy) │ 2024-08-22T11:09Z │ cdcdfddd3f
104+
│ package-registry │ latest │ running (healthy) │ │
105+
╰──────────────────┴─────────────────────┴───────────────────┴───────────────────┴────────────╯
102106
EOF
103107

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

106-
# Remove spaces to avoid issues with spaces between columns
110+
# Remove dates, commit IDs, and spaces to avoid issues.
107111
clean_status_output "${OUTPUT_PATH_STATUS}/expected_running.txt" > "${OUTPUT_PATH_STATUS}/expected_no_spaces.txt"
108112
clean_status_output "${OUTPUT_PATH_STATUS}/running.txt" > "${OUTPUT_PATH_STATUS}/running_no_spaces.txt"
109113

0 commit comments

Comments
 (0)