Move common functions into common.bash
This commit is contained in:
parent
53b930448d
commit
05deaa3196
|
@ -159,3 +159,21 @@ function duplicate_config_for_container() {
|
||||||
cp -r "$PWD/test/config/${1:?}/." "$output"
|
cp -r "$PWD/test/config/${1:?}/." "$output"
|
||||||
echo "$output"
|
echo "$output"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function container_has_service_running() {
|
||||||
|
containerName="$1"
|
||||||
|
serviceName="$2"
|
||||||
|
docker exec "$containerName" /usr/bin/supervisorctl status "$serviceName" | grep RUNNING >/dev/null
|
||||||
|
}
|
||||||
|
|
||||||
|
function wait_for_service() {
|
||||||
|
containerName="$1"
|
||||||
|
serviceName="$2"
|
||||||
|
repeat_in_container_until_success_or_timeout 600 "$containerName" \
|
||||||
|
container_has_service_running "$containerName" "$serviceName"
|
||||||
|
}
|
||||||
|
|
||||||
|
function count_processed_changes() {
|
||||||
|
containerName=$1
|
||||||
|
docker exec "$containerName" cat /var/log/supervisor/changedetector.log | grep "Change detected" -c
|
||||||
|
}
|
||||||
|
|
|
@ -65,27 +65,6 @@ teardown_file() {
|
||||||
docker rm -f mail
|
docker rm -f mail
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
|
||||||
# shared functions
|
|
||||||
#
|
|
||||||
|
|
||||||
function wait_for_service() {
|
|
||||||
containerName=$1
|
|
||||||
serviceName=$2
|
|
||||||
count=0
|
|
||||||
while ! (docker exec $containerName /usr/bin/supervisorctl status $serviceName | grep RUNNING >/dev/null)
|
|
||||||
do
|
|
||||||
((count++)) && ((count==30)) && break
|
|
||||||
sleep 5
|
|
||||||
done
|
|
||||||
return $(docker exec $containerName /usr/bin/supervisorctl status $serviceName | grep RUNNING >/dev/null)
|
|
||||||
}
|
|
||||||
|
|
||||||
function count_processed_changes() {
|
|
||||||
containerName=$1
|
|
||||||
docker exec $containerName cat /var/log/supervisor/changedetector.log | grep "Change detected" | wc -l
|
|
||||||
}
|
|
||||||
|
|
||||||
# this test must come first to reliably identify when to run setup_file
|
# this test must come first to reliably identify when to run setup_file
|
||||||
@test "first" {
|
@test "first" {
|
||||||
skip 'Starting testing of letsencrypt SSL'
|
skip 'Starting testing of letsencrypt SSL'
|
||||||
|
|
Loading…
Reference in New Issue