Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: implement a framework for starting test servers during tests
Test servers are implemented by docker containers and run real servers for rclone to test against.
- Loading branch information
Showing
24 changed files
with
687 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# A very minimal sftp server for integration testing rclone | ||
FROM alpine:latest | ||
|
||
# User rclone, password password | ||
RUN \ | ||
apk add openssh && \ | ||
ssh-keygen -A && \ | ||
adduser -D rclone && \ | ||
echo "rclone:password" | chpasswd | ||
|
||
ENTRYPOINT [ "/usr/sbin/sshd", "-D" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Test SFTP Openssh | ||
|
||
This is a docker image for rclone's integration tests which runs an | ||
openssh server in a docker image. | ||
|
||
## Build | ||
|
||
``` | ||
docker build --rm -t rclone/test-sftp-openssh . | ||
docker push rclone/test-sftp-openssh | ||
``` | ||
|
||
# Test | ||
|
||
``` | ||
rclone lsf -R --sftp-host 172.17.0.2 --sftp-user rclone --sftp-pass $(rclone obscure password) :sftp: | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
This directory contains scripts to start and stop servers for testing. | ||
|
||
The commands are named after the remotes in use. They should be | ||
executable files with the following parameters: | ||
|
||
start - starts the server | ||
stop - stops the server | ||
status - returns non-zero exit code if the server is not running | ||
|
||
These will be called automatically by test_all if that remote is | ||
required. | ||
|
||
When start is run it should output config parameters for that remote. | ||
If a `_connect` parameter is output then that will be used for a | ||
connection test. For example if `_connect=127.0.0.1:80` then a TCP | ||
connection will be made to `127.0.0.1:80` and only when that succeeds | ||
will the test continue. | ||
|
||
`run.bash` contains boilerplate to be included in a bash script for | ||
interpreting the command line parameters. | ||
|
||
`docker.bash` contains library functions to help with docker | ||
implementations. | ||
|
||
## TODO | ||
|
||
- sftpd - https://github.com/panubo/docker-sshd ? | ||
- openstack swift - https://github.com/bouncestorage/docker-swift | ||
- ceph - https://github.com/ceph/cn | ||
- other ftp servers | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
NAME=proftpd | ||
USER=rclone | ||
PASS=RaidedBannedPokes5 | ||
|
||
. $(dirname "$0")/docker.bash | ||
|
||
start() { | ||
docker run --rm -d --name $NAME \ | ||
-e "FTP_USERNAME=rclone" \ | ||
-e "FTP_PASSWORD=$PASS" \ | ||
hauptmedia/proftpd | ||
|
||
echo type=ftp | ||
echo host=$(docker_ip) | ||
echo user=$USER | ||
echo pass=$(rclone obscure $PASS) | ||
echo _connect=$(docker_ip):21 | ||
} | ||
|
||
. $(dirname "$0")/run.bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
NAME=pureftpd | ||
USER=rclone | ||
PASS=AcridSpiesBooks2 | ||
|
||
. $(dirname "$0")/docker.bash | ||
|
||
start() { | ||
docker run --rm -d --name $NAME \ | ||
-e "FTP_USER_NAME=rclone" \ | ||
-e "FTP_USER_PASS=$PASS" \ | ||
-e "FTP_USER_HOME=/data" \ | ||
-e "FTP_MAX_CLIENTS=50" \ | ||
-e "FTP_MAX_CONNECTIONS=50" \ | ||
-e "FTP_PASSIVE_PORTS=30000:40000" \ | ||
stilliard/pure-ftpd | ||
|
||
echo type=ftp | ||
echo host=$(docker_ip) | ||
echo user=$USER | ||
echo pass=$(rclone obscure $PASS) | ||
echo _connect=$(docker_ip):21 | ||
} | ||
|
||
. $(dirname "$0")/run.bash |
Oops, something went wrong.