Skip to content

Commit c799a70

Browse files
committed
Separate the long-lasting Z0DAN sync TAP test.
Designed to be highly competitive, this test consumes more CPU, disk, and memory resources than usual. To let people pass basic checks on their ongoing commits faster, turn off this test in the schedule and separate it as a GitHub action. Also, it appears that we copied Spock into the base image. Hence, the 'step-1' Docker image might use oldish versions of the patches.
1 parent 57566f6 commit c799a70

File tree

5 files changed

+149
-6
lines changed

5 files changed

+149
-6
lines changed

.github/workflows/zodan_sync.yml

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# Keep its logic in sync with spockbench.yml!
2+
3+
name: Z0DAN Sync long-lasting test
4+
on:
5+
workflow_dispatch:
6+
schedule:
7+
- cron: '0 22 * * 6' # Saturday, 22:00 (UTC)
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
pull-and-test:
14+
strategy:
15+
fail-fast: false
16+
matrix:
17+
os: [ubuntu-latest]
18+
pgver: [15, 16, 17, 18]
19+
20+
runs-on: ${{ matrix.os }}
21+
22+
steps:
23+
- name: Checkout spock
24+
uses: actions/checkout@v4
25+
with:
26+
ref: ${{ github.ref }}
27+
28+
- name: Add permissions
29+
run: |
30+
sudo chmod -R a+w ${GITHUB_WORKSPACE}
31+
32+
- name: Set up Docker
33+
# Codacy wants us to use full commit SHA. This is for v3
34+
uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3
35+
36+
- name: Set up docker compose
37+
# Codacy wants us to use full commit SHA. This is for v1
38+
uses: docker/setup-compose-action@364cc21a5de5b1ee4a7f5f9d3fa374ce0ccde746 # v1
39+
with:
40+
version: latest
41+
42+
- name: Build docker container
43+
run: |
44+
cd ${GITHUB_WORKSPACE}/
45+
ls -la
46+
ls -la sql
47+
ls -la tests/
48+
ls -la tests/tap
49+
ls -la tests/tap/t
50+
cat tests/tap/t/011_zodan_sync_third.pl
51+
docker build \
52+
--build-arg PGVER=${{ matrix.pgver }} \
53+
-t spock -f tests/docker/Dockerfile-step-1.el9 .
54+
55+
- name: Run picked TAP tests
56+
run: |
57+
TAP_CT_NAME="spock-tap-${{ matrix.pgver }}-${{ github.run_id }}-${{ github.run_attempt }}"
58+
echo "TAP_CT_NAME=$TAP_CT_NAME" >> "$GITHUB_ENV"
59+
docker run --name "$TAP_CT_NAME" -e PGVER=${{ matrix.pgver }} spock /home/pgedge/run-spock-tap.sh "t/011_zodan_sync_third.pl" 10
60+
timeout-minutes: 1440
61+
62+
- name: Collect TAP artifacts (from container)
63+
if: ${{ always() }}
64+
run: |
65+
docker cp "$TAP_CT_NAME":/home/pgedge/spock/ "$GITHUB_WORKSPACE/results" || true
66+
docker rm -f "$TAP_CT_NAME" || true
67+
68+
- name: Upload TAP artifacts
69+
if: ${{ always() }}
70+
uses: actions/upload-artifact@v4
71+
with:
72+
name: tap-${{ matrix.pgver }}
73+
path: |
74+
${{ github.workspace }}/results
75+
if-no-files-found: ignore
76+
retention-days: 7

tests/docker/Dockerfile-base.el9

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ RUN ssh-keygen -t ed25519 -N "" -f ~/.ssh/id_ed25519 && \
2828
cat ~/.ssh/*.pub >> ~/.ssh/authorized_keys
2929

3030

31-
COPY . /home/pgedge/spock
31+
RUN mkdir -p /home/pgedge/spock
3232
RUN chown -R pgedge:pgedge /home/pgedge/spock
3333
#-----------------------------------------
3434
USER pgedge

tests/docker/Dockerfile-step-1.el9

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

55
ENV PGVER=$PGVER
66

7+
COPY . /home/pgedge/spock
78
WORKDIR /home/pgedge
89

910
RUN echo "Determine PostgreSQL tag"
@@ -32,7 +33,7 @@ RUN for patchfile in /home/pgedge/spock/patches/${PGVER}/*; do \
3233
done
3334

3435
RUN echo "==========Compiling Modified PostgreSQL=========="
35-
RUN options="'--prefix=/home/pgedge/pgedge/pg$PGVER' '--disable-rpath' '--with-zstd' '--with-lz4' '--with-icu' '--with-libxslt' '--with-libxml' '--with-uuid=ossp' '--with-gssapi' '--with-ldap' '--with-pam' '--enable-debug' '--enable-dtrace' '--with-llvm' 'LLVM_CONFIG=/usr/bin/llvm-config-64' '--with-openssl' '--with-systemd' '--enable-tap-tests' '--with-python' '--enable-cassert' 'PYTHON=/usr/bin/python3.9' 'BITCODE_CFLAGS=-gdwarf-5 -O0 -fforce-dwarf-frame' 'CFLAGS=-g -O0'" && eval ./configure $options && make -j4 && make install
36+
RUN options="'--prefix=/home/pgedge/pgedge/pg$PGVER' '--disable-rpath' '--with-zstd' '--with-lz4' '--with-icu' '--with-libxslt' '--with-libxml' '--with-uuid=ossp' '--with-gssapi' '--with-ldap' '--with-pam' '--enable-debug' '--enable-dtrace' '--with-llvm' 'LLVM_CONFIG=/usr/bin/llvm-config-64' '--with-openssl' '--with-systemd' '--enable-tap-tests' '--with-python' '--enable-cassert' 'PYTHON=/usr/bin/python3.9' 'BITCODE_CFLAGS=-gdwarf-5 -O0 -fforce-dwarf-frame' 'CFLAGS=-g -O0'" && eval ./configure $options && make -j4 && make -C contrib -j4 && make install && make -C contrib install
3637

3738
WORKDIR /home/pgedge
3839

@@ -46,9 +47,18 @@ RUN . /home/pgedge/.bashrc && export PG_CONFIG=/home/pgedge/pgedge/pg$PGVER/bin/
4647
RUN echo "==========Built Spock=========="
4748

4849
#-----------------------------------------
49-
COPY tests/docker/entrypoint.sh tests/docker/run-tests.sh tests/docker/run-spock-regress.sh /home/pgedge
50-
51-
RUN sudo chmod +x /home/pgedge/entrypoint.sh /home/pgedge/run-tests.sh /home/pgedge/run-spock-regress.sh
50+
COPY \
51+
tests/docker/entrypoint.sh \
52+
tests/docker/run-tests.sh \
53+
tests/docker/run-spock-regress.sh \
54+
tests/docker/run-spock-tap.sh \
55+
/home/pgedge
56+
57+
RUN sudo chmod +x \
58+
/home/pgedge/entrypoint.sh \
59+
/home/pgedge/run-tests.sh \
60+
/home/pgedge/run-spock-regress.sh \
61+
/home/pgedge/run-spock-tap.sh
5262

5363
WORKDIR /home/pgedge/
5464
USER pgedge

tests/docker/run-spock-tap.sh

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#!/bin/bash
2+
###
3+
### Run selected TAP tests iteratively
4+
###
5+
6+
7+
export PG_CONFIG=/home/pgedge/pgedge/pg${PGVER}/bin/pg_config
8+
export PATH=/home/pgedge/pgedge/pg${PGVER}/bin:$PATH
9+
export LD_LIBRARY_PATH=/home/pgedge/pgedge/pg${PGVER}/lib/:$LD_LIBRARY_PATH
10+
export PROVE_TESTS=$proven_tests
11+
12+
# PGVER should be previously set in the environment
13+
if [ -z "${PGVER}" ]
14+
then
15+
echo "The PGVER environment variable must be set before running this command"
16+
exit 1
17+
fi
18+
19+
proven_tests="$1"
20+
iterations="$2"
21+
if [[ -z "$proven_tests" || -z "$iterations" ]]; then
22+
echo "Command-line parameters are set incorrectly"
23+
exit 1
24+
fi
25+
26+
cd /home/pgedge/spock/
27+
28+
status=0
29+
for i in $(seq 1 $iterations); do
30+
echo "Iteration $i: running make check..."
31+
env PROVE_TESTS="$proven_tests" make check_prove 1>out.txt 2>err.txt
32+
status=$?
33+
if [ $status -ne 0 ]; then
34+
echo "make check failed with status $status on iteration $i"
35+
break
36+
fi
37+
done
38+
39+
if [ $status -ne 0 ]
40+
then
41+
echo "Errors in regression checks"
42+
exit 1
43+
fi

tests/tap/schedule

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,18 @@ test: 004_non_default_repset
1515
test: 008_rmgr
1616
test: 009_zodan_add_remove_nodes
1717
test: 010_zodan_add_remove_python
18-
test: 011_zodan_sync_third
18+
19+
# Tests, consuming too much time to be launched on each check:
20+
#test: 011_zodan_sync_third
21+
#
22+
# Use GitHub Actions to launch them (see workflows/zodan_sync.yml for an example
23+
# Also, it may be run locally by a bash script like the following:
24+
#
25+
# for i in {1..1000}; do
26+
# env PROVE_TESTS="t/011_zodan_sync_third.pl" make check_prove 1>out.txt 2>err.txt
27+
# status=$?
28+
# if [ $status -ne 0 ]; then
29+
# echo "make check failed with status $status on iteration $i"
30+
# break
31+
# fi
32+
# done

0 commit comments

Comments
 (0)