This provides a setup to run ngcp-panel tests against selenium-server using docker. It's based on Debian/jessie and assumes are reachable NGCP system for running the tests against (e.g. via `vagrant up ce-trunk`). For usage instructions refer to the Dockerfile. NOTE: replacing 'jessie' with 'wheezy' in the Dockerfile provides a setup based on Debian/wheezy. Change-Id: I79ca4d44c3a7c454f99148889d4b0d075a79e82bchanges/53/2553/9
parent
9cdaf04f85
commit
b17bc4da82
@ -0,0 +1,76 @@
|
||||
# TODO - switch to sipwise internal one
|
||||
FROM debian:jessie
|
||||
|
||||
# Important! Update this no-op ENV variable when this Dockerfile
|
||||
# is updated with the current date. It will force refresh of all
|
||||
# of the base images and things like `apt-get update` won't be using
|
||||
# old cached versions when the Dockerfile is built.
|
||||
ENV REFRESHED_AT 2015-09-04
|
||||
|
||||
# mirrors behind httpredir randomly throw `Error reading from server. Remote end closed connection`
|
||||
# and we want to be independent from any external services anyway
|
||||
# TODO - the release-trunk-jessie is too dynamic yet, though required for some build/test dependencies
|
||||
RUN apt-get update && apt-get -y install apt-transport-https wget
|
||||
RUN echo "# generated by Dockerfile from ngcp-panel at $(date)\n\
|
||||
deb https://debian.sipwise.com/debian jessie main\n\
|
||||
deb https://debian.sipwise.com/debian jessie-updates main\n\
|
||||
deb https://debian-security.sipwise.com/debian-security jessie-security main contrib non-free\n\
|
||||
deb https://deb.sipwise.com/autobuild/ release-trunk-jessie main\n" > /etc/apt/sources.list
|
||||
RUN wget -O /etc/apt/trusted.gpg.d/sipwise.gpg https://deb.sipwise.com/spce/sipwise.gpg
|
||||
|
||||
RUN apt-get update
|
||||
RUN apt-get install --assume-yes \
|
||||
devscripts \
|
||||
fluxbox \
|
||||
git \
|
||||
iceweasel \
|
||||
libtap-formatter-junit-perl \
|
||||
lsof \
|
||||
net-tools \
|
||||
openjdk-7-jre-headless \
|
||||
vim-tiny \
|
||||
vnc4server \
|
||||
wget \
|
||||
xterm
|
||||
|
||||
RUN adduser --disabled-password --gecos=Selenium-User selenium
|
||||
|
||||
WORKDIR /home/selenium
|
||||
RUN wget -O selenium-server-standalone-2.47.1.jar http://selenium-release.storage.googleapis.com/2.47/selenium-server-standalone-2.47.1.jar
|
||||
RUN ln -s selenium-server-standalone-2.47.1.jar selenium-server-standalone.jar
|
||||
|
||||
WORKDIR /tmp/
|
||||
COPY control /tmp/
|
||||
RUN mk-build-deps /tmp/control
|
||||
RUN dpkg --force-depends -i /tmp/ngcp-panel-tests-selenium-build-deps_1.0_all.deb
|
||||
RUN apt-get --assume-yes -f install
|
||||
|
||||
RUN wget http://deb.sipwise.com/files/libselenium-remote-driver-perl_0.26-1~bpo80+1_all.deb
|
||||
RUN dpkg --force-depends -i libselenium-remote-driver-perl_0.26-1~bpo80+1_all.deb
|
||||
RUN apt-get --assume-yes -f install
|
||||
|
||||
# for prove execution by developers
|
||||
RUN wget http://deb.sipwise.com/files/libtest-pretty-perl_0.31-1~bpo80+1_all.deb
|
||||
RUN dpkg --force-depends -i libtest-pretty-perl_0.31-1~bpo80+1_all.deb
|
||||
RUN apt-get --assume-yes -f install
|
||||
|
||||
WORKDIR /home/selenium
|
||||
|
||||
################################################################################
|
||||
# Instructions for usage
|
||||
# ----------------------
|
||||
# When you want to build the base image from scratch (jump to the next section if you don't want to build yourself!):
|
||||
# % docker build --tag="ngcp-panel-tests-selenium-jessie" .
|
||||
# % docker run --rm -p 5999 -i -t -v $(pwd)/../..:/code:rw ngcp-panel-tests-selenium-jessie:latest bash
|
||||
#
|
||||
# Use the existing docker image:
|
||||
# % docker pull docker1.mgm.sipwise.com/ngcp-panel-tests-selenium-jessie
|
||||
# % docker run --rm -p 5999 -i -t -v $(pwd)/../..:/code:rw docker1.mgm.sipwise.com/ngcp-panel-tests-selenium-jessie:latest bash
|
||||
#
|
||||
# Inside docker:
|
||||
# su - selenium
|
||||
# cd /code && ./t/selenium/testrunner $IP_OF_NGCP_SYSTEM # IP_OF_NGCP_SYSTEM can be e.g. IP of a `vagrant up ce-trunk` system (eth1)
|
||||
#
|
||||
# On host (where vncviewer can be e.g. from Debian package xvnc4viewer):
|
||||
# % vncviewer geometry=1280x1024x16 $(docker inspect $(docker ps -l -q) | jq -r '.[0].NetworkSettings.IPAddress'):5999
|
||||
################################################################################
|
||||
@ -0,0 +1,5 @@
|
||||
Source: ngcp-panel-tests-selenium
|
||||
Build-Depends: libcapture-tiny-perl,
|
||||
libchild-perl,
|
||||
libmoosex-method-signatures-perl,
|
||||
libtrycatch-perl,
|
||||
@ -0,0 +1,53 @@
|
||||
#!/bin/bash
|
||||
|
||||
if ! [ -f /.dockerinit ]; then
|
||||
echo "Not running inside docker, exiting to avoid data damage." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
set -e
|
||||
set -u
|
||||
|
||||
PASSWORD="selenium"
|
||||
|
||||
if [ -z "${1:-}" ] ; then
|
||||
echo "Usage: $0 <testsystem>" >&2
|
||||
echo
|
||||
echo "Usage example: $0 192.168.88.162"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
SERVER="${1}"
|
||||
|
||||
# vnc
|
||||
echo "Setting VNC password"
|
||||
printf '%s\n%s\n\n' "${PASSWORD}" "${PASSWORD}" | vncpasswd >/dev/null
|
||||
xvnc_process=$(pgrep -f 'Xvnc4 :99' || true)
|
||||
if [ -n "${xvnc_process:-}" ] ; then
|
||||
echo "Warning: existing VNC server found, not restarting Xvnc4 process (PID: $xvnc_process)."
|
||||
else
|
||||
echo "Starting VNCserver on display :99"
|
||||
vncserver -geometry 1280x1024 :99
|
||||
fi
|
||||
|
||||
# selenium
|
||||
pkill -f '/usr/bin/java -jar /home/selenium/selenium-server-standalone.jar' || true
|
||||
# NOTE: this could silently fail because selenium-server-standalone.jar is missing a daemonize option
|
||||
DISPLAY=:99 /usr/bin/java -jar /home/selenium/selenium-server-standalone.jar -trustAllSSLCertificates -log /home/selenium/selenium.log &
|
||||
|
||||
echo "################################################################################"
|
||||
echo "Finished main setup, now running tests ..."
|
||||
echo "Selenium server log file available at /home/selenium/selenium.log"
|
||||
echo "Watch at test runs by connecting via VNC (enter password '${PASSWORD}'):"
|
||||
echo "vncviewer geometry=1280x1024x16 \$(docker inspect \$(docker ps -l -q) | jq -r '.[0].NetworkSettings.IPAddress'):5999"
|
||||
|
||||
RC=0
|
||||
CATALYST_SERVER="https://${SERVER}:1443/" prove -v --color -Pretty -l -It/lib t/selenium/*.t | tee -a /code/selenium.pretty || RC=$?
|
||||
#CATALYST_SERVER=https://${SERVER}:1443/ prove --formatter TAP::Formatter::JUnit -l -It/lib t/selenium/*.t | tee -a /code/selenium.xml || RC=$?
|
||||
echo "Finished test execution, test execution returned with exit code ${RC}."
|
||||
for file in /code/selenium.pretty /code/selenium.xml ; do
|
||||
if [ -f "$file" ] ; then
|
||||
echo "Test results available at ${file}"
|
||||
fi
|
||||
done
|
||||
echo "################################################################################"
|
||||
Loading…
Reference in new issue