Skip to content
This repository has been archived by the owner on Jul 30, 2020. It is now read-only.

Commit

Permalink
Add a "test light" mode for travis
Browse files Browse the repository at this point in the history
Sadly, travis does not currently offer any distribution with systemd, so we
can't currently test our regular install routine. To still have some amount of
testing, this patch adds a special 'noinstall' test mode, which only exercises
`mediawiki-containers restart`.
  • Loading branch information
gwicke committed Dec 30, 2015
1 parent 3d027ef commit 8048295
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 24 deletions.
4 changes: 3 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ services:
sudo: required

# We override what to do anyway.
script: sudo ./test.sh
# Sadly, Travis does not have an image with systemd yet, so we can't test a
# full install.
script: sudo ./test.sh noinstall

notifications:
irc:
Expand Down
57 changes: 34 additions & 23 deletions test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,37 +50,48 @@ export AUTO_UPDATE=true

CHECKOUT=$(pwd)

cd /tmp

if [ -d /srv/mediawiki-containers ];then
echowarn "Found existing /srv/mediawiki-containers checkout."
read -p "Delete it? (y/[n]): " DELETE_IT
if [ "$DELETE_IT" == 'y' ];then
rm -rf /srv/mediawiki-containers
else
echoerror "Aborted test as /srv/mediawiki-containers exists."
exit 1
test_install() {
cd /tmp

if [ -d /srv/mediawiki-containers ];then
echowarn "Found existing /srv/mediawiki-containers checkout."
read -p "Delete it? (y/[n]): " DELETE_IT
if [ "$DELETE_IT" == 'y' ];then
rm -rf /srv/mediawiki-containers
else
echoerror "Aborted test as /srv/mediawiki-containers exists."
exit 1
fi
fi
fi

# Trick the installer into testing the new code, rather than master.
git clone "$CHECKOUT" /srv/mediawiki-containers

# Trick the installer into testing the new code, rather than master.
git clone "$CHECKOUT" /srv/mediawiki-containers

cat "$CHECKOUT/mediawiki-containers" | bash -s install
cat "$CHECKOUT/mediawiki-containers" | bash -s install

check_service
check_service

echoinfo "Restart the service"
service mediawiki-containers restart
echoinfo "Restart the service"
service mediawiki-containers restart

sleep 10
sleep 10

check_service
check_service

echoinfo "Exercise the automatic updater"
/etc/cron.daily/mediawiki-containers
echoinfo "Exercise the automatic updater"
/etc/cron.daily/mediawiki-containers

check_service
check_service
}

if [ "$1" == 'noinstall' ];then
echoinfo "noinstall option set, only testing 'mediawiki-containers start'".
./mediawiki-containers restart &
sleep 120
check_service
else
test_install
fi

echoinfo "Congratulations, all is looking good!"
exit 0

0 comments on commit 8048295

Please sign in to comment.