Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite1a5bb4

Browse files
Updating of CI-tests (#197)
* Test dockerfile for ubuntu 24.04 is added* Cleanup (Dockerfile--ubuntu-24_04)* Cleanup.Including of 'postgres' in 'sudo' group is not required.* [run_tests.sh] A right way for obtaining of BINDIR and PG_CONFIG is usedA problem was detected in container with Ubuntu 24.04tests works with "/usr/bin/pg_config" but real pg_config is "/usr/lib/postgresql/17/bin/pg_config"To resovle this problem we will call "pg_config --bindir" and use it result for BINDIR and PG_CONFIG.* Dockerfile--ubuntu-24_04 is updatedLet's use /pg/testgres/run_tests.sh directly.* Dockerfile--ubuntu-24_04 is updated (cleanup)curl is installing twice.* Dockerfile--ubuntu-24_04 is updated (cleanup)[del] musl-dev[del] mc* Dockerfile--ubuntu-24_04 is formatted* CI-test on Ubuntu 24.04 is added.* Dockerfile--std.tmpl is updated (refactoring)/pg/testgres/run_tests.sh is used directly.* Dockerfile--ubuntu-24_04.tmpl is updated* PostgresNode::pid is improved- We do multiple attempts to read pid file.- We process a case when we see that node is stopped between test and read.- We process a case when pid-file is empty.* PostgresNode::pid is updatedAssert is added.* execute_utility2 is updated (ignore_errors)- New parameters "ignore_errors" is added. Default value is False.- Asserts are added.* PostgresNode::_try_shutdown is rewrited (normalization)* PostgresNode::pid uses the data from "pg_ctl status" output.* PostgresNode::_try_shutdown is correct (return None)This method returns nothing (None).* [RemoteOperations] A call of mktemp is fixedWhen we define a template we have to use "-t" option. It forces mktemp to return a path instead name.The following methods of RemoteOperations are fixed: - mkdtemp - mkstemp* Total refactoring of os_ops::execute_commandMain - We check only an exit code to detect an error. - If someone utility returns a result through an exit code, a caller side should set ignore_errors=true and process this case itself. - If expect_error is true and no errors occurred, we raise an InvalidOperationException.* Dockerfile--ubuntu-24_04.tmpl is updatedThe folder "home/postgres" is not required now.* The old behaviour of RaiseError.UtilityExitedWithNonZeroCode is restoredLet's rollback the new code to avoid problems with probackup2' tests.* TestRemoteOperations::test_is_executable_true is correctedLet's test a real pg_config.* xxx::test_logging is corrected (local, remote)- these tests configure logging wrong and create the conflicts with root logger- these tests (local and remote) conflict with each other* TEST_FILTER is added* CI on Ubuntu 24.04 runs all the tests
1 parent7abca7f commite1a5bb4

5 files changed

+86
-26
lines changed

‎.travis.yml

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -20,23 +20,17 @@ notifications:
2020
on_failure:always
2121

2222
env:
23-
-PYTHON_VERSION=3 PG_VERSION=17
24-
-PYTHON_VERSION=3 PG_VERSION=16
25-
-PYTHON_VERSION=3 PG_VERSION=15
26-
-PYTHON_VERSION=3 PG_VERSION=14
27-
-PYTHON_VERSION=3 PG_VERSION=13
28-
-PYTHON_VERSION=3 PG_VERSION=12
29-
-PYTHON_VERSION=3 PG_VERSION=11
30-
-PYTHON_VERSION=3 PG_VERSION=10
31-
# - PYTHON_VERSION=3 PG_VERSION=9.6
32-
# - PYTHON_VERSION=3 PG_VERSION=9.5
33-
# - PYTHON_VERSION=3 PG_VERSION=9.4
34-
# - PYTHON_VERSION=2 PG_VERSION=10
35-
# - PYTHON_VERSION=2 PG_VERSION=9.6
36-
# - PYTHON_VERSION=2 PG_VERSION=9.5
37-
# - PYTHON_VERSION=2 PG_VERSION=9.4
23+
-TEST_PLATFORM=std PYTHON_VERSION=3 PG_VERSION=17
24+
-TEST_PLATFORM=std PYTHON_VERSION=3 PG_VERSION=16
25+
-TEST_PLATFORM=std PYTHON_VERSION=3 PG_VERSION=15
26+
-TEST_PLATFORM=std PYTHON_VERSION=3 PG_VERSION=14
27+
-TEST_PLATFORM=std PYTHON_VERSION=3 PG_VERSION=13
28+
-TEST_PLATFORM=std PYTHON_VERSION=3 PG_VERSION=12
29+
-TEST_PLATFORM=std PYTHON_VERSION=3 PG_VERSION=11
30+
-TEST_PLATFORM=std PYTHON_VERSION=3 PG_VERSION=10
31+
-TEST_PLATFORM=ubuntu-24_04 PYTHON_VERSION=3 PG_VERSION=17
3832

3933
matrix:
4034
allow_failures:
41-
-env:PYTHON_VERSION=3 PG_VERSION=11
42-
-env:PYTHON_VERSION=3 PG_VERSION=10
35+
-env:TEST_PLATFORM=stdPYTHON_VERSION=3 PG_VERSION=11
36+
-env:TEST_PLATFORM=stdPYTHON_VERSION=3 PG_VERSION=10

‎Dockerfile.tmplrenamed to‎Dockerfile--std.tmpl

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,9 @@ RUN if [ "${PYTHON_VERSION}" = "3" ] ; then \
1111
fi
1212
ENV LANG=C.UTF-8
1313

14-
RUN mkdir -p /pg
15-
COPY run_tests.sh /run.sh
16-
RUN chmod 755 /run.sh
17-
1814
ADD . /pg/testgres
1915
WORKDIR /pg/testgres
2016
RUN chown -R postgres:postgres /pg
2117

2218
USER postgres
23-
ENTRYPOINT PYTHON_VERSION=${PYTHON_VERSION}/run.sh
19+
ENTRYPOINT PYTHON_VERSION=${PYTHON_VERSION}bash run_tests.sh

‎Dockerfile--ubuntu-24_04.tmpl

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
FROM ubuntu:24.04
2+
3+
RUN apt update
4+
RUN apt install -y sudo curl ca-certificates postgresql-common
5+
6+
RUN bash /usr/share/postgresql-common/pgdg/apt.postgresql.org.sh -y
7+
8+
RUN install -d /usr/share/postgresql-common/pgdg
9+
RUN curl -o /usr/share/postgresql-common/pgdg/apt.postgresql.org.asc --fail https://www.postgresql.org/media/keys/ACCC4CF8.asc
10+
11+
# It does not work
12+
# 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'
13+
14+
RUN apt update
15+
RUN apt install -y postgresql-${PG_VERSION}
16+
17+
RUN apt install -y python3 python3-dev python3-virtualenv
18+
# RUN apt install -y mc
19+
20+
# It is required for psycopg2
21+
RUN apt install -y libpq-dev
22+
RUN apt install -y openssh-server
23+
24+
# [2025-02-26] It adds the user 'postgres' in the group 'sudo'
25+
# [2025-02-27] It is not required.
26+
# RUN adduser postgres sudo
27+
28+
ADD . /pg/testgres
29+
WORKDIR /pg/testgres
30+
RUN chown -R postgres /pg
31+
32+
EXPOSE 22
33+
34+
RUN ssh-keygen -A
35+
36+
# It enables execution of "sudo service ssh start" without password
37+
RUN sh -c "echo postgres ALL=NOPASSWD:/usr/sbin/service ssh start" >> /etc/sudoers
38+
39+
USER postgres
40+
41+
ENV LANG=C.UTF-8
42+
43+
#ENTRYPOINT PYTHON_VERSION=3.12 /run.sh
44+
ENTRYPOINT sh -c " \
45+
#set -eux; \
46+
echo HELLO FROM ENTRYPOINT; \
47+
echo HOME DIR IS [`realpath ~/`]; \
48+
echo POINT 1; \
49+
chmod go-w /var/lib/postgresql; \
50+
echo POINT 1.5; \
51+
mkdir -p ~/.ssh; \
52+
echo POINT 2; \
53+
service ssh enable; \
54+
echo POINT 3; \
55+
sudo service ssh start; \
56+
echo POINT 4; \
57+
ssh-keyscan -H localhost >> ~/.ssh/known_hosts; \
58+
echo POINT 5; \
59+
ssh-keyscan -H 127.0.0.1 >> ~/.ssh/known_hosts; \
60+
echo POINT 6; \
61+
ssh-keygen -t rsa -f ~/.ssh/id_rsa -q -N ''; \
62+
echo ----; \
63+
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys; \
64+
echo ----; \
65+
chmod 600 ~/.ssh/authorized_keys; \
66+
echo ----; \
67+
ls -la ~/.ssh/; \
68+
echo ----; \
69+
TEST_FILTER="" PYTHON_VERSION=${PYTHON_VERSION} bash run_tests.sh;"

‎mk_dockerfile.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
set -eu
2-
sed -e's/${PYTHON_VERSION}/'${PYTHON_VERSION}/g -e's/${PG_VERSION}/'${PG_VERSION}/g Dockerfile.tmpl> Dockerfile
2+
sed -e's/${PYTHON_VERSION}/'${PYTHON_VERSION}/g -e's/${PG_VERSION}/'${PG_VERSION}/g Dockerfile--${TEST_PLATFORM}.tmpl> Dockerfile

‎run_tests.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
set -eux
66

7+
if [-z${TEST_FILTER+x} ];thenexport TEST_FILTER="TestgresTests";fi
78

89
# choose python version
910
echo python version is$PYTHON_VERSION
@@ -38,19 +39,19 @@ rm -f $COVERAGE_FILE
3839

3940

4041
# run tests (PATH)
41-
time coverage run -a -m pytest -l -v -n 4 -k"TestgresTests"
42+
time coverage run -a -m pytest -l -v -n 4 -k"${TEST_FILTER}"
4243

4344

4445
# run tests (PG_BIN)
4546
time \
4647
PG_BIN=$(pg_config --bindir) \
47-
coverage run -a -m pytest -l -v -n 4 -k"TestgresTests"
48+
coverage run -a -m pytest -l -v -n 4 -k"${TEST_FILTER}"
4849

4950

5051
# run tests (PG_CONFIG)
5152
time \
5253
PG_CONFIG=$(pg_config --bindir)/pg_config \
53-
coverage run -a -m pytest -l -v -n 4 -k"TestgresTests"
54+
coverage run -a -m pytest -l -v -n 4 -k"${TEST_FILTER}"
5455

5556

5657
# show coverage

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp