Skip to content

Commit

Permalink
Add scripts for running tests based on docker containers
Browse files Browse the repository at this point in the history
  • Loading branch information
amadio committed Mar 23, 2023
1 parent 39d6f8f commit 3594a01
Show file tree
Hide file tree
Showing 13 changed files with 429 additions and 38 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ config.status
config.sub
configure
depcomp
docker/data
docker/xrootd.tar.gz
install-sh
lib/
libtool
Expand Down
1 change: 1 addition & 0 deletions docker/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
data/
46 changes: 46 additions & 0 deletions docker/build/Dockerfile.alma8
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
FROM almalinux:8

# Install tools necessary for RPM development
RUN dnf install -y rpm-build rpmdevtools dnf-plugins-core epel-release \
&& dnf config-manager --set-enabled powertools

# Create directory tree for building RPMs
RUN rpmdev-setuptree

WORKDIR /root

# XRootD source tarball must be created in the
# current directory in order to build this image
COPY xrootd.tar.gz rpmbuild/SOURCES

# Extract spec file to build RPMs
RUN tar xzf rpmbuild/SOURCES/xrootd.tar.gz --strip-components=1 xrootd/xrootd.spec

# Install build dependencies with dnf
RUN dnf builddep -y -D 'dist .el8' --define '_with_isal 1' --define '_with_python3 1' \
--define '_with_scitokens 1' --define '_with_tests 1' --define '_with_xrdclhttp 1' \
--define '_build_name_fmt %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm' xrootd.spec

# Build RPMS for XRootD
RUN rpmbuild -bb -D 'dist .el8' --define '_with_isal 1' --define '_with_python3 1' \
--define '_with_scitokens 1' --define '_with_tests 1' --define '_with_xrdclhttp 1' \
--define '_build_name_fmt %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm' xrootd.spec

# Second stage, build test image
FROM almalinux:8

COPY --from=0 /root/rpmbuild/RPMS/* /tmp/

# Install RPMS for XRootD and cleanup unneeded files
RUN rm /tmp/*-{devel,doc}* \
&& dnf install -y dnf-plugins-core epel-release \
&& dnf config-manager --set-enabled powertools \
&& dnf install -y /tmp/*.rpm \
&& dnf autoremove -y \
&& rm -rf /tmp/*

# Copy configuration files
COPY config/*.cfg /etc/xrootd/
COPY scripts/setup.sh /bin/setup.sh

CMD [ "/sbin/init" ]
46 changes: 46 additions & 0 deletions docker/build/Dockerfile.alma9
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
FROM almalinux:9

# Install tools necessary for RPM development
RUN dnf install -y rpm-build rpmdevtools dnf-plugins-core epel-release \
&& dnf config-manager --set-enabled crb

# Create directory tree for building RPMs
RUN rpmdev-setuptree

WORKDIR /root

# XRootD source tarball must be created in the
# current directory in order to build this image
COPY xrootd.tar.gz rpmbuild/SOURCES

# Extract spec file to build RPMs
RUN tar xzf rpmbuild/SOURCES/xrootd.tar.gz --strip-components=1 xrootd/xrootd.spec

# Install build dependencies with dnf
RUN dnf builddep -y -D 'dist .el9' --define '_with_isal 1' --define '_with_python3 1' \
--define '_with_scitokens 1' --define '_with_tests 1' --define '_with_xrdclhttp 1' \
--define '_build_name_fmt %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm' xrootd.spec

# Build RPMS for XRootD
RUN rpmbuild -bb -D 'dist .el9' --define '_with_isal 1' --define '_with_python3 1' \
--define '_with_scitokens 1' --define '_with_tests 1' --define '_with_xrdclhttp 1' \
--define '_build_name_fmt %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm' xrootd.spec

# Second stage, build test image
FROM almalinux:9

COPY --from=0 /root/rpmbuild/RPMS/* /tmp/

# Install RPMS for XRootD and cleanup unneeded files
RUN rm /tmp/*-{devel,doc}* \
&& dnf install -y dnf-plugins-core epel-release \
&& dnf config-manager --set-enabled crb \
&& dnf install -y /tmp/*.rpm \
&& dnf autoremove -y \
&& rm -rf /tmp/*

# Copy configuration files
COPY config/*.cfg /etc/xrootd/
COPY scripts/setup.sh /bin/setup.sh

CMD [ "/sbin/init" ]
43 changes: 43 additions & 0 deletions docker/build/Dockerfile.centos7
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
FROM cern/cc7-base

# Install tools necessary for RPM development
RUN yum install -y rpm-build rpmdevtools yum-utils

# Create directory tree for building RPMs
RUN rpmdev-setuptree

WORKDIR /root

# XRootD source tarball must be created in the
# current directory in order to build this image
COPY xrootd.tar.gz rpmbuild/SOURCES

# Extract spec file to build RPMs
RUN tar xzf rpmbuild/SOURCES/xrootd.tar.gz --strip-components=1 xrootd/xrootd.spec

# Install build dependencies with yum
RUN yum-builddep -y --define '_with_isal 1' --define '_with_python3 1' \
--define '_with_scitokens 1' --define '_with_tests 1' --define '_with_xrdclhttp 1' \
--define '_build_name_fmt %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm' xrootd.spec

# Build RPMS for XRootD
RUN rpmbuild -bb --define '_with_isal 1' --define '_with_python3 1' \
--define '_with_scitokens 1' --define '_with_tests 1' --define '_with_xrdclhttp 1' \
--define '_build_name_fmt %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm' xrootd.spec

# Second stage, build test image
FROM cern/cc7-base

COPY --from=0 /root/rpmbuild/RPMS/* /tmp/

# Install RPMS for XRootD and cleanup unneeded files
RUN rm /tmp/*-{devel,doc}* \
&& yum install -y wget /tmp/*.rpm \
&& yum autoremove -y \
&& rm -rf /tmp/*

# Copy configuration files
COPY config/*.cfg /etc/xrootd/
COPY scripts/setup.sh /bin/setup.sh

CMD [ "/sbin/init" ]
14 changes: 0 additions & 14 deletions docker/builds/DockerfileCentos7

This file was deleted.

16 changes: 0 additions & 16 deletions docker/builds/DockerfileCentos8

This file was deleted.

4 changes: 0 additions & 4 deletions docker/builds/centos7_buildenv.sh

This file was deleted.

4 changes: 0 additions & 4 deletions docker/builds/centos8_buildenv.sh

This file was deleted.

59 changes: 59 additions & 0 deletions docker/config/xrootd-clustered.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
all.export /data
cms.delay startup 10
cms.space linger 0 recalc 15 min 2% 1g 5% 2g

xrootd.diglib * /etc/xrootd/dbgauth

ofs.ckslib zcrc32 /usr/lib64/libXrdCksCalczcrc32.so
xrootd.chksum zcrc32

all.adminpath /var/spool/xrootd
all.pidpath /run/xrootd

xrd.port 1094 if exec xrootd
xrd.port 2094 if exec cmsd

if metaman+
all.role meta manager
all.manager meta metaman 2094

else if man1+
all.role manager
all.manager meta metaman 2094
all.manager man1 2094

else if man2+
all.role manager
all.manager meta metaman 2094
all.manager man2 2094

else if srv1+
all.role server
all.manager man1 2094
ofs.tpc ttl 60 60 xfr 9 pgm /usr/bin/xrdcp --server
ofs.chkpnt enable

else if srv2+
all.role server
all.manager man1 2094
ofs.tpc ttl 60 60 xfr 9 pgm /usr/bin/xrdcp --server
ofs.chkpnt enable

else if srv3+
all.role server
all.manager man2 2094
ofs.tpc ttl 60 60 xfr 9 pgm /usr/bin/xrdcp --server
ofs.chkpnt enable

else if srv4+
all.role server
all.manager man2 2094
ofs.tpc ttl 60 60 xfr 9 pgm /usr/bin/xrdcp --server
ofs.chkpnt enable
fi

if defined ?~TEST_SIGNING
xrootd.seclib /usr/lib64/libXrdSec-4.so
sec.protocol unix
sec.level compatible force
fi
4 changes: 4 additions & 0 deletions docker/config/xrootd-srv2.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
all.export /data
all.adminpath /var/spool/xrootd
all.pidpath /var/run/xrootd
xrd.port 1099
68 changes: 68 additions & 0 deletions docker/scripts/setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
#!/bin/bash

# set the TEST_SIGNING
export TEST_SIGNING=1

if [[ ${HOSTNAME} = 'metaman' ]] ; then
# download the a test file for upload tests
mkdir -p /data
cp /downloads/a048e67f-4397-4bb8-85eb-8d7e40d90763.dat /data/testFile.dat
chown -R xrootd:xrootd /data
fi

# the data nodes
datanodes=('srv1' 'srv2' 'srv3' 'srv4')

# create 'bigdir' in each of the data nodes
if [[ ${datanodes[*]} =~ ${HOSTNAME} ]] ; then
mkdir -p /data/bigdir
cd /data/bigdir
for i in `seq 10000`; do touch `uuidgen`.dat; done
cd - >/dev/null
fi

# download the test files for 'srv1'
if [[ ${HOSTNAME} = 'srv1' ]] ; then
cp /downloads/a048e67f-4397-4bb8-85eb-8d7e40d90763.dat /data
cp /downloads/b3d40b3f-1d15-4ad3-8cb5-a7516acb2bab.dat /data
cp /downloads/b74d025e-06d6-43e8-91e1-a862feb03c84.dat /data
cp /downloads/cb4aacf1-6f28-42f2-b68a-90a73460f424.dat /data
cp /downloads/cef4d954-936f-4945-ae49-60ec715b986e.dat /data
mkdir /data/metalink
cp /downloads/input*.meta* /data/metalink/
cp /downloads/ml*.meta* /data/metalink/
fi

# download the test files for 'srv2' and add another instance on 1099
if [[ ${HOSTNAME} = 'srv2' ]] ; then
cp /downloads/1db882c8-8cd6-4df1-941f-ce669bad3458.dat /data
cp /downloads/3c9a9dd8-bc75-422c-b12c-f00604486cc1.dat /data
cp /downloads/7235b5d1-cede-4700-a8f9-596506b4cc38.dat /data
cp /downloads/7e480547-fe1a-4eaf-a210-0f3927751a43.dat /data
cp /downloads/89120cec-5244-444c-9313-703e4bee72de.dat /data
fi

# download the test files for 'srv3'
if [[ ${HOSTNAME} = 'srv3' ]] ; then
cp /downloads/1db882c8-8cd6-4df1-941f-ce669bad3458.dat /data
cp /downloads/3c9a9dd8-bc75-422c-b12c-f00604486cc1.dat /data
cp /downloads/89120cec-5244-444c-9313-703e4bee72de.dat /data
cp /downloads/b74d025e-06d6-43e8-91e1-a862feb03c84.dat /data
cp /downloads/cef4d954-936f-4945-ae49-60ec715b986e.dat /data
fi

# download the test files for 'srv4'
if [[ ${HOSTNAME} = 'srv4' ]] ; then
cp /downloads/1db882c8-8cd6-4df1-941f-ce669bad3458.dat /data
cp /downloads/7e480547-fe1a-4eaf-a210-0f3927751a43.dat /data
cp /downloads/89120cec-5244-444c-9313-703e4bee72de.dat /data
cp /downloads/b74d025e-06d6-43e8-91e1-a862feb03c84.dat /data
cp /downloads/cef4d954-936f-4945-ae49-60ec715b986e.dat /data
cp /downloads/data.zip /data
cp /downloads/large.zip /data
fi

# make sure the test files and directories are owned by 'xrootd' user
if [[ ${datanodes[*]} =~ ${HOSTNAME} ]] ; then
chown -R xrootd:xrootd /data
fi
Loading

0 comments on commit 3594a01

Please sign in to comment.