docker: Install topotests into image

Also: Change directory layout so we can do an indempotent sync from host
later.

Signed-off-by: Christian Franke <chris@opensourcerouting.org>
This commit is contained in:
Christian Franke 2018-10-17 20:31:52 +02:00
parent 04c63c05b5
commit ca64604f47
5 changed files with 16 additions and 12 deletions

View File

@ -56,11 +56,11 @@ RUN echo "" >> /etc/security/limits.conf; \
echo "root hard core unlimited" >> /etc/security/limits.conf
# Copy run scripts to facilitate users wanting to run the tests
COPY docker/ /opt/topotests
COPY . /root/topotests
WORKDIR /root
ENV PATH "$PATH:/opt/topotests"
ENV PATH "$PATH:/root/topotests/docker"
RUN echo "cat /opt/topotests/motd.txt" >> /root/.profile && \
RUN echo "cat /root/topotests/docker/motd.txt" >> /root/.profile && \
echo "export PS1='(topotests) $PS1'" >> /root/.profile
ENTRYPOINT [ "bash", "/opt/topotests/entrypoint.sh" ]
ENTRYPOINT [ "bash", "/root/topotests/docker/entrypoint.sh" ]

View File

@ -32,7 +32,7 @@ CDIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
if [ ! -f .sync_source -o $SYNC_SOURCE -ne 0 ]; then
log_info "Syncing FRR source with host..."
mkdir -p $FRR_BUILD_DIR >/dev/null 2>&1
rsync -a --info=progress2 --chown root:root $FRR_DIR/. $FRR_BUILD_DIR/
rsync -a --info=progress2 --chown root:root $FRR_HOST_DIR/. $FRR_BUILD_DIR/
touch .sync_source
fi

View File

@ -61,7 +61,7 @@ ovs-appctl -t ovsdb-server \
env \
CLEAN=1 \
VERBOSE=0 \
bash /opt/topotests/compile_frr.sh
bash "${CDIR}/compile_frr.sh"
log_info "Setting permissions on /tmp so we can generate logs"
chmod -v 1777 /tmp

View File

@ -22,10 +22,14 @@
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
FRR_DIR=/root/frr
FRR_BUILD_DIR=/root/frr-build
FRR_HOST_DIR=/root/host-frr
FRR_BUILD_DIR=/root/persist/frr-build
TOPOTESTS_DIR=/root/topotests
if [ ! -L "/root/frr" ]; then
ln -s $FRR_BUILD_DIR /root/frr
fi
[ -z $CLEAN ] && CLEAN=0
[ -z $VERBOSE ] && VERBOSE=1
[ -z $DOC ] && DOC=0

View File

@ -117,16 +117,16 @@ fi
if [ -z "$TOPOTEST_PATH" ]; then
docker run --rm -ti \
-v "$TOPOTEST_LOGS:/tmp" \
-v "$TOPOTEST_FRR:/root/frr:ro" \
-v "$TOPOTEST_BUILDCACHE:/root/frr-build" \
-v "$TOPOTEST_FRR:/root/host-frr:ro" \
-v "$TOPOTEST_BUILDCACHE:/root/persist" \
--privileged \
$TOPOTEST_OPTIONS \
frrouting/topotests "$@"
else
docker run --rm -ti \
-v "$TOPOTEST_LOGS:/tmp" \
-v "$TOPOTEST_FRR:/root/frr:ro" \
-v "$TOPOTEST_BUILDCACHE:/root/frr-build" \
-v "$TOPOTEST_FRR:/root/host-frr:ro" \
-v "$TOPOTEST_BUILDCACHE:/root/persist" \
-v "$TOPOTEST_PATH:/root/topotests:ro" \
--privileged \
$TOPOTEST_OPTIONS \