6
0
mirror of https://github.com/FirebirdSQL/firebird-qa.git synced 2025-01-22 13:33:07 +01:00

Make it possible to run with docker in Linux.

This commit is contained in:
Adriano dos Santos Fernandes 2023-12-08 22:59:35 -03:00
parent 2c87e4fdf1
commit 6e8bf513f8
4 changed files with 163 additions and 0 deletions

42
Dockerfile Normal file
View File

@ -0,0 +1,42 @@
FROM ubuntu:22.04
RUN \
apt-get update && \
\
DEBIAN_FRONTEND=noninteractive apt-get -y install \
libicu70 \
libncurses5 \
libtommath1 \
python3 \
python3-pip \
sudo && \
\
rm -rf /var/lib/apt/lists/* && \
\
ln -s /usr/lib/x86_64-linux-gnu/libtommath.so.1 /usr/lib/x86_64-linux-gnu/libtommath.so.0
ARG UID=1000
COPY setup.cfg pyproject.toml /qa-run/
RUN \
useradd -u $UID user -G sudo && \
groupadd firebird && \
useradd --non-unique -M -b /opt -s /sbin/nologin -g firebird -u $UID firebird && \
usermod -G sudo firebird && \
echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers && \
\
mkdir /qa-out && \
chown -R user:user /qa-out && \
chown -R firebird:firebird /qa-run && \
cd /qa-run && \
pip install -e . && \
pip install pytest-md-report pytest-timeout
USER user
ENV PATH=/opt/firebird/bin:$PATH
ENV TERMINFO_DIRS=/lib/terminfo
ENV LD_LIBRARY_PATH=/opt/firebird/lib
CMD /qa/docker/run.sh

25
docker/run.sh Executable file
View File

@ -0,0 +1,25 @@
#!/bin/sh
set -e
sudo /qa/docker/setup.sh
cd /qa-run
pytest \
--server local \
--save-output \
--extend-xml \
--junitxml /qa-out/junit.xml \
--disable-warnings \
-vv \
--tb=long \
--basetemp=/tmp/pytest-tmp \
--timeout 250 \
--md-report \
--md-report-flavor gfm \
--md-report-verbose 1 \
--md-report-color never \
--md-report-output /qa-out/md_report.md \
--ignore=tests/functional/replication \
--ignore=tests/functional/basic/isql/test_08.py \
./tests/

71
docker/setup.sh Executable file
View File

@ -0,0 +1,71 @@
#!/bin/sh
set -e
mkdir /tmp/firebird-installer
cd /tmp/firebird-installer
tar xzvf /firebird-installer.tar.gz --strip=1
./install.sh -silent
echo
/etc/init.d/firebird stop
echo
echo Changing SYSDBA password
echo "alter user sysdba password 'masterkey';" | /opt/firebird/bin/isql -q employee
echo Configuring
cat <<EOF > /opt/firebird/firebird.conf
BugcheckAbort = 1
ExternalFileAccess = Full
AuthServer = Srp, Win_Sspi, Legacy_Auth
UserManager = Srp, Legacy_UserManager
ReadConsistency = 0
WireCrypt = Enabled
ExtConnPoolSize = 10
ExtConnPoolLifeTime = 10
UseFileSystemCache = true
IpcName = xnet_fb4x_qa
DefaultDbCachePages = 2048
MaxUnflushedWrites = -1
MaxUnflushedWriteTime = -1
StatementTimeout = 7200
KeyHolderPlugin = fbSampleKeyHolder
RemoteServicePort = 3050
ParallelWorkers = 1
MaxParallelWorkers = 8
EOF
if test -f /opt/firebird/examples/prebuilt/plugins/fbSampleDbCrypt.conf; then
cp /opt/firebird/examples/prebuilt/plugins/fbSampleDbCrypt.conf /opt/firebird/plugins/
cp /opt/firebird/examples/prebuilt/plugins/libfbSample*.so /opt/firebird/plugins/
cat <<EOF > /opt/firebird/plugins/fbSampleKeyHolder.conf
Auto = true
KeyRed=111
KeyGreen = 119
EOF
fi
cat <<EOF > /opt/firebird/databases.conf
employee.fdb = \$(dir_sampleDb)/employee.fdb
employee = \$(dir_sampleDb)/employee.fdb
security.db = \$(dir_secDb)/$(basename $(ls /opt/firebird/security*.fdb))
{
RemoteAccess = true
DefaultDbCachePages = 256
}
EOF
cat /qa/files/qa-databases.conf >> /opt/firebird/databases.conf
/etc/init.d/firebird start
echo
rm -r /tmp/firebird-installer
mkdir /opt/firebird/examples/empbuild/qa
chmod -R 777 /opt/firebird/examples/empbuild
cp -rn /qa/* /qa-run/

25
run-docker.sh Executable file
View File

@ -0,0 +1,25 @@
#!/bin/sh
set -e
# Syntax:
# Run this script passing environment variables:
# FBQA_OUT=/path/to/out FBQA_INSTALLER=/path/to/Firebird.tar.gz ./run-docker.sh
THIS_DIR=`readlink -f $0`
THIS_DIR=`dirname $THIS_DIR`
if [ -z "$FBQA_OUT" ]; then
echo \$FBQA_OUT is not defined.
fi
if [ -z "$FBQA_INSTALLER" ]; then
echo \$FBQA_INSTALLER is not defined.
fi
if [ -z "$FBQA_OUT" ] || [ -z "$FBQA_INSTALLER" ]; then
exit 1
fi
docker build --build-arg UID=$(id -u) --build-arg GID=$(id -g) --progress=plain -t firebird-qa $THIS_DIR
mkdir -p $FBQA_OUT/tests
docker run --user $(id -u) --rm -v `realpath $FBQA_OUT`:/qa-out -v `realpath $FBQA_OUT/tests`:/qa-run/out/tests -v `realpath $THIS_DIR`:/qa -v `realpath $FBQA_INSTALLER`:/firebird-installer.tar.gz firebird-qa