0
0
Fork 0
mirror of https://github.com/atmoz/sftp.git synced 2024-12-22 13:14:42 -05:00

Test minimal setup as well

This commit is contained in:
Adrian Dvergsdal 2015-12-20 23:45:28 +01:00
parent c388a4ec68
commit c5d2a490ef

View file

@ -1,6 +1,8 @@
#!/bin/bash
# See: https://github.com/djui/bashunit
skipAllTests=false
scriptDir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
buildDir="$scriptDir/.."
tmpDir="/tmp/atmoz_sftp_test"
@ -75,17 +77,55 @@ function runSftpCommands() {
##############################################################################
function testMinimalContainerStart() {
$skipAllTests && skip && return 0
tmpContainerName="$sftpContainerName""_minimal"
docker run \
--name "$tmpContainerName" \
-d "$sftpImageName" \
minimal::1111 \
> "$redirect"
sleep 1
ps="$(docker ps -q -f name="$tmpContainerName")"
assertNotEqual "$ps" ""
if [ -z "$ps" ]; then
skipAllTests=true
fi
if [ "$output" != "quiet" ]; then
docker logs "$tmpContainerName"
fi
if [ "$cleanup" == "cleanup" ]; then
docker rm -fv "$tmpContainerName" > "$redirect"
fi
}
function testContainerIsRunning() {
$skipAllTests && skip && return 0
ps="$(docker ps -q -f name="$sftpContainerName")"
assertNotEqual "$ps" ""
if [ -z "$ps" ]; then
skipAllTests=true
fi
}
function testLoginUsingSshKey() {
$skipAllTests && skip && return 0
runSftpCommands "exit"
assertReturn $? 0
}
function testWritePermission() {
$skipAllTests && skip && return 0
runSftpCommands "cd share" "mkdir test" "exit"
test -d "$tmpDir/test"
assertReturn $? 0