Skip to content

Commit 35a6b4c

Browse files
committed
Draft
1 parent 57566f6 commit 35a6b4c

File tree

5 files changed

+151
-6
lines changed

5 files changed

+151
-6
lines changed

.github/workflows/zodan_sync.yml

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