Skip to content

Commit 0972b2b

Browse files
authored
Merge branch 'main' into feat/rev-reg-granular-events
2 parents 9f7d841 + 11f27ec commit 0972b2b

File tree

96 files changed

+3460
-787
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

96 files changed

+3460
-787
lines changed

.github/actions/run-integration-tests/action.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ inputs:
99
IN_LEDGER_URL:
1010
description: "URL to the von network ledger browser"
1111
required: false
12-
default: "http://test.bcovrin.vonx.io"
12+
default: "https://test.bcovrin.vonx.io"
1313
IN_PUBLIC_TAILS_URL:
1414
description: "URL to the tails server"
1515
required: false
@@ -19,7 +19,7 @@ runs:
1919
steps:
2020
- name: run-integration-tests-acapy
2121
# to run with external ledger and tails server run as follows (and remove the ledger and tails actions from the workflow):
22-
# run: LEDGER_URL=http://test.bcovrin.vonx.io PUBLIC_TAILS_URL=https://tails.vonx.io ./run_bdd ${{ inputs.TEST_SCOPE }}
22+
# run: LEDGER_URL=https://test.bcovrin.vonx.io PUBLIC_TAILS_URL=https://tails.vonx.io ./run_bdd ${{ inputs.TEST_SCOPE }}
2323
run: ./run_bdd ${{ inputs.TEST_SCOPE }}
2424
shell: bash
2525
env:
Lines changed: 237 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,237 @@
1+
name: Run PostgreSQL Integration Tests
2+
description: "Run integration tests against PostgreSQL database"
3+
4+
inputs:
5+
python-version:
6+
description: "Python version"
7+
required: true
8+
os:
9+
description: "Operating system"
10+
required: true
11+
12+
runs:
13+
using: "composite"
14+
steps:
15+
- name: Set up Python ${{ inputs.python-version }}
16+
uses: actions/setup-python@v5
17+
with:
18+
python-version: ${{ inputs.python-version }}
19+
cache: 'pip'
20+
cache-dependency-path: 'requirements*.txt'
21+
22+
- name: Install PostgreSQL client tools
23+
shell: bash
24+
run: |
25+
sudo apt-get update
26+
sudo apt-get install -y postgresql-client
27+
28+
- name: Wait for PostgreSQL to be ready
29+
shell: bash
30+
run: |
31+
echo "Waiting for PostgreSQL to be ready..."
32+
for i in {1..30}; do
33+
if pg_isready -h localhost -p 5432 -U acapy_test; then
34+
echo "PostgreSQL is ready!"
35+
break
36+
fi
37+
echo "Attempt $i: PostgreSQL not ready yet, waiting..."
38+
sleep 2
39+
done
40+
41+
# Final check
42+
if ! pg_isready -h localhost -p 5432 -U acapy_test; then
43+
echo "ERROR: PostgreSQL failed to become ready"
44+
exit 1
45+
fi
46+
47+
- name: Verify PostgreSQL connection
48+
shell: bash
49+
env:
50+
PGPASSWORD: acapy_test_pass
51+
run: |
52+
echo "Testing PostgreSQL connection..."
53+
psql -h localhost -U acapy_test -d acapy_test_db -c "SELECT version();"
54+
echo "PostgreSQL connection verified!"
55+
56+
- name: Create additional test databases
57+
shell: bash
58+
env:
59+
PGPASSWORD: acapy_test_pass
60+
run: |
61+
echo "Creating additional test databases..."
62+
createdb -h localhost -U acapy_test test_kanon_db || true
63+
createdb -h localhost -U acapy_test test_dbstore_db || true
64+
createdb -h localhost -U acapy_test test_normalize || true
65+
createdb -h localhost -U acapy_test test_generic || true
66+
echo "Additional databases created"
67+
68+
- name: Grant database privileges
69+
shell: bash
70+
env:
71+
PGPASSWORD: acapy_test_pass
72+
run: |
73+
echo "Granting database privileges..."
74+
psql -h localhost -U acapy_test -d acapy_test_db -c "ALTER USER acapy_test WITH CREATEDB CREATEROLE;"
75+
echo "Privileges granted"
76+
77+
- name: Install project dependencies
78+
shell: bash
79+
run: |
80+
pip install poetry
81+
poetry install --all-extras
82+
83+
- name: Run Kanon PostgreSQL Tests
84+
shell: bash
85+
env:
86+
POSTGRES_HOST: localhost
87+
POSTGRES_PORT: 5432
88+
POSTGRES_USER: acapy_test
89+
POSTGRES_PASSWORD: acapy_test_pass
90+
POSTGRES_DB: acapy_test_db
91+
ENABLE_DBSTORE_TESTS: "1"
92+
LOG_LEVEL: WARNING
93+
run: |
94+
export POSTGRES_URL="postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DB}"
95+
96+
echo "========================================="
97+
echo "Running Kanon Integration Tests"
98+
echo "Database: ${POSTGRES_DB} on ${POSTGRES_HOST}:${POSTGRES_PORT}"
99+
echo "========================================="
100+
101+
poetry run pytest \
102+
acapy_agent/kanon/tests/ \
103+
-v \
104+
--cov=acapy_agent.kanon \
105+
--cov-report term-missing \
106+
--cov-report xml:./test-reports/kanon-postgres-coverage.xml \
107+
--junitxml=./test-reports/kanon-postgres-junit.xml \
108+
2>&1 | tee kanon-postgres-tests.log
109+
110+
KANON_EXIT_CODE=${PIPESTATUS[0]}
111+
112+
echo ""
113+
echo "========================================="
114+
echo "Kanon tests completed with exit code: $KANON_EXIT_CODE"
115+
echo "========================================="
116+
117+
# Check for unawaited coroutines
118+
if grep -Eq "RuntimeWarning: coroutine .* was never awaited" kanon-postgres-tests.log; then
119+
echo "ERROR: Detected unawaited coroutine warning in Kanon tests"
120+
exit 1
121+
fi
122+
123+
if [ $KANON_EXIT_CODE -ne 0 ]; then
124+
echo "ERROR: Kanon PostgreSQL tests failed"
125+
exit $KANON_EXIT_CODE
126+
fi
127+
128+
- name: Run DBStore PostgreSQL Integration Tests
129+
shell: bash
130+
env:
131+
POSTGRES_HOST: localhost
132+
POSTGRES_PORT: 5432
133+
POSTGRES_USER: acapy_test
134+
POSTGRES_PASSWORD: acapy_test_pass
135+
POSTGRES_DB: acapy_test_db
136+
ENABLE_DBSTORE_TESTS: "1"
137+
LOG_LEVEL: WARNING
138+
run: |
139+
export POSTGRES_URL="postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DB}"
140+
141+
echo "========================================="
142+
echo "Running DBStore PostgreSQL Integration Tests"
143+
echo "Database: ${POSTGRES_DB} on ${POSTGRES_HOST}:${POSTGRES_PORT}"
144+
echo "========================================="
145+
146+
echo "Running core DBStore provisioning tests..."
147+
148+
# Test 1: PostgreSQL Normalized Provisioning (validates our provisioning bug fix)
149+
poetry run pytest \
150+
-v \
151+
--tb=short \
152+
acapy_agent/database_manager/tests/dbstore/test_db_store_postgresql_normalized_provision.py::test_provision \
153+
2>&1 | tee -a dbstore-postgres-tests.log
154+
155+
PROVISION_TEST_1=$?
156+
157+
# Test 2: PostgreSQL Normalized Schema
158+
poetry run pytest \
159+
-v \
160+
--tb=short \
161+
acapy_agent/database_manager/tests/dbstore/test_db_store_postgresql_normalized.py::test_provision \
162+
2>&1 | tee -a dbstore-postgres-tests.log
163+
164+
PROVISION_TEST_2=$?
165+
166+
# Test 3: PostgreSQL Generic Schema
167+
poetry run pytest \
168+
-v \
169+
--tb=short \
170+
acapy_agent/database_manager/tests/dbstore/test_db_store_postgresql_generic.py::test_provision \
171+
2>&1 | tee -a dbstore-postgres-tests.log
172+
173+
PROVISION_TEST_3=$?
174+
175+
# Calculate overall exit code
176+
DBSTORE_EXIT_CODE=0
177+
if [ $PROVISION_TEST_1 -ne 0 ] || [ $PROVISION_TEST_2 -ne 0 ] || [ $PROVISION_TEST_3 -ne 0 ]; then
178+
DBSTORE_EXIT_CODE=1
179+
fi
180+
181+
# Generate coverage report for all tests
182+
poetry run pytest \
183+
--cov=acapy_agent.database_manager \
184+
--cov-report term-missing \
185+
--cov-report xml:./test-reports/dbstore-postgres-coverage.xml \
186+
--junitxml=./test-reports/dbstore-postgres-junit.xml \
187+
--co \
188+
acapy_agent/database_manager/tests/dbstore/test_db_store_postgresql*.py 2>/dev/null || true
189+
190+
echo ""
191+
echo "========================================="
192+
echo "DBStore tests completed with exit code: $DBSTORE_EXIT_CODE"
193+
echo "========================================="
194+
195+
# Check for unawaited coroutines
196+
if grep -Eq "RuntimeWarning: coroutine .* was never awaited" dbstore-postgres-tests.log; then
197+
echo "ERROR: Detected unawaited coroutine warning in DBStore tests"
198+
exit 1
199+
fi
200+
201+
if [ $DBSTORE_EXIT_CODE -ne 0 ]; then
202+
echo "ERROR: DBStore PostgreSQL tests failed"
203+
exit $DBSTORE_EXIT_CODE
204+
fi
205+
206+
- name: Upload Kanon PostgreSQL Test Reports
207+
if: always()
208+
uses: actions/upload-artifact@v4
209+
with:
210+
name: kanon-postgres-test-reports-${{ inputs.python-version }}-${{ inputs.os }}
211+
path: |
212+
test-reports/kanon-postgres-coverage.xml
213+
test-reports/kanon-postgres-junit.xml
214+
kanon-postgres-tests.log
215+
216+
- name: Upload DBStore PostgreSQL Test Reports
217+
if: always()
218+
uses: actions/upload-artifact@v4
219+
with:
220+
name: dbstore-postgres-test-reports-${{ inputs.python-version }}-${{ inputs.os }}
221+
path: |
222+
test-reports/dbstore-postgres-coverage.xml
223+
test-reports/dbstore-postgres-junit.xml
224+
dbstore-postgres-tests.log
225+
226+
- name: Test Summary
227+
if: always()
228+
shell: bash
229+
run: |
230+
echo "========================================="
231+
echo "PostgreSQL Integration Tests Summary"
232+
echo "========================================="
233+
echo "✅ PostgreSQL service: Ready"
234+
echo "✅ Database connection: Verified"
235+
echo "✅ Kanon tests: Check artifacts"
236+
echo "✅ DBStore tests: Check artifacts"
237+
echo "========================================="

.github/workflows/codeql.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ jobs:
2424

2525
# Initializes the CodeQL tools for scanning.
2626
- name: Initialize CodeQL
27-
uses: github/codeql-action/init@16140ae1a102900babc80a33c44059580f687047 # v3.29.5
27+
uses: github/codeql-action/init@0499de31b99561a6d14a36a5f662c2a54f91beee # v3.29.5
2828
with:
2929
languages: python
3030

3131
- name: Perform CodeQL Analysis
32-
uses: github/codeql-action/analyze@16140ae1a102900babc80a33c44059580f687047 # v3.29.5
32+
uses: github/codeql-action/analyze@0499de31b99561a6d14a36a5f662c2a54f91beee # v3.29.5

.github/workflows/pr-tests.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,29 @@ jobs:
2424
python-version: "3.12"
2525
os: "ubuntu-latest"
2626
is_pr: "true"
27+
28+
postgres-tests:
29+
name: PostgreSQL Integration Tests
30+
runs-on: ubuntu-latest
31+
services:
32+
postgres:
33+
image: postgres:15-alpine
34+
env:
35+
POSTGRES_USER: acapy_test
36+
POSTGRES_PASSWORD: acapy_test_pass
37+
POSTGRES_DB: acapy_test_db
38+
options: >-
39+
--health-cmd pg_isready
40+
--health-interval 10s
41+
--health-timeout 5s
42+
--health-retries 5
43+
ports:
44+
- 5432:5432
45+
steps:
46+
- name: checkout
47+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
48+
- name: PostgreSQL Integration Tests
49+
uses: ./.github/actions/run-postgres-tests
50+
with:
51+
python-version: "3.12"
52+
os: "ubuntu-latest"

.github/workflows/publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ jobs:
127127

128128
- name: Setup Image Metadata
129129
id: meta
130-
uses: docker/metadata-action@c1e51972afc2121e065aed6d45c65596fe445f3f # v5.8.0
130+
uses: docker/metadata-action@318604b99e75e41977312d83839a89be02ca4893 # v5.9.0
131131
with:
132132
images: |
133133
ghcr.io/${{ steps.lower.outputs.owner }}/${{ matrix.image-name }}

.github/workflows/scorecard.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ jobs:
6262
# Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF
6363
# format to the repository Actions tab.
6464
- name: "Upload artifact"
65-
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
65+
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
6666
with:
6767
name: SARIF file
6868
path: results.sarif
@@ -71,6 +71,6 @@ jobs:
7171
# Upload the results to GitHub's code scanning dashboard (optional).
7272
# Commenting out will disable upload of results to your repo's Code Scanning dashboard
7373
- name: "Upload to code-scanning"
74-
uses: github/codeql-action/upload-sarif@16140ae1a102900babc80a33c44059580f687047 # v3.29.5
74+
uses: github/codeql-action/upload-sarif@0499de31b99561a6d14a36a5f662c2a54f91beee # v3.29.5
7575
with:
7676
sarif_file: results.sarif

.github/workflows/snyk-lts.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,6 @@ jobs:
5252
sed -i 's/"security-severity": "null"/"security-severity": "0"/g' snyk.sarif
5353
5454
- name: Upload result to GitHub Code Scanning
55-
uses: github/codeql-action/upload-sarif@16140ae1a102900babc80a33c44059580f687047 # v3.29.5
55+
uses: github/codeql-action/upload-sarif@0499de31b99561a6d14a36a5f662c2a54f91beee # v3.29.5
5656
with:
5757
sarif_file: snyk.sarif

.github/workflows/snyk.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,6 @@ jobs:
4545
sed -i 's/"security-severity": "null"/"security-severity": "0"/g' snyk.sarif
4646
4747
- name: Upload result to GitHub Code Scanning
48-
uses: github/codeql-action/upload-sarif@16140ae1a102900babc80a33c44059580f687047 # v3.29.5
48+
uses: github/codeql-action/upload-sarif@0499de31b99561a6d14a36a5f662c2a54f91beee # v3.29.5
4949
with:
5050
sarif_file: snyk.sarif

0 commit comments

Comments
 (0)