From c59e6b0a80c920d366d9d114f540799893fb5bdd Mon Sep 17 00:00:00 2001 From: "d.kovalenko" Date: Sun, 16 Mar 2025 10:29:14 +0300 Subject: [PATCH 01/14] [CI] Run tests on AltLinux 10 Changes: - VIRTUALENV: virtualenv is explicitly executed through ${PYTHON} The current problems 1) testgres/operations/helpers.py # Prepared pointer on function to get a name of system codepage _get_default_encoding_func = _make_get_default_encoding_func() must be # Prepared pointer on function to get a name of system codepage _get_default_encoding_func = _make_get_default_encoding_func.__func__() It is a problem of Python 3.9 2) These tests fail: FAILED tests/test_simple.py::TestgresTests::test_logical_replication - psycopg2.errors.ProtocolViolation: could not create replication slot "mysub": ERROR: could not access file "pgoutput": No such file or directory FAILED tests/test_simple.py::TestgresTests::test_logical_catchup - psycopg2.errors.ProtocolViolation: could not create replication slot "mysub": ERROR: could not access file "pgoutput": No such file or directory FAILED tests/test_simple_remote.py::TestgresRemoteTests::test_logical_replication - psycopg2.errors.ProtocolViolation: could not create replication slot "mysub": ERROR: could not access file "pgoutput": No such file or directory FAILED tests/test_simple_remote.py::TestgresRemoteTests::test_logical_catchup - psycopg2.errors.ProtocolViolation: could not create replication slot "mysub": ERROR: could not access file "pgoutput": No such file or directory I suggest to fix these problems in the separated commits. --- .travis.yml | 1 + Dockerfile--altlinux_10.tmpl | 66 ++++++++++++++++++++++++++++++++++++ run_tests.sh | 3 +- 3 files changed, 69 insertions(+), 1 deletion(-) create mode 100644 Dockerfile--altlinux_10.tmpl diff --git a/.travis.yml b/.travis.yml index 3a889845..1668e5b1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -28,3 +28,4 @@ env: - TEST_PLATFORM=std PYTHON_VERSION=3 PG_VERSION=10 - TEST_PLATFORM=std-all PYTHON_VERSION=3 PG_VERSION=17 - TEST_PLATFORM=ubuntu_24_04 PYTHON_VERSION=3 PG_VERSION=17 + - TEST_PLATFORM=altlinux_10 PYTHON_VERSION=3 PG_VERSION=17 diff --git a/Dockerfile--altlinux_10.tmpl b/Dockerfile--altlinux_10.tmpl new file mode 100644 index 00000000..4e770102 --- /dev/null +++ b/Dockerfile--altlinux_10.tmpl @@ -0,0 +1,66 @@ +ARG PG_VERSION +ARG PYTHON_VERSION + +# --------------------------------------------- base1 +FROM alt:p10 as base1 +ARG PG_VERSION + +RUN apt-get update +RUN apt-get install -y sudo curl ca-certificates +RUN apt-get update +RUN apt-get install -y openssh-server openssh-clients +RUN apt-get install -y time + +RUN apt-get install -y mc + +RUN apt-get update +RUN apt-get install -y postgresql-common +RUN apt-get install -y postgresql${PG_VERSION}-server +RUN apt-get install -y postgresql${PG_VERSION}-server-devel + +RUN apt-get install -y libsqlite3-devel + +EXPOSE 22 + +RUN ssh-keygen -A + +# --------------------------------------------- base2_with_python-3 +FROM base1 as base2_with_python-3 +RUN apt-get install -y python3 +RUN apt-get install -y python3-dev +RUN apt-get install -y python3-module-virtualenv +RUN apt-get install -y python3-modules-sqlite3 +ENV PYTHON_VERSION=3 + +# --------------------------------------------- final +FROM base2_with_python-${PYTHON_VERSION} as final + +RUN adduser test -G wheel + +# It enables execution of "sudo service ssh start" without password +RUN sh -c "echo \"WHEEL_USERS ALL=(ALL:ALL) NOPASSWD: ALL\"" >> /etc/sudoers + +ADD . /pg/testgres +WORKDIR /pg/testgres +RUN chown -R test /pg + +ENV LANG=C.UTF-8 + +USER test + +RUN chmod 700 ~/ +RUN mkdir -p ~/.ssh + +ENTRYPOINT sh -c " \ +set -eux; \ +echo HELLO FROM ENTRYPOINT; \ +echo HOME DIR IS [`realpath ~/`]; \ +sudo /usr/sbin/sshd; \ +ssh-keyscan -H localhost >> ~/.ssh/known_hosts; \ +ssh-keyscan -H 127.0.0.1 >> ~/.ssh/known_hosts; \ +ssh-keygen -t rsa -f ~/.ssh/id_rsa -q -N ''; \ +cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys; \ +chmod 600 ~/.ssh/authorized_keys; \ +ls -la ~/.ssh/; \ +TEST_FILTER=\"\" bash ./run_tests.sh;" + diff --git a/run_tests.sh b/run_tests.sh index 021f9d9f..2dd402f2 100755 --- a/run_tests.sh +++ b/run_tests.sh @@ -8,8 +8,9 @@ if [ -z ${TEST_FILTER+x} ]; then export TEST_FILTER="TestgresTests"; fi # choose python version echo python version is $PYTHON_VERSION -VIRTUALENV="virtualenv --python=/usr/bin/python$PYTHON_VERSION" +PYTHON="python$PYTHON_VERSION" PIP="pip$PYTHON_VERSION" +VIRTUALENV="${PYTHON} -m virtualenv --python=/usr/bin/python$PYTHON_VERSION" # fail early echo check that pg_config is in PATH From b20ace6b2edf3b373e5598094c877604e2870e1a Mon Sep 17 00:00:00 2001 From: "d.kovalenko" Date: Sun, 16 Mar 2025 11:28:40 +0300 Subject: [PATCH 02/14] Initialization of Helpers._get_default_encoding_func is corrected [py3.9] Python 3.9 does not undestand the following code: _get_default_encoding_func = _make_get_default_encoding_func() ERROR - TypeError: 'staticmethod' object is not callable https://app.travis-ci.com/github/postgrespro/testgres/jobs/631402370 The code: _get_default_encoding_func = _make_get_default_encoding_func.__func__() is processed without problems. --- testgres/operations/helpers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testgres/operations/helpers.py b/testgres/operations/helpers.py index 03e97edc..ebbf0f73 100644 --- a/testgres/operations/helpers.py +++ b/testgres/operations/helpers.py @@ -12,7 +12,7 @@ def _make_get_default_encoding_func(): return locale.getpreferredencoding # Prepared pointer on function to get a name of system codepage - _get_default_encoding_func = _make_get_default_encoding_func() + _get_default_encoding_func = _make_get_default_encoding_func.__func__() @staticmethod def GetDefaultEncoding(): From 7afeb1a610f867872f0f69e9a5f56fba71c1b7cc Mon Sep 17 00:00:00 2001 From: "d.kovalenko" Date: Thu, 20 Mar 2025 17:43:34 +0300 Subject: [PATCH 03/14] run_test.sh is corrected This patch fixes a problem with run the following commands: "time converage run ..." This command does not work (on altlinux-10 with custom build of PG). I do not know why it happened and do not know why it was working early. " time converage run ..." works without any problems. --- run_tests.sh | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/run_tests.sh b/run_tests.sh index 45fabe08..139172f9 100755 --- a/run_tests.sh +++ b/run_tests.sh @@ -46,15 +46,13 @@ time coverage run -a -m pytest -l -v -n 4 -k "${TEST_FILTER}" # run tests (PG_BIN) -time \ - PG_BIN=$(pg_config --bindir) \ - coverage run -a -m pytest -l -v -n 4 -k "${TEST_FILTER}" +PG_BIN=$(pg_config --bindir) \ +time coverage run -a -m pytest -l -v -n 4 -k "${TEST_FILTER}" # run tests (PG_CONFIG) -time \ - PG_CONFIG=$(pg_config --bindir)/pg_config \ - coverage run -a -m pytest -l -v -n 4 -k "${TEST_FILTER}" +PG_CONFIG=$(pg_config --bindir)/pg_config \ +time coverage run -a -m pytest -l -v -n 4 -k "${TEST_FILTER}" # show coverage From 55c70c571d71951bfa7e998065cea944dd3728c9 Mon Sep 17 00:00:00 2001 From: "d.kovalenko" Date: Thu, 20 Mar 2025 22:58:57 +0300 Subject: [PATCH 04/14] Docker file for AltLinux 10 is updated We manually compile and "install" PG: - create a symlink /usr/local/bin/pg_config - create a symlink /usr/lib64/libpq.so.5 Manual bild fixes the following problem: psycopg2.errors.ProtocolViolation: could not create replication slot "mysub": ERROR: could not access file "pgoutput": No such file or directory Failed tests: - TestTestgresCommon::test_logical_replication[remote_ops] - TestTestgresCommon::test_logical_catchup[local_ops] - TestTestgresCommon::test_logical_replication[local_ops] - TestTestgresCommon::test_logical_catchup[remote_ops] --- Dockerfile--altlinux_10.tmpl | 50 +++++++++++++++++++++++++++++++----- 1 file changed, 43 insertions(+), 7 deletions(-) diff --git a/Dockerfile--altlinux_10.tmpl b/Dockerfile--altlinux_10.tmpl index 4e770102..235e6e12 100644 --- a/Dockerfile--altlinux_10.tmpl +++ b/Dockerfile--altlinux_10.tmpl @@ -13,19 +13,55 @@ RUN apt-get install -y time RUN apt-get install -y mc -RUN apt-get update -RUN apt-get install -y postgresql-common -RUN apt-get install -y postgresql${PG_VERSION}-server -RUN apt-get install -y postgresql${PG_VERSION}-server-devel - RUN apt-get install -y libsqlite3-devel EXPOSE 22 RUN ssh-keygen -A +# --------------------------------------------- postgres +FROM base1 as base1_with_dev_tools + +RUN apt-get update + +RUN apt-get install -y git +RUN apt-get install -y gcc +RUN apt-get install -y make + +RUN apt-get install -y meson +RUN apt-get install -y flex +RUN apt-get install -y bison + +RUN apt-get install -y pkg-config +RUN apt-get install -y libssl-devel +RUN apt-get install -y libicu-devel +RUN apt-get install -y libzstd-devel +RUN apt-get install -y zlib-devel +RUN apt-get install -y liblz4-devel +RUN apt-get install -y libzstd-devel +RUN apt-get install -y libxml2-devel + +# --------------------------------------------- postgres +FROM base1_with_dev_tools as base1_with_pg-17 + +RUN git clone https://github.com/postgres/postgres.git -b REL_17_STABLE /pg/postgres/source + +WORKDIR /pg/postgres/source + +RUN ./configure --prefix=/pg/postgres/install --with-zlib --with-openssl --without-readline --with-lz4 --with-zstd --with-libxml +RUN make -j 4 install +RUN make -j 4 -C contrib install + +# SETUP PG_CONFIG +# When pg_config symlink in /usr/local/bin it returns a real (right) result of --bindir +RUN ln -s /pg/postgres/install/bin/pg_config -t /usr/local/bin + +# SETUP PG CLIENT LIBRARY +# libpq.so.5 is enough +RUN ln -s /pg/postgres/install/lib/libpq.so.5.17 /usr/lib64/libpq.so.5 + # --------------------------------------------- base2_with_python-3 -FROM base1 as base2_with_python-3 +FROM base1_with_pg-${PG_VERSION} as base2_with_python-3 RUN apt-get install -y python3 RUN apt-get install -y python3-dev RUN apt-get install -y python3-module-virtualenv @@ -42,7 +78,7 @@ RUN sh -c "echo \"WHEEL_USERS ALL=(ALL:ALL) NOPASSWD: ALL\"" >> /etc/sudoers ADD . /pg/testgres WORKDIR /pg/testgres -RUN chown -R test /pg +RUN chown -R test /pg/testgres ENV LANG=C.UTF-8 From f525954fc73d02e94a995b86648178972b64680a Mon Sep 17 00:00:00 2001 From: "d.kovalenko" Date: Fri, 21 Mar 2025 07:02:09 +0300 Subject: [PATCH 05/14] Dockerfile for Ubuntu 24.04 is corrected (time) time is installed manually. It fixes the following problem: ++ pg_config --bindir + PG_BIN=/usr/lib/postgresql/17/bin + time coverage run -a -m pytest -l -v -n 4 -k '' ./run_tests.sh: line 49: time: command not found --- Dockerfile--ubuntu_24_04.tmpl | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfile--ubuntu_24_04.tmpl b/Dockerfile--ubuntu_24_04.tmpl index c1ddeab6..3bdc6640 100644 --- a/Dockerfile--ubuntu_24_04.tmpl +++ b/Dockerfile--ubuntu_24_04.tmpl @@ -9,6 +9,7 @@ RUN apt update RUN apt install -y sudo curl ca-certificates RUN apt update RUN apt install -y openssh-server +RUN apt install -y time RUN apt update RUN apt install -y postgresql-common From 8300e84e234aaba5a57adb5d515d9437a187d5c5 Mon Sep 17 00:00:00 2001 From: "d.kovalenko" Date: Fri, 21 Mar 2025 11:31:39 +0300 Subject: [PATCH 06/14] [CI][AltLinux 10] Work with virtualenv is restored Alplinux does in creates /usr/bin/virtualenv but creates /usr/bin/virtualenv3. Let's create the symlink /usr/bin/virtualenv -> /usr/bin/virtualenv3 and restore an usage of virtualenv in run_tests.sh. --- Dockerfile--altlinux_10.tmpl | 11 +++++++++++ run_tests.sh | 3 +-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/Dockerfile--altlinux_10.tmpl b/Dockerfile--altlinux_10.tmpl index 235e6e12..37e8b379 100644 --- a/Dockerfile--altlinux_10.tmpl +++ b/Dockerfile--altlinux_10.tmpl @@ -66,6 +66,17 @@ RUN apt-get install -y python3 RUN apt-get install -y python3-dev RUN apt-get install -y python3-module-virtualenv RUN apt-get install -y python3-modules-sqlite3 + +# AltLinux does not have "generic" virtualenv utility. Let's create it. +RUN if [[ -f "/usr/bin/virtualenv" ]] ; then \ + echo AAA; \ + elif [[ -f "/usr/bin/virtualenv3" ]] ; then \ + ln -s /usr/bin/virtualenv3 /usr/bin/virtualenv; \ + else \ + echo "/usr/bin/virtualenv is not created!"; \ + exit 1; \ + fi + ENV PYTHON_VERSION=3 # --------------------------------------------- final diff --git a/run_tests.sh b/run_tests.sh index 139172f9..e8482b70 100755 --- a/run_tests.sh +++ b/run_tests.sh @@ -10,9 +10,8 @@ fi # choose python version echo python version is $PYTHON_VERSION -PYTHON="python$PYTHON_VERSION" PIP="pip$PYTHON_VERSION" -VIRTUALENV="${PYTHON} -m virtualenv --python=/usr/bin/python$PYTHON_VERSION" +VIRTUALENV="virtualenv --python=/usr/bin/python$PYTHON_VERSION" # fail early echo check that pg_config is in PATH From a5d8d99881e25659def1ed048098bd0c420abaa1 Mon Sep 17 00:00:00 2001 From: "d.kovalenko" Date: Fri, 21 Mar 2025 11:40:57 +0300 Subject: [PATCH 07/14] run_tests.sh is updated [original order is restored] --- run_tests.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/run_tests.sh b/run_tests.sh index e8482b70..f12b329b 100755 --- a/run_tests.sh +++ b/run_tests.sh @@ -10,8 +10,8 @@ fi # choose python version echo python version is $PYTHON_VERSION -PIP="pip$PYTHON_VERSION" VIRTUALENV="virtualenv --python=/usr/bin/python$PYTHON_VERSION" +PIP="pip$PYTHON_VERSION" # fail early echo check that pg_config is in PATH From 03e4799d02ff24dd1f4f503c426e8886b379defd Mon Sep 17 00:00:00 2001 From: "d.kovalenko" Date: Fri, 21 Mar 2025 12:07:48 +0300 Subject: [PATCH 08/14] run_tests.sh is updated [python] Python environment initialization has been simplified. --- run_tests.sh | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/run_tests.sh b/run_tests.sh index f12b329b..a40a97cf 100755 --- a/run_tests.sh +++ b/run_tests.sh @@ -8,24 +8,17 @@ if [ -z ${TEST_FILTER+x} ]; \ then export TEST_FILTER="TestgresTests or (TestTestgresCommon and (not remote_ops))"; \ fi -# choose python version -echo python version is $PYTHON_VERSION -VIRTUALENV="virtualenv --python=/usr/bin/python$PYTHON_VERSION" -PIP="pip$PYTHON_VERSION" - # fail early echo check that pg_config is in PATH command -v pg_config -# prepare environment -VENV_PATH=/tmp/testgres_venv +# prepare python environment +VENV_PATH="/tmp/testgres_venv" rm -rf $VENV_PATH -$VIRTUALENV $VENV_PATH +virtualenv --python="/usr/bin/python${PYTHON_VERSION}" "${VENV_PATH}" export VIRTUAL_ENV_DISABLE_PROMPT=1 -source $VENV_PATH/bin/activate - -# install utilities -$PIP install coverage flake8 psutil Sphinx pytest pytest-xdist psycopg2 six psutil +source "${VENV_PATH}/bin/activate" +pip install coverage flake8 psutil Sphinx pytest pytest-xdist psycopg2 six psutil # install testgres' dependencies export PYTHONPATH=$(pwd) From 126608d4c2f654122b29e132a97ea32112440c4b Mon Sep 17 00:00:00 2001 From: "d.kovalenko" Date: Fri, 21 Mar 2025 12:41:30 +0300 Subject: [PATCH 09/14] [CI] work with 'time' is corrected AltLinux 10 does not support the sequential "time coverage run ...". Because this OS does not has a builtin command 'time' in bash. https://forum.altlinux.org/index.php?topic=48342.0 We will install 'time' manually and use another command " time coverage run ..." that works without problems but it requires to install 'time' on Ubuntu 2024.04, too. AlpineLinux processes a new command line without any problems. --- Dockerfile--ubuntu_24_04.tmpl | 1 + run_tests.sh | 10 ++++------ 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/Dockerfile--ubuntu_24_04.tmpl b/Dockerfile--ubuntu_24_04.tmpl index c1ddeab6..3bdc6640 100644 --- a/Dockerfile--ubuntu_24_04.tmpl +++ b/Dockerfile--ubuntu_24_04.tmpl @@ -9,6 +9,7 @@ RUN apt update RUN apt install -y sudo curl ca-certificates RUN apt update RUN apt install -y openssh-server +RUN apt install -y time RUN apt update RUN apt install -y postgresql-common diff --git a/run_tests.sh b/run_tests.sh index 0fecde60..f12b329b 100755 --- a/run_tests.sh +++ b/run_tests.sh @@ -45,15 +45,13 @@ time coverage run -a -m pytest -l -v -n 4 -k "${TEST_FILTER}" # run tests (PG_BIN) -time \ - PG_BIN=$(pg_config --bindir) \ - coverage run -a -m pytest -l -v -n 4 -k "${TEST_FILTER}" +PG_BIN=$(pg_config --bindir) \ +time coverage run -a -m pytest -l -v -n 4 -k "${TEST_FILTER}" # run tests (PG_CONFIG) -time \ - PG_CONFIG=$(pg_config --bindir)/pg_config \ - coverage run -a -m pytest -l -v -n 4 -k "${TEST_FILTER}" +PG_CONFIG=$(pg_config --bindir)/pg_config \ +time coverage run -a -m pytest -l -v -n 4 -k "${TEST_FILTER}" # show coverage From 62d1d2048fd8906ceed7099a4440617842d3e1c4 Mon Sep 17 00:00:00 2001 From: "d.kovalenko" Date: Fri, 21 Mar 2025 12:44:34 +0300 Subject: [PATCH 10/14] [CI] An initization of python virtualenv is simplified Let's avoid creating useless environment variables. --- run_tests.sh | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/run_tests.sh b/run_tests.sh index f12b329b..a40a97cf 100755 --- a/run_tests.sh +++ b/run_tests.sh @@ -8,24 +8,17 @@ if [ -z ${TEST_FILTER+x} ]; \ then export TEST_FILTER="TestgresTests or (TestTestgresCommon and (not remote_ops))"; \ fi -# choose python version -echo python version is $PYTHON_VERSION -VIRTUALENV="virtualenv --python=/usr/bin/python$PYTHON_VERSION" -PIP="pip$PYTHON_VERSION" - # fail early echo check that pg_config is in PATH command -v pg_config -# prepare environment -VENV_PATH=/tmp/testgres_venv +# prepare python environment +VENV_PATH="/tmp/testgres_venv" rm -rf $VENV_PATH -$VIRTUALENV $VENV_PATH +virtualenv --python="/usr/bin/python${PYTHON_VERSION}" "${VENV_PATH}" export VIRTUAL_ENV_DISABLE_PROMPT=1 -source $VENV_PATH/bin/activate - -# install utilities -$PIP install coverage flake8 psutil Sphinx pytest pytest-xdist psycopg2 six psutil +source "${VENV_PATH}/bin/activate" +pip install coverage flake8 psutil Sphinx pytest pytest-xdist psycopg2 six psutil # install testgres' dependencies export PYTHONPATH=$(pwd) From 8d68c688ee2319cdc1ca23df5d0b18f0e9e962a5 Mon Sep 17 00:00:00 2001 From: "d.kovalenko" Date: Mon, 24 Mar 2025 07:25:12 +0300 Subject: [PATCH 11/14] [CI] AltLinux runs only "local" tests. We exclude "remote" tests until a problem with slow SSH connection has been resolved. --- Dockerfile--altlinux_10.tmpl | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Dockerfile--altlinux_10.tmpl b/Dockerfile--altlinux_10.tmpl index 37e8b379..10fd27e9 100644 --- a/Dockerfile--altlinux_10.tmpl +++ b/Dockerfile--altlinux_10.tmpl @@ -98,6 +98,12 @@ USER test RUN chmod 700 ~/ RUN mkdir -p ~/.ssh +# +# Altlinux 10 and 11 too slowly create a new SSH connection (x6). +# +# So, we exclude the "remote" tests until this problem has been resolved. +# + ENTRYPOINT sh -c " \ set -eux; \ echo HELLO FROM ENTRYPOINT; \ @@ -109,5 +115,5 @@ ssh-keygen -t rsa -f ~/.ssh/id_rsa -q -N ''; \ cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys; \ chmod 600 ~/.ssh/authorized_keys; \ ls -la ~/.ssh/; \ -TEST_FILTER=\"\" bash ./run_tests.sh;" +TEST_FILTER=\"TestgresTests or (TestTestgresCommon and (not remote_ops))\" bash ./run_tests.sh;" From 0c78836ff13b3bb951b480bf6d9f328592396be1 Mon Sep 17 00:00:00 2001 From: "d.kovalenko" Date: Mon, 24 Mar 2025 09:28:24 +0300 Subject: [PATCH 12/14] Formatting --- Dockerfile--altlinux_10.tmpl | 1 - 1 file changed, 1 deletion(-) diff --git a/Dockerfile--altlinux_10.tmpl b/Dockerfile--altlinux_10.tmpl index 10fd27e9..b45a10c5 100644 --- a/Dockerfile--altlinux_10.tmpl +++ b/Dockerfile--altlinux_10.tmpl @@ -116,4 +116,3 @@ cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys; \ chmod 600 ~/.ssh/authorized_keys; \ ls -la ~/.ssh/; \ TEST_FILTER=\"TestgresTests or (TestTestgresCommon and (not remote_ops))\" bash ./run_tests.sh;" - From fbd29e1eadd192f7ea622238a964fcbc516a457c Mon Sep 17 00:00:00 2001 From: "d.kovalenko" Date: Mon, 24 Mar 2025 09:31:56 +0300 Subject: [PATCH 13/14] [CI] The test on AltLinux 11 is added [local only] --- .travis.yml | 1 + Dockerfile--altlinux_11.tmpl | 118 +++++++++++++++++++++++++++++++++++ 2 files changed, 119 insertions(+) create mode 100644 Dockerfile--altlinux_11.tmpl diff --git a/.travis.yml b/.travis.yml index 1668e5b1..7557a2ce 100644 --- a/.travis.yml +++ b/.travis.yml @@ -29,3 +29,4 @@ env: - TEST_PLATFORM=std-all PYTHON_VERSION=3 PG_VERSION=17 - TEST_PLATFORM=ubuntu_24_04 PYTHON_VERSION=3 PG_VERSION=17 - TEST_PLATFORM=altlinux_10 PYTHON_VERSION=3 PG_VERSION=17 + - TEST_PLATFORM=altlinux_11 PYTHON_VERSION=3 PG_VERSION=17 diff --git a/Dockerfile--altlinux_11.tmpl b/Dockerfile--altlinux_11.tmpl new file mode 100644 index 00000000..a5ac3898 --- /dev/null +++ b/Dockerfile--altlinux_11.tmpl @@ -0,0 +1,118 @@ +ARG PG_VERSION +ARG PYTHON_VERSION + +# --------------------------------------------- base1 +FROM alt:p11 as base1 +ARG PG_VERSION + +RUN apt-get update +RUN apt-get install -y sudo curl ca-certificates +RUN apt-get update +RUN apt-get install -y openssh-server openssh-clients +RUN apt-get install -y time + +RUN apt-get install -y mc + +RUN apt-get install -y libsqlite3-devel + +EXPOSE 22 + +RUN ssh-keygen -A + +# --------------------------------------------- postgres +FROM base1 as base1_with_dev_tools + +RUN apt-get update + +RUN apt-get install -y git +RUN apt-get install -y gcc +RUN apt-get install -y make + +RUN apt-get install -y meson +RUN apt-get install -y flex +RUN apt-get install -y bison + +RUN apt-get install -y pkg-config +RUN apt-get install -y libssl-devel +RUN apt-get install -y libicu-devel +RUN apt-get install -y libzstd-devel +RUN apt-get install -y zlib-devel +RUN apt-get install -y liblz4-devel +RUN apt-get install -y libzstd-devel +RUN apt-get install -y libxml2-devel + +# --------------------------------------------- postgres +FROM base1_with_dev_tools as base1_with_pg-17 + +RUN git clone https://github.com/postgres/postgres.git -b REL_17_STABLE /pg/postgres/source + +WORKDIR /pg/postgres/source + +RUN ./configure --prefix=/pg/postgres/install --with-zlib --with-openssl --without-readline --with-lz4 --with-zstd --with-libxml +RUN make -j 4 install +RUN make -j 4 -C contrib install + +# SETUP PG_CONFIG +# When pg_config symlink in /usr/local/bin it returns a real (right) result of --bindir +RUN ln -s /pg/postgres/install/bin/pg_config -t /usr/local/bin + +# SETUP PG CLIENT LIBRARY +# libpq.so.5 is enough +RUN ln -s /pg/postgres/install/lib/libpq.so.5.17 /usr/lib64/libpq.so.5 + +# --------------------------------------------- base2_with_python-3 +FROM base1_with_pg-${PG_VERSION} as base2_with_python-3 +RUN apt-get install -y python3 +RUN apt-get install -y python3-dev +RUN apt-get install -y python3-module-virtualenv +RUN apt-get install -y python3-modules-sqlite3 + +# AltLinux does not have "generic" virtualenv utility. Let's create it. +RUN if [[ -f "/usr/bin/virtualenv" ]] ; then \ + echo AAA; \ + elif [[ -f "/usr/bin/virtualenv3" ]] ; then \ + ln -s /usr/bin/virtualenv3 /usr/bin/virtualenv; \ + else \ + echo "/usr/bin/virtualenv is not created!"; \ + exit 1; \ + fi + +ENV PYTHON_VERSION=3 + +# --------------------------------------------- final +FROM base2_with_python-${PYTHON_VERSION} as final + +RUN adduser test -G wheel + +# It enables execution of "sudo service ssh start" without password +RUN sh -c "echo \"WHEEL_USERS ALL=(ALL:ALL) NOPASSWD: ALL\"" >> /etc/sudoers + +ADD . /pg/testgres +WORKDIR /pg/testgres +RUN chown -R test /pg/testgres + +ENV LANG=C.UTF-8 + +USER test + +RUN chmod 700 ~/ +RUN mkdir -p ~/.ssh + +# +# Altlinux 10 and 11 too slowly create a new SSH connection (x6). +# +# So, we exclude the "remote" tests until this problem has been resolved. +# + +ENTRYPOINT sh -c " \ +set -eux; \ +echo HELLO FROM ENTRYPOINT; \ +echo HOME DIR IS [`realpath ~/`]; \ +sudo /usr/sbin/sshd; \ +ssh-keyscan -H localhost >> ~/.ssh/known_hosts; \ +ssh-keyscan -H 127.0.0.1 >> ~/.ssh/known_hosts; \ +ssh-keygen -t rsa -f ~/.ssh/id_rsa -q -N ''; \ +cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys; \ +chmod 600 ~/.ssh/authorized_keys; \ +ls -la ~/.ssh/; \ +TEST_FILTER=\"TestgresTests or (TestTestgresCommon and (not remote_ops))\" bash ./run_tests.sh;" From 9fbf8a570494d734b27c76c71ee3c9285e5ea9d6 Mon Sep 17 00:00:00 2001 From: "d.kovalenko" Date: Mon, 24 Mar 2025 10:52:48 +0300 Subject: [PATCH 14/14] [CI] AltLinux dockerfiles are updated (cleanup) Installation of mc is deleted. --- Dockerfile--altlinux_10.tmpl | 2 +- Dockerfile--altlinux_11.tmpl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile--altlinux_10.tmpl b/Dockerfile--altlinux_10.tmpl index b45a10c5..e60e9320 100644 --- a/Dockerfile--altlinux_10.tmpl +++ b/Dockerfile--altlinux_10.tmpl @@ -11,7 +11,7 @@ RUN apt-get update RUN apt-get install -y openssh-server openssh-clients RUN apt-get install -y time -RUN apt-get install -y mc +# RUN apt-get install -y mc RUN apt-get install -y libsqlite3-devel diff --git a/Dockerfile--altlinux_11.tmpl b/Dockerfile--altlinux_11.tmpl index a5ac3898..4b591632 100644 --- a/Dockerfile--altlinux_11.tmpl +++ b/Dockerfile--altlinux_11.tmpl @@ -11,7 +11,7 @@ RUN apt-get update RUN apt-get install -y openssh-server openssh-clients RUN apt-get install -y time -RUN apt-get install -y mc +# RUN apt-get install -y mc RUN apt-get install -y libsqlite3-devel