initial commit
[chaz/docker-connect] / unittest.sh
1
2 temp=$(mktemp -d 2>/dev/null || mktemp -d -t 'test')
3
4 export DOCKER_CONNECT_UNIT_TEST=1
5 export SHELL="$temp/mockshell"
6 export SSH="$temp/mockssh"
7 export socket="$temp/test.sock"
8 export DOCKER_CONNECT_SOCKET="$socket"
9
10 cleanup() {
11 rm -rf "$temp"
12 }
13
14 trap cleanup EXIT
15
16 cat <<'MOCK' >"$SSH"
17 #!/bin/sh
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 MOCK
26 chmod +x "$SHELL"
27
28 make_socket() {
29 SOCKET=$1 perl -MIO::Socket::UNIX \
30 -e 'IO::Socket::UNIX->new(Type => SOCK_STREAM, Local => $ENV{SOCKET}, Listen => 1)'
31 }
32
This page took 0.038288 seconds and 4 git commands to generate.