diff --git a/.travis.yml b/.travis.yml index 6f63a67b..4110835a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -20,23 +20,17 @@ notifications: on_failure: always env: - - PYTHON_VERSION=3 PG_VERSION=17 - - PYTHON_VERSION=3 PG_VERSION=16 - - PYTHON_VERSION=3 PG_VERSION=15 - - PYTHON_VERSION=3 PG_VERSION=14 - - PYTHON_VERSION=3 PG_VERSION=13 - - PYTHON_VERSION=3 PG_VERSION=12 - - PYTHON_VERSION=3 PG_VERSION=11 - - PYTHON_VERSION=3 PG_VERSION=10 -# - PYTHON_VERSION=3 PG_VERSION=9.6 -# - PYTHON_VERSION=3 PG_VERSION=9.5 -# - PYTHON_VERSION=3 PG_VERSION=9.4 -# - PYTHON_VERSION=2 PG_VERSION=10 -# - PYTHON_VERSION=2 PG_VERSION=9.6 -# - PYTHON_VERSION=2 PG_VERSION=9.5 -# - PYTHON_VERSION=2 PG_VERSION=9.4 + - TEST_PLATFORM=std PYTHON_VERSION=3 PG_VERSION=17 + - TEST_PLATFORM=std PYTHON_VERSION=3 PG_VERSION=16 + - TEST_PLATFORM=std PYTHON_VERSION=3 PG_VERSION=15 + - TEST_PLATFORM=std PYTHON_VERSION=3 PG_VERSION=14 + - TEST_PLATFORM=std PYTHON_VERSION=3 PG_VERSION=13 + - TEST_PLATFORM=std PYTHON_VERSION=3 PG_VERSION=12 + - TEST_PLATFORM=std PYTHON_VERSION=3 PG_VERSION=11 + - TEST_PLATFORM=std PYTHON_VERSION=3 PG_VERSION=10 + - TEST_PLATFORM=ubuntu-24_04 PYTHON_VERSION=3 PG_VERSION=17 matrix: allow_failures: - - env: PYTHON_VERSION=3 PG_VERSION=11 - - env: PYTHON_VERSION=3 PG_VERSION=10 + - env: TEST_PLATFORM=std PYTHON_VERSION=3 PG_VERSION=11 + - env: TEST_PLATFORM=std PYTHON_VERSION=3 PG_VERSION=10 diff --git a/Dockerfile.tmpl b/Dockerfile--std.tmpl similarity index 80% rename from Dockerfile.tmpl rename to Dockerfile--std.tmpl index dc5878b6..d844c9a3 100644 --- a/Dockerfile.tmpl +++ b/Dockerfile--std.tmpl @@ -11,13 +11,9 @@ RUN if [ "${PYTHON_VERSION}" = "3" ] ; then \ fi ENV LANG=C.UTF-8 -RUN mkdir -p /pg -COPY run_tests.sh /run.sh -RUN chmod 755 /run.sh - ADD . /pg/testgres WORKDIR /pg/testgres RUN chown -R postgres:postgres /pg USER postgres -ENTRYPOINT PYTHON_VERSION=${PYTHON_VERSION} /run.sh +ENTRYPOINT PYTHON_VERSION=${PYTHON_VERSION} bash run_tests.sh diff --git a/Dockerfile--ubuntu-24_04.tmpl b/Dockerfile--ubuntu-24_04.tmpl new file mode 100644 index 00000000..99be5343 --- /dev/null +++ b/Dockerfile--ubuntu-24_04.tmpl @@ -0,0 +1,69 @@ +FROM ubuntu:24.04 + +RUN apt update +RUN apt install -y sudo curl ca-certificates postgresql-common + +RUN bash /usr/share/postgresql-common/pgdg/apt.postgresql.org.sh -y + +RUN install -d /usr/share/postgresql-common/pgdg +RUN curl -o /usr/share/postgresql-common/pgdg/apt.postgresql.org.asc --fail https://www.postgresql.org/media/keys/ACCC4CF8.asc + +# It does not work +# RUN sh -c 'echo "deb [signed-by=/usr/share/postgresql-common/pgdg/apt.postgresql.org.asc] https://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list' + +RUN apt update +RUN apt install -y postgresql-${PG_VERSION} + +RUN apt install -y python3 python3-dev python3-virtualenv +# RUN apt install -y mc + +# It is required for psycopg2 +RUN apt install -y libpq-dev +RUN apt install -y openssh-server + +# [2025-02-26] It adds the user 'postgres' in the group 'sudo' +# [2025-02-27] It is not required. +# RUN adduser postgres sudo + +ADD . /pg/testgres +WORKDIR /pg/testgres +RUN chown -R postgres /pg + +EXPOSE 22 + +RUN ssh-keygen -A + +# It enables execution of "sudo service ssh start" without password +RUN sh -c "echo postgres ALL=NOPASSWD:/usr/sbin/service ssh start" >> /etc/sudoers + +USER postgres + +ENV LANG=C.UTF-8 + +#ENTRYPOINT PYTHON_VERSION=3.12 /run.sh +ENTRYPOINT sh -c " \ +#set -eux; \ +echo HELLO FROM ENTRYPOINT; \ +echo HOME DIR IS [`realpath ~/`]; \ +echo POINT 1; \ +chmod go-w /var/lib/postgresql; \ +echo POINT 1.5; \ +mkdir -p ~/.ssh; \ +echo POINT 2; \ +service ssh enable; \ +echo POINT 3; \ +sudo service ssh start; \ +echo POINT 4; \ +ssh-keyscan -H localhost >> ~/.ssh/known_hosts; \ +echo POINT 5; \ +ssh-keyscan -H 127.0.0.1 >> ~/.ssh/known_hosts; \ +echo POINT 6; \ +ssh-keygen -t rsa -f ~/.ssh/id_rsa -q -N ''; \ +echo ----; \ +cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys; \ +echo ----; \ +chmod 600 ~/.ssh/authorized_keys; \ +echo ----; \ +ls -la ~/.ssh/; \ +echo ----; \ +TEST_FILTER="" PYTHON_VERSION=${PYTHON_VERSION} bash run_tests.sh;" diff --git a/mk_dockerfile.sh b/mk_dockerfile.sh index d2aa3a8a..8f7876a3 100755 --- a/mk_dockerfile.sh +++ b/mk_dockerfile.sh @@ -1,2 +1,2 @@ set -eu -sed -e 's/${PYTHON_VERSION}/'${PYTHON_VERSION}/g -e 's/${PG_VERSION}/'${PG_VERSION}/g Dockerfile.tmpl > Dockerfile +sed -e 's/${PYTHON_VERSION}/'${PYTHON_VERSION}/g -e 's/${PG_VERSION}/'${PG_VERSION}/g Dockerfile--${TEST_PLATFORM}.tmpl > Dockerfile diff --git a/run_tests.sh b/run_tests.sh index 5cbbac60..021f9d9f 100755 --- a/run_tests.sh +++ b/run_tests.sh @@ -4,6 +4,7 @@ set -eux +if [ -z ${TEST_FILTER+x} ]; then export TEST_FILTER="TestgresTests"; fi # choose python version echo python version is $PYTHON_VERSION @@ -38,19 +39,19 @@ rm -f $COVERAGE_FILE # run tests (PATH) -time coverage run -a -m pytest -l -v -n 4 -k "TestgresTests" +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 "TestgresTests" + 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 "TestgresTests" + coverage run -a -m pytest -l -v -n 4 -k "${TEST_FILTER}" # show coverage