initial commit
[chaz/docker-connect] / t / 01-basic.sh
1 #!/bin/sh
2
3 . ./unittest.sh
4 . ./tap.sh
5
6 plan 14
7
8 cat <<'MOCK' >"$SSH"
9 #!/bin/sh
10 . ./tap.sh
11 next_test_number=1
12 note 'ssh args:' "$@"
13 is "$1", 'foo', 'ssh: correct hostname'
14 is "$2", "-L$socket:/run/docker.sock", 'ssh: local port forwarding flag'
15 is "$3", '-oControlPath=none', 'ssh: disable control path option'
16 is "$4", '-oConnectTimeout=15', 'ssh: connection timeout option'
17 is "$5", '-nNT', 'ssh: terminal and other flags'
18 perl -MIO::Socket::UNIX \
19 -e 'IO::Socket::UNIX->new(Type => SOCK_STREAM, Local => $ENV{socket}, Listen => 1)'
20 MOCK
21 chmod +x "$SSH"
22
23 cat <<'MOCK' >"$SHELL"
24 #!/bin/sh
25 . ./tap.sh
26 next_test_number=6
27 note 'shell args:' "$@"
28 is "$1" "bar" "shell: first shell arg is correct"
29 is "$2" "baz" "shell: second shell arg is correct"
30 is "$DOCKER_HOST" "unix://$socket" "shell: DOCKER_HOST is correct"
31 is "$DOCKER_CONNECT_HOSTNAME" "foo" "shell: DOCKER_CONNECT_HOSTNAME is correct"
32 is "$DOCKER_CONNECT_SOCKET" "$socket" "shell: DOCKER_CONNECT_SOCKET is correct"
33 ok '-n "$DOCKER_CONNECT_PID"' "shell: DOCKER_CONNECT_PID is set"
34 ok '-z "$DOCKER_MACHINE_NAME"' "shell: DOCKER_MACHINE_NAME is unset"
35 ok '-z "$DOCKER_CERT_PATH"' "shell: DOCKER_CERT_PATH is unset"
36 ok '-z "$DOCKER_TLS_VERIFY"' "shell: DOCKER_TLS_VERIFY is unset"
37 MOCK
38 chmod +x "$SHELL"
39
40 export DOCKER_MACHINE_NAME="qux"
41 export DOCKER_CERT_PATH="/somewhere"
42 export DOCKER_TLS_VERIFY=1
43
44 ./docker-connect -qqq foo bar baz
45
This page took 0.040448 seconds and 4 git commands to generate.