#!/bin/sh # splinter -- one named delegate, no model: the diagnostic path. # # This is how a failing delegate is inspected: the observation carries the # child's exit status, its own error text and the job line. The fake ssh is # the far side, so no network and no account is involved. set -u # splinter reads a piped stdin as context; without a terminal that waits for EOF. exec "$D/ssh" chmod +x "$D/ssh" cat > "$D/conf" <<'EOF' delegate = fake | ein fake | host=fakehost | endpoint=http://example/v1 | model=m | tags=x EOF out=$(PATH="$D:$PATH" HOME="$D/home" ./splinter --config "$D/conf" \ --delegate fake -p "hallo" 2>&1) echo "$out" | grep -q -F '[delegate fake' check test $? -eq 0 echo "$out" | grep -q 'antwort von der cli' check test $? -eq 0 # the tool reports an unknown delegate instead of guessing out=$(PATH="$D:$PATH" HOME="$D/home" ./splinter --config "$D/conf" \ --delegate nosuch -p "hallo" 2>&1) echo "$out" | grep -q 'no delegate matches' check test $? -eq 0 # the task is required PATH="$D:$PATH" HOME="$D/home" ./splinter --config "$D/conf" \ --delegate fake >/dev/null 2>"$D/err" check test $? -eq 2 grep -q 'needs -p TEXT' "$D/err" check test $? -eq 0 if [ "$fails" -eq 0 ]; then echo "test_delegate_cli: ok"; exit 0; fi exit 1