Skip to content
This repository was archived by the owner on Oct 19, 2022. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
include:
- language: go
go: 1.8.x
env: TESTFILE=unit.sh
env: RULE=test-unit
- language: go
go: 1.9.x
env: TESTFILE=unit.sh
env: RULE=test-unit
- language: go
go: master
env: TESTFILE=unit.sh
env: RULE=test-unit
- language: generic
sudo: required
services:
Expand All @@ -22,7 +22,7 @@
- sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
- sudo apt-get update
- sudo apt-get -y install docker-ce
env: TESTFILE=integration.sh
env: RULE=test-integration

script:
- ./.travis/$TESTFILE
- make $RULE
69 changes: 0 additions & 69 deletions .travis/integration.sh

This file was deleted.

10 changes: 10 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,13 @@ enable:
push: clean rootfs create enable
@echo "### push plugin ${PLUGIN_NAME}:${PLUGIN_TAG}"
@docker plugin push ${PLUGIN_NAME}:${PLUGIN_TAG}

test: test-unit test-integration

test-unit:
@echo "### unit tests"
./tests/unit.sh

test-integration:
@echo "### integration tests"
./tests/integration.sh
66 changes: 66 additions & 0 deletions tests/integration.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
#!/bin/bash

set -e
set -x

TAG=test


# install
docker pull rastasheep/ubuntu-sshd
docker pull busybox

docker build -t sshd tests/testdata
#script

# make the plugin
PLUGIN_TAG=$TAG make
# enable the plugin
docker plugin enable vieux/sshfs:$TAG
# list plugins
docker plugin ls
# start sshd
docker run --name sshd -d -p 2222:22 sshd

# test1: simple
docker volume create -d vieux/sshfs:$TAG -o sshcmd=root@localhost:/ -o port=2222 -o password=root sshvolume
docker run --rm -v sshvolume:/write busybox sh -c "echo hello > /write/world"
docker run --rm -v sshvolume:/read busybox grep -Fxq hello /read/world
docker volume rm sshvolume

# test2: allow_other
docker volume create -d vieux/sshfs:$TAG -o sshcmd=root@localhost:/ -o allow_other -o port=2222 -o password=root sshvolume
docker run --rm -v sshvolume:/write -u nobody busybox sh -c "echo hello > /write/world"
docker run --rm -v sshvolume:/read -u nobody busybox grep -Fxq hello /read/world
docker volume rm sshvolume

# test3: compression
docker volume create -d vieux/sshfs:$TAG -o sshcmd=root@localhost:/ -o Ciphers=arcfour -o Compression=no -o port=2222 -o password=root sshvolume
docker run --rm -v sshvolume:/write busybox sh -c "echo hello > /write/world"
docker run --rm -v sshvolume:/read busybox grep -Fxq hello /read/world
docker volume rm sshvolume

# test4: restart
docker volume create -d vieux/sshfs:$TAG -o sshcmd=root@localhost:/ -o port=2222 -o password=root sshvolume
docker run --rm -v sshvolume:/write busybox sh -c "echo hello > /write/world"
(sleep 2; docker restart sshd) &
docker run --rm -v sshvolume:/read busybox sh -c "sleep 4 ; grep -Fxq hello /read/world"
docker volume rm sshvolume

# test5: source
docker plugin disable vieux/sshfs:$TAG
docker plugin set vieux/sshfs:$TAG state.source=/tmp
docker plugin enable vieux/sshfs:$TAG
docker volume create -d vieux/sshfs:$TAG -o sshcmd=root@localhost:/ -o Ciphers=arcfour -o Compression=no -o port=2222 -o password=root sshvolume
docker run --rm -v sshvolume:/write busybox sh -c "echo hello > /write/world"
docker run --rm -v sshvolume:/read busybox grep -Fxq hello /read/world
docker volume rm sshvolume

# test6: ssh key
docker plugin disable vieux/sshfs:$TAG
docker plugin set vieux/sshfs:$TAG sshkey.source=`pwd`/tests/testdata/
docker plugin enable vieux/sshfs:$TAG
docker volume create -d vieux/sshfs:$TAG -o sshcmd=root@localhost:/ -o port=2222 sshvolume
docker run --rm -v sshvolume:/write busybox sh -c "echo hello > /write/world"
docker run --rm -v sshvolume:/read busybox grep -Fxq hello /read/world
docker volume rm sshvolume
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.