fix the compose call: it never worked outside --dry-run
Setting IFS to a newline to pass the environment also stopped the command line from splitting, so '-f a -f b' went out as a single argument and the two words 'docker compose' were looked up as one program name. Every real command was broken; only --dry-run, which prints a string, looked right. The variables are now exported in a subshell instead of going through env(1), which keeps values with spaces intact and leaves the command line to normal word splitting. The tests only checked what --dry-run printed, which is why they missed it. spec/unit/compose_spec.sh now asserts the argv that is actually executed, for both the plugin and the standalone binary.
This commit is contained in:
@@ -1,6 +1,10 @@
|
||||
#!/bin/sh
|
||||
# Mock docker for myos tests: logs every call, answers a few read-only queries deterministically.
|
||||
[ -n "${MYOS_DOCKER_LOG:-}" ] && printf 'docker %s\n' "$*" >> "$MYOS_DOCKER_LOG"
|
||||
if [ -n "${MYOS_DOCKER_LOG:-}" ]; then
|
||||
printf 'docker %s\n' "$*" >> "$MYOS_DOCKER_LOG"
|
||||
# the environment is recorded too, so a test can assert what was exported
|
||||
env > "$(dirname "$MYOS_DOCKER_LOG")/env.log"
|
||||
fi
|
||||
case "$1 $2" in
|
||||
"compose version") echo "${MOCK_COMPOSE_VERSION:-2.29.0}" ;;
|
||||
"compose config") echo "# mock compose config" ;;
|
||||
|
||||
Reference in New Issue
Block a user