mirror of
https://github.com/atmoz/sftp.git
synced 2024-11-17 12:51:33 -05:00
Test minimal setup as well
This commit is contained in:
parent
c388a4ec68
commit
c5d2a490ef
1 changed files with 40 additions and 0 deletions
40
tests/run
40
tests/run
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue