Skip to content

Commit

Permalink
Add simple post-install package tests
Browse files Browse the repository at this point in the history
  • Loading branch information
neilcook committed Jun 9, 2024
1 parent a226aa9 commit 4bde348
Show file tree
Hide file tree
Showing 9 changed files with 54 additions and 2 deletions.
15 changes: 15 additions & 0 deletions builder-support/dockerfiles/Dockerfile.debtest
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Install the built rpms and test them
FROM dist-base as dist
# If you want to install extra packages or do generic configuration,
# do it before the COPY. Either here, or in the dist-base layer.

COPY --from=sdist /sdist /sdist
COPY --from=package-builder /dist /dist

# Install built packages with dependencies
RUN apt install -y /dist/*.deb

# Installation tests
COPY builder-support/install-tests /wforce/builder-support/install-tests
WORKDIR /wforce
RUN builder-support/install-tests/test-simple-exec.sh
2 changes: 2 additions & 0 deletions builder-support/dockerfiles/Dockerfile.rpmbuild
Original file line number Diff line number Diff line change
Expand Up @@ -124,3 +124,5 @@ RUN builder/helpers/build-specs.sh builder-support/specs/wforce.spec
# See: https://github.com/moby/moby/issues/33733
#RUN mv /root/rpmbuild/RPMS/* /dist/
RUN cp -R /root/rpmbuild/RPMS/* /dist/


4 changes: 3 additions & 1 deletion builder-support/dockerfiles/Dockerfile.rpmtest
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,6 @@ COPY --from=package-builder /dist /dist
RUN yum localinstall -y /dist/*/*.rpm

# Installation tests
@INCLUDE Dockerfile.commontest
COPY builder-support/install-tests /wforce/builder-support/install-tests
WORKDIR /wforce
RUN builder-support/install-tests/test-simple-exec.sh
4 changes: 3 additions & 1 deletion builder-support/dockerfiles/Dockerfile.target.centos-7
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,6 @@ RUN echo "source /opt/rh/llvm-toolset-7.0/enable" >> /etc/bashrc
# Do the actual rpm build
@INCLUDE Dockerfile.rpmbuild


# Do a test install and verify
# Can be skipped with skiptests=1 in the environment
@EXEC [ "$skiptests" = "" ] && include Dockerfile.rpmtest
4 changes: 4 additions & 0 deletions builder-support/dockerfiles/Dockerfile.target.debian-bookworm
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,7 @@ ARG APT_URL
RUN apt-get update && apt-get -y dist-upgrade

@INCLUDE Dockerfile.debbuild

# Do a test install and verify
# Can be skipped with skiptests=1 in the environment
@EXEC [ "$skiptests" = "" ] && include Dockerfile.debtest
4 changes: 4 additions & 0 deletions builder-support/dockerfiles/Dockerfile.target.debian-bullseye
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,7 @@ ARG APT_URL
RUN apt-get update && apt-get -y dist-upgrade

@INCLUDE Dockerfile.debbuild

# Do a test install and verify
# Can be skipped with skiptests=1 in the environment
@EXEC [ "$skiptests" = "" ] && include Dockerfile.debtest
3 changes: 3 additions & 0 deletions builder-support/dockerfiles/Dockerfile.target.ol-8
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,6 @@ RUN dnf -y install dnf-plugins-core clang
# Do the actual rpm build
@INCLUDE Dockerfile.rpmbuild

# Do a test install and verify
# Can be skipped with skiptests=1 in the environment
@EXEC [ "$skiptests" = "" ] && include Dockerfile.rpmtest
3 changes: 3 additions & 0 deletions builder-support/dockerfiles/Dockerfile.target.ol-9
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,6 @@ RUN dnf -y install dnf-plugins-core clang
# Do the actual rpm build
@INCLUDE Dockerfile.rpmbuild

# Do a test install and verify
# Can be skipped with skiptests=1 in the environment
@EXEC [ "$skiptests" = "" ] && include Dockerfile.rpmtest
17 changes: 17 additions & 0 deletions builder-support/install-tests/test-simple-exec.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/sh

set -ex

/usr/bin/wforce --help >/dev/null
/usr/bin/trackalert --help >/dev/null

# isempty() is an extension only present in the OpenResty fork of LuaJIT,
# the import will error in the original LuaJIT and Lua.
/usr/bin/wforce-luajit -e 'local isempty = require "table.isempty" print(isempty({}))'

# Check Lua modules are loaded
/usr/bin/wforce-luajit -e 'require "elasticsearch" require "lualdap"'

# Check that our lua-dist is the first libluajit that is found
/sbin/ldconfig --print-cache | grep '/usr/share/wforce-lua-dist/lib/exported/libluajit'
ldd /usr/bin/wforce | grep '/usr/share/wforce-lua-dist/lib/exported/libluajit'

0 comments on commit 4bde348

Please sign in to comment.