Skip to content

Commit 77a3b32

Browse files
committed
test: use [[ ]] for conditional tests in the mooncake image scripts
Switch reportSummary.sh's empty-response guard to [[ ]] as requested in review. custom-entrypoint.sh needs its shebang changed along with the brackets. It ran under #!/bin/sh, where /bin/sh is dash on the Debian-based python:3.12-slim image, and dash has no [[ builtin: it resolves [[ as a command name, fails with "[[: not found" and evaluates the condition as false. Both guards in that script -- the unsupported-action check and the FLUID_RUNTIME_CONFIG_PATH check -- would silently stop rejecting anything while still exiting 0. The image ships bash, so the script now declares it.
1 parent 125a264 commit 77a3b32

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

test/gha-e2e/mooncake/image/custom-entrypoint.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/sh
1+
#!/bin/bash
22
# Component entrypoint invoked by Fluid's CacheRuntime.
33
# Usage: /custom-entrypoint.sh <master|worker|client> start
44

@@ -7,7 +7,7 @@ set -e
77
ROLE="$1"
88
ACTION="$2"
99

10-
if [ "$ACTION" != "start" ]; then
10+
if [[ "$ACTION" != "start" ]]; then
1111
echo "Error: unsupported action '$ACTION'"
1212
exit 1
1313
fi
@@ -27,7 +27,7 @@ case "$ROLE" in
2727

2828
worker)
2929
# Read the runtime config JSON that Fluid mounts into the component pod.
30-
if [ -z "$FLUID_RUNTIME_CONFIG_PATH" ] || [ ! -f "$FLUID_RUNTIME_CONFIG_PATH" ]; then
30+
if [[ -z "$FLUID_RUNTIME_CONFIG_PATH" ]] || [[ ! -f "$FLUID_RUNTIME_CONFIG_PATH" ]]; then
3131
echo "Error: FLUID_RUNTIME_CONFIG_PATH not set or file not found"
3232
exit 1
3333
fi

test/gha-e2e/mooncake/image/reportSummary.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ set -euo pipefail
66

77
RAW=$(curl -s http://localhost:9003/metrics/summary)
88

9-
if [ -z "$RAW" ]; then
9+
if [[ -z "$RAW" ]]; then
1010
echo "Error: empty response from metrics endpoint" >&2
1111
exit 1
1212
fi

0 commit comments

Comments
 (0)