-
Notifications
You must be signed in to change notification settings - Fork 184
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
55 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
#!/bin/bash | ||
run_test() { | ||
local name=$1 | ||
local node=$2 | ||
local script=$3 | ||
echo "==== test: $1 (node: $2) ====" | ||
|
||
local expected="$(mktemp)" | ||
local got="$(mktemp)" | ||
|
||
if diff --strip-trailing-cr -u <(sh -c "$script") <(set -x; ./kubectl-node_shell $node -- sh -c "$script"); then | ||
echo -e "Result: \e[42mPASS\e[49m" | ||
else | ||
echo -e "Result: \e[101mFAIL\e[49m" | ||
fi | ||
} | ||
|
||
if [ -z $1 ]; then | ||
echo "please specify node in first argument" >&2 | ||
exit -1 | ||
fi | ||
|
||
case1=$(cat <<\EOT | ||
echo $(echo " | ||
hello everybody | ||
I'm a \"baby seal\"" | ||
) | ||
EOT | ||
) | ||
|
||
case2=$(cat <<\EOT | ||
echo "ggg | ||
ttt" | ||
EOT | ||
) | ||
|
||
case3=$(cat <<\EOT | ||
echo $(echo " | ||
hello everybody | ||
I'm a \"baby seal | ||
really really | ||
\"" | ||
) | ||
EOT | ||
) | ||
|
||
run_test "case 1" "$1" "$case1" | ||
run_test "case 2" "$1" "$case2" | ||
run_test "case 3" "$1" "$case3" |