Skip to content
This repository was archived by the owner on Oct 19, 2022. It is now read-only.

Commit 6c308a5

Browse files
committed
add restart test
Signed-off-by: Victor Vieux <victorvieux@gmail.com>
1 parent 94afd32 commit 6c308a5

File tree

1 file changed

+40
-43
lines changed

1 file changed

+40
-43
lines changed

tests/integration.sh

Lines changed: 40 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -5,65 +5,62 @@ set -x
55

66
TAG=test
77

8-
# before_install
9-
#curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
10-
#sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
11-
#sudo apt-get update
12-
#sudo apt-get -y install docker-ce
138

149
# install
15-
sudo docker pull rastasheep/ubuntu-sshd
16-
sudo docker pull busybox
10+
docker pull rastasheep/ubuntu-sshd
11+
docker pull busybox
1712

1813
docker build -t sshd tests/testdata
1914
#script
2015

2116
# make the plugin
22-
sudo PLUGIN_TAG=$TAG make
17+
PLUGIN_TAG=$TAG make
2318
# enable the plugin
24-
sudo docker plugin enable vieux/sshfs:$TAG
19+
docker plugin enable vieux/sshfs:$TAG
2520
# list plugins
26-
sudo docker plugin ls
21+
docker plugin ls
2722
# start sshd
28-
sudo docker run -d -p 2222:22 sshd
23+
docker run --name sshd -d -p 2222:22 sshd
2924

3025
# test1: simple
31-
sudo docker volume create -d vieux/sshfs:$TAG -o sshcmd=root@localhost:/ -o port=2222 -o password=root sshvolume
32-
sudo docker run --rm -v sshvolume:/write busybox sh -c "echo hello > /write/world"
33-
sudo docker run --rm -v sshvolume:/read busybox grep -Fxq hello /read/world
34-
#sudo cat /var/lib/docker/plugins/sshfs-state.json
35-
sudo docker volume rm sshvolume
26+
docker volume create -d vieux/sshfs:$TAG -o sshcmd=root@localhost:/ -o port=2222 -o password=root sshvolume
27+
docker run --rm -v sshvolume:/write busybox sh -c "echo hello > /write/world"
28+
docker run --rm -v sshvolume:/read busybox grep -Fxq hello /read/world
29+
docker volume rm sshvolume
3630

3731
# test2: allow_other
38-
sudo docker volume create -d vieux/sshfs:$TAG -o sshcmd=root@localhost:/ -o allow_other -o port=2222 -o password=root sshvolume
39-
sudo docker run --rm -v sshvolume:/write -u nobody busybox sh -c "echo hello > /write/world"
32+
docker volume create -d vieux/sshfs:$TAG -o sshcmd=root@localhost:/ -o allow_other -o port=2222 -o password=root sshvolume
33+
docker run --rm -v sshvolume:/write -u nobody busybox sh -c "echo hello > /write/world"
4034
docker run --rm -v sshvolume:/read -u nobody busybox grep -Fxq hello /read/world
41-
#sudo cat /var/lib/docker/plugins/sshfs-state.json
42-
sudo docker volume rm sshvolume
35+
docker volume rm sshvolume
4336

4437
# test3: compression
45-
sudo docker volume create -d vieux/sshfs:$TAG -o sshcmd=root@localhost:/ -o Ciphers=arcfour -o Compression=no -o port=2222 -o password=root sshvolume
46-
sudo docker run --rm -v sshvolume:/write busybox sh -c "echo hello > /write/world"
47-
sudo docker run --rm -v sshvolume:/read busybox grep -Fxq hello /read/world
48-
#sudo cat /var/lib/docker/plugins/sshfs-state.json
49-
sudo docker volume rm sshvolume
38+
docker volume create -d vieux/sshfs:$TAG -o sshcmd=root@localhost:/ -o Ciphers=arcfour -o Compression=no -o port=2222 -o password=root sshvolume
39+
docker run --rm -v sshvolume:/write busybox sh -c "echo hello > /write/world"
40+
docker run --rm -v sshvolume:/read busybox grep -Fxq hello /read/world
41+
docker volume rm sshvolume
5042

51-
# test4: source
52-
sudo docker plugin disable vieux/sshfs:$TAG
53-
sudo docker plugin set vieux/sshfs:$TAG state.source=/tmp
54-
sudo docker plugin enable vieux/sshfs:$TAG
55-
sudo docker volume create -d vieux/sshfs:$TAG -o sshcmd=root@localhost:/ -o Ciphers=arcfour -o Compression=no -o port=2222 -o password=root sshvolume
56-
sudo docker run --rm -v sshvolume:/write busybox sh -c "echo hello > /write/world"
57-
sudo docker run --rm -v sshvolume:/read busybox grep -Fxq hello /read/world
58-
#sudo cat /tmp/sshfs-state.json
59-
sudo docker volume rm sshvolume
43+
# test4: restart
44+
docker volume create -d vieux/sshfs:$TAG -o sshcmd=root@localhost:/ -o port=2222 -o password=root sshvolume
45+
docker run --rm -v sshvolume:/write busybox sh -c "echo hello > /write/world"
46+
(sleep 2; docker restart sshd) &
47+
docker run --rm -v sshvolume:/read busybox sh -c "sleep 4 ; grep -Fxq hello /read/world"
48+
docker volume rm sshvolume
6049

61-
# test5: ssh key
62-
sudo docker plugin disable vieux/sshfs:$TAG
63-
sudo docker plugin set vieux/sshfs:$TAG sshkey.source=`pwd`/test/testdata/
64-
sudo docker plugin enable vieux/sshfs:$TAG
65-
sudo docker volume create -d vieux/sshfs:$TAG -o sshcmd=root@localhost:/ -o port=2222 sshvolume
66-
sudo docker run --rm -v sshvolume:/write busybox sh -c "echo hello > /write/world"
67-
sudo docker run --rm -v sshvolume:/read busybox grep -Fxq hello /read/world
68-
#sudo cat /var/lib/docker/plugins/sshfs-state.json
69-
sudo docker volume rm sshvolume
50+
# test5: source
51+
docker plugin disable vieux/sshfs:$TAG
52+
docker plugin set vieux/sshfs:$TAG state.source=/tmp
53+
docker plugin enable vieux/sshfs:$TAG
54+
docker volume create -d vieux/sshfs:$TAG -o sshcmd=root@localhost:/ -o Ciphers=arcfour -o Compression=no -o port=2222 -o password=root sshvolume
55+
docker run --rm -v sshvolume:/write busybox sh -c "echo hello > /write/world"
56+
docker run --rm -v sshvolume:/read busybox grep -Fxq hello /read/world
57+
docker volume rm sshvolume
58+
59+
# test6: ssh key
60+
docker plugin disable vieux/sshfs:$TAG
61+
docker plugin set vieux/sshfs:$TAG sshkey.source=`pwd`/tests/testdata/
62+
docker plugin enable vieux/sshfs:$TAG
63+
docker volume create -d vieux/sshfs:$TAG -o sshcmd=root@localhost:/ -o port=2222 sshvolume
64+
docker run --rm -v sshvolume:/write busybox sh -c "echo hello > /write/world"
65+
docker run --rm -v sshvolume:/read busybox grep -Fxq hello /read/world
66+
docker volume rm sshvolume

0 commit comments

Comments
 (0)