1
mirror of https://github.com/rclone/rclone synced 2024-12-25 17:03:45 +01:00

testserver: Make Test{FTP,SFTP,Webdav}Rclone run the current rclone

Before this change the tests were run against the previous stable
rclone/rclone docker image.

This unfortunately masked errors in the integration test server.

This change uses the currently installed rclone to run "rclone serve
ftp" etc. This is installed out of the current code by the integration
test server so will make a better test.
This commit is contained in:
Nick Craig-Wood 2020-11-10 18:01:15 +00:00
parent f980f230c5
commit 45e8bea8d0
4 changed files with 61 additions and 24 deletions

View File

@ -5,19 +5,18 @@ set -e
NAME=rclone-serve-ftp
USER=rclone
PASS=FuddleIdlingJell5
. $(dirname "$0")/docker.bash
IP=127.0.0.1
PORT=28622
start() {
docker run --rm -d --name $NAME \
rclone/rclone \
serve ftp --user $USER --pass $PASS --addr :21 /data
run rclone serve ftp --user $USER --pass $PASS --addr ${IP}:${PORT} ${DATADIR}
echo type=ftp
echo host=$(docker_ip)
echo host=${IP}
echo port=$PORT
echo user=$USER
echo pass=$(rclone obscure $PASS)
echo _connect=$(docker_ip):21
echo _connect=${IP}:${PORT}
}
. $(dirname "$0")/run.bash
. $(dirname "$0")/rclone-serve.bash

View File

@ -5,19 +5,18 @@ set -e
NAME=rclone-serve-sftp
USER=rclone
PASS=CranesBallotDorsey5
. $(dirname "$0")/docker.bash
IP=127.0.0.1
PORT=28621
start() {
docker run --rm -d --name $NAME \
rclone/rclone \
serve sftp --user $USER --pass $PASS --addr :22 /data
run rclone serve sftp --user $USER --pass $PASS --addr ${IP}:${PORT} ${DATADIR}
echo type=sftp
echo host=$(docker_ip)
echo host=${IP}
echo port=$PORT
echo user=$USER
echo pass=$(rclone obscure $PASS)
echo _connect=$(docker_ip):22
echo _connect=${IP}:${PORT}
}
. $(dirname "$0")/run.bash
. $(dirname "$0")/rclone-serve.bash

View File

@ -5,19 +5,17 @@ set -e
NAME=rclone-serve-webdav
USER=rclone
PASS=PagansSwimExpiry9
. $(dirname "$0")/docker.bash
IP=127.0.0.1
PORT=28620
start() {
docker run --rm -d --name $NAME \
rclone/rclone \
serve webdav --user $USER --pass $PASS --addr :80 /data
run rclone serve webdav --user $USER --pass $PASS --addr ${IP}:${PORT} ${DATADIR}
echo type=webdav
echo url=http://$(docker_ip)/
echo url=http://${IP}:${PORT}/
echo user=$USER
echo pass=$(rclone obscure $PASS)
echo _connect=$(docker_ip):80
echo _connect=${IP}:$PORT
}
. $(dirname "$0")/run.bash
. $(dirname "$0")/rclone-serve.bash

View File

@ -0,0 +1,41 @@
#!/bin/bash
# start an "rclone serve" server
PIDFILE=/tmp/${NAME}.pid
DATADIR=/tmp/${NAME}-data
stop() {
if status ; then
pid=$(cat ${PIDFILE})
kill $pid
rm ${PIDFILE}
echo "$NAME stopped"
fi
}
status() {
if [ -e ${PIDFILE} ]; then
pid=$(cat ${PIDFILE})
if kill -0 &>1 > /dev/null $pid; then
# echo "$NAME running"
return 0
else
rm ${PIDFILE}
fi
fi
# echo "$NAME not running"
return 1
}
run() {
if ! status ; then
mkdir -p ${DATADIR}
nohup "$@" >>/tmp/${NAME}.log 2>&1 </dev/null &
pid=$!
echo $pid > ${PIDFILE}
disown $pid
fi
}
. $(dirname "$0")/run.bash