diff options
author | Clement Delafargue <clement.delafargue@fretlink.com> | 2020-06-30 09:30:04 +0200 |
---|---|---|
committer | Clement Delafargue <clement.delafargue@fretlink.com> | 2020-06-30 15:31:57 +0200 |
commit | 783f91c2e0228ef9e057b810b4b60c4f669ebab4 (patch) | |
tree | fefb7204dca70fbce021a0067bc79612d6ec11b3 /tests | |
parent | facc275a703d3bccc320e5577eb3d050f99dff0e (diff) | |
download | ansible-clever-783f91c2e0228ef9e057b810b4b60c4f669ebab4.tar.gz ansible-clever-783f91c2e0228ef9e057b810b4b60c4f669ebab4.tar.zst ansible-clever-783f91c2e0228ef9e057b810b4b60c4f669ebab4.zip |
Make commit ids overridable in the script mock
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/fake.sh | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/tests/fake.sh b/tests/fake.sh index bbb4380..0303b61 100755 --- a/tests/fake.sh +++ b/tests/fake.sh | |||
@@ -1,14 +1,17 @@ | |||
1 | #!/usr/bin/env bash | 1 | #!/usr/bin/env bash |
2 | 2 | ||
3 | binary="${0/*\/}" | 3 | binary="${0/*\/}" |
4 | fakeCommit="aaa000aaa000aaa000aaa000aaa000aaa000aaa0" | 4 | localCommit="${PRETEND_LOCAL_COMMIT:-aaa000aaa000aaa000aaa000aaa000aaa000aaa0}" |
5 | remoteCommit="${PRETEND_REMOTE_COMMIT:-bbb000bbb000bbb000bbb000bbb000bbb000bbb0}" | ||
5 | 6 | ||
6 | if [ "${binary}" = "clever" ] && [ "${1}" = "--version" ]; then | 7 | if [ "${binary}" = "clever" ] && [ "${1}" = "--version" ]; then |
7 | echo "2.6.1" | 8 | echo "2.6.1" |
8 | elif [ "${binary}" = "clever" ] && [ "${1}" = "activity" ]; then | 9 | elif [ "${binary}" = "clever" ] && [ "${1}" = "activity" ]; then |
9 | echo "2020-02-02T20:20:02+02:00 OK DEPLOY ${fakeCommit} Git" | 10 | echo "2020-02-02T20:20:02+02:00 OK DEPLOY ${remoteCommit} Git" |
11 | elif [ "${binary}" = "clever" ] && [ "${1}" = "status" ]; then | ||
12 | echo "test-app: running (1*pico, Commit: ${remoteCommit})" | ||
10 | elif [ "${binary}" = "git" ]; then | 13 | elif [ "${binary}" = "git" ]; then |
11 | echo "${fakeCommit}" | 14 | echo "${localCommit}" |
12 | else | 15 | else |
13 | echo "${1}" >> "${binary}-commands" | 16 | echo "${1}" >> "${binary}-commands" |
14 | echo "${binary} called with arguments: ${*}" | 17 | echo "${binary} called with arguments: ${*}" |