Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/package-verification.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,9 @@ jobs:
- platform: "altlinux_11"
python: "3"
postgres: "17"
- platform: "astralinux_1_7"
python: "3"
postgres: "17"

steps:
- name: Prepare variables
Expand Down
112 changes: 112 additions & 0 deletions Dockerfile--astralinux_1_7.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
ARG PG_VERSION
ARG PYTHON_VERSION

# --------------------------------------------- base1
FROM packpack/packpack:astra-1.7 AS base1

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 install -y netcat-traditional

RUN apt install -y git

# --------------------------------------------- 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-dev
RUN apt-get install -y libicu-dev
RUN apt-get install -y libzstd-dev
RUN apt-get install -y zlib1g-dev
RUN apt-get install -y liblz4-dev
RUN apt-get install -y libzstd-dev
RUN apt-get install -y libxml2-dev

# --------------------------------------------- postgres
FROM base1_with_dev_tools AS base1_with_pg-17

RUN curl -fsSL https://ftp.postgresql.org/pub/source/v17.7/postgresql-17.7.tar.bz2 -o postgresql.tar.bz2 \
&& mkdir -p /pg/postgres/source \
&& tar -xjf postgresql.tar.bz2 -C /pg/postgres/source --strip-components=1 \
&& rm postgresql.tar.bz2

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/lib/libpq.so.5

# --------------------------------------------- base2_with_python-3
FROM base1_with_pg-${PG_VERSION} AS base2_with_python-3
RUN apt install -y python3 python3-dev python3-venv

ENV PYTHON_BINARY=python3

# --------------------------------------------- final
FROM base2_with_python-${PYTHON_VERSION} AS final

EXPOSE 22

RUN ssh-keygen -A

RUN useradd -m test

# It enables execution of "sudo service ssh start" without password
# MY OLD:
# RUN sh -c "echo test ALL=NOPASSWD:ALL" >> /etc/sudoers
# AI:
RUN echo "test ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers

# THIS CMD IS NEEDED TO CONNECT THROUGH SSH WITHOUT PASSWORD
RUN sh -c "echo "test:*" | chpasswd -e"
RUN sed -i 's/UsePAM yes/UsePAM no/' /etc/ssh/sshd_config

ADD --chown=test:test . /home/test/testgres
WORKDIR /home/test/testgres
RUN mkdir /home/test/testgres/logs
RUN chown -R test:test /home/test/testgres/logs

ENV LANG=C.UTF-8

USER test

RUN chmod 700 ~/
RUN mkdir -p ~/.ssh
RUN chmod 700 ~/.ssh

ENTRYPOINT sh -c " \
set -eux; \
echo HELLO FROM ENTRYPOINT; \
echo HOME DIR IS [`realpath ~/`]; \
ls -la .; \
sudo service ssh start; \
sudo chmod 777 /home/test/testgres/logs; \
ls -la . | grep logs; \
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;"
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

# testgres

Utility for orchestrating temporary PostgreSQL clusters in Python tests. Supports Python 3.7.17 and newer.
Utility for orchestrating temporary PostgreSQL clusters in Python tests. Supports Python 3.7.3 and newer.

## Installation

Expand Down
1 change: 1 addition & 0 deletions run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ rm -rf $VENV_PATH
${PYTHON_BINARY} -m venv "${VENV_PATH}"
export VIRTUAL_ENV_DISABLE_PROMPT=1
source "${VENV_PATH}/bin/activate"
pip install --upgrade pip setuptools wheel
pip install -r tests/requirements.txt

# remove existing coverage file
Expand Down