Skip to content

Commit c4bb731

Browse files
committed
Merge branch 'main' into 3423-playwright-in-ci
2 parents ffe0a78 + 0a90ecc commit c4bb731

File tree

47 files changed

+910
-1097
lines changed

Some content is hidden

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

47 files changed

+910
-1097
lines changed

.config/dictionaries/project.dic

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,7 @@ vsync
409409
wallclock
410410
wasmtime
411411
Wconditional
412+
webfactory
412413
webos
413414
Werror
414415
Wireframes

.github/workflows/ci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,8 @@ jobs:
7878
needs: [ci, paths-filter]
7979
if: ${{ needs.paths-filter.outputs.catalyst-gateway == 'true' || github.base_ref == 'main'}}
8080
uses: ./.github/workflows/gateway-tests.yml
81+
secrets:
82+
QA_REPO_SSH_KEY: ${{ secrets.QA_REPO_SSH_KEY }}
8183

8284
voices-integration-tests:
8385
needs: [ci, paths-filter]

.github/workflows/gateway-tests.yml

Lines changed: 122 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ name: Catalyst Gateway integration tests
22

33
on:
44
workflow_call:
5+
secrets:
6+
QA_REPO_SSH_KEY:
7+
required: true
58

69
concurrency:
710
group: gateway-tests-${{ github.head_ref || github.ref }}
@@ -38,11 +41,12 @@ jobs:
3841
with:
3942
enable_caching: "true"
4043
version: 0.21.0
44+
4145
- name: Setup
4246
uses: input-output-hk/catalyst-forge/actions/setup@ci/v1.10.0
4347

4448
- name: Prepare artifacts
45-
id : images
49+
id: images
4650
uses: input-output-hk/catalyst-forge/actions/run@ci/v1.10.0
4751
with:
4852
command: run
@@ -84,12 +88,6 @@ jobs:
8488
exit 1
8589
fi
8690
87-
- name: Schemathesis tests
88-
if: ${{ steps.gateway-healthy.conclusion == 'success' }}
89-
run: |
90-
docker compose -f catalyst-gateway/tests/docker-compose.yml up schemathesis-runner --exit-code-from schemathesis-runner
91-
docker cp schemathesis-runner:/results/junit-report.xml ./schemathesis${{ env.REPORT_EXT }}
92-
9391
- name: Integration API tests
9492
if: ${{ steps.gateway-healthy.conclusion == 'success' }}
9593
env:
@@ -123,3 +121,120 @@ jobs:
123121
path: "**/*${{ env.COVERAGE_EXT }}"
124122
if-no-files-found: error
125123
retention-days: 1
124+
125+
devnet-tests:
126+
name: Cat-Gateway devnet integration tests
127+
runs-on: ubuntu-latest
128+
steps:
129+
- uses: actions/checkout@v4
130+
131+
- name: Install Forge
132+
uses: input-output-hk/catalyst-forge/actions/install@ci/v1.10.0
133+
with:
134+
enable_caching: "true"
135+
version: 0.21.0
136+
137+
- name: Setup
138+
uses: input-output-hk/catalyst-forge/actions/setup@ci/v1.10.0
139+
140+
- name: Prepare artifacts
141+
id: images
142+
uses: input-output-hk/catalyst-forge/actions/run@ci/v1.10.0
143+
with:
144+
command: run
145+
args: ./catalyst-gateway/tests/+all-images
146+
147+
- name: Setup SSH Agent
148+
uses: webfactory/[email protected]
149+
with:
150+
ssh-private-key: ${{ secrets.QA_REPO_SSH_KEY }}
151+
152+
- name: Prepare artifacts devnet
153+
id: images-devnet
154+
uses: input-output-hk/catalyst-forge/actions/run@ci/v1.10.0
155+
with:
156+
command: run
157+
args: ./catalyst-gateway/tests/+images-devnet
158+
159+
- name: Spin up devnet
160+
if: ${{ steps.images-devnet.conclusion == 'success' }}
161+
run: |
162+
docker compose -f catalyst-gateway/tests/docker-compose-devnet.yml up cat-devnet -d
163+
164+
- name: Wait for cat-devnet to become healthy
165+
id: devnet-check
166+
run: |
167+
DEVNET_HEALTHY="false"
168+
echo "Waiting for container to be healthy ..."
169+
for i in {1..500}; do
170+
STATUS=$(docker inspect --format='{{.State.Health.Status}}' cat-devnet)
171+
echo "Health status: $STATUS"
172+
if [ "$STATUS" == "healthy" ]; then
173+
echo "Container is healthy!"
174+
DEVNET_HEALTHY="true"
175+
echo "devnet_healthy=$DEVNET_HEALTHY" >> $GITHUB_OUTPUT
176+
exit 0
177+
fi
178+
if [ "$STATUS" == "unhealthy" ]; then
179+
echo "Container became unhealthy."
180+
docker compose -f catalyst-gateway/tests/docker-compose-devnet.yml logs cat-devnet
181+
docker compose -f catalyst-gateway/tests/docker-compose-devnet.yml stop cat-devnet
182+
echo "devnet_healthy=$DEVNET_HEALTHY" >> $GITHUB_OUTPUT
183+
break
184+
fi
185+
sleep 5
186+
done
187+
188+
- name: Spin up devnet ... retry
189+
if: steps.devnet-check.outputs.devnet_healthy == 'false'
190+
run: |
191+
docker compose -f catalyst-gateway/tests/docker-compose-devnet.yml up cat-devnet -d
192+
193+
- name: Wait for cat-devnet to become healthy ... retry
194+
if: steps.devnet-check.outputs.devnet_healthy == 'false'
195+
run: |
196+
echo "Waiting for container to be healthy ... retry"
197+
for i in {1..500}; do
198+
STATUS=$(docker inspect --format='{{.State.Health.Status}}' cat-devnet)
199+
echo "Health status: $STATUS"
200+
if [ "$STATUS" == "healthy" ]; then
201+
echo "Container is healthy!"
202+
exit 0
203+
fi
204+
if [ "$STATUS" == "unhealthy" ]; then
205+
echo "Container became unhealthy."
206+
docker compose -f catalyst-gateway/tests/docker-compose-devnet.yml logs cat-devnet
207+
exit 1
208+
fi
209+
sleep 5
210+
done
211+
212+
- name: Spin up catalyst-gateway
213+
id: gateway-started
214+
run: |
215+
docker compose -f catalyst-gateway/tests/docker-compose-devnet.yml up cat-gateway -d
216+
217+
- name: Wait for cat-gateway to become healthy
218+
id: gateway-healthy
219+
if: ${{ steps.gateway-started.conclusion == 'success' }}
220+
run: |
221+
echo "Waiting for container to be healthy..."
222+
for i in {1..500}; do
223+
STATUS=$(docker inspect --format='{{.State.Health.Status}}' cat-gateway)
224+
echo "Health status: $STATUS"
225+
if [ "$STATUS" == "healthy" ]; then
226+
echo "Container is healthy!"
227+
break
228+
fi
229+
if [ "$STATUS" == "unhealthy" ]; then
230+
echo "Container became unhealthy."
231+
docker compose -f catalyst-gateway/tests/docker-compose-devnet.yml logs cat-gateway
232+
exit 1
233+
fi
234+
sleep 5
235+
done
236+
237+
- name: Schemathesis tests
238+
if: ${{ steps.gateway-healthy.conclusion == 'success' }}
239+
run: |
240+
docker compose -f catalyst-gateway/tests/docker-compose-devnet.yml up schemathesis-runner --exit-code-from schemathesis-runner

catalyst-gateway/tests/Earthfile

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,22 @@
33
VERSION 0.8
44
IMPORT github.com/input-output-hk/catalyst-ci/earthly/spectral:v3.6.3 AS spectral-ci
55
IMPORT .. AS gateway
6+
IMPORT github.com/input-output-hk/catalyst-qa/catalyst-devnet:devnet/v0.0.3 AS devnet
67

78
# build all necessary docker images required to run `docker-compose.yml` services
89
all-images:
910
FROM scratch
1011
BUILD gateway+docker
1112
BUILD ../event-db+docker
12-
BUILD ./api_tests+package
13-
BUILD ./schemathesis_tests+package
14-
BUILD +package-rust-tests-runner
13+
BUILD ./api_tests+testing-package
14+
BUILD ./schemathesis_tests+testing-package
15+
BUILD +testing-package-rust-tests-runner
1516
BUILD +package-event-db-v1
16-
BUILD +package-haproxy
17+
BUILD +testing-package-haproxy
18+
19+
images-devnet:
20+
FROM scratch
21+
BUILD devnet+docker
1722

1823
# a special package for applying migrations only up to "V2_**" migrations
1924
package-event-db-v1:
@@ -26,7 +31,7 @@ package-event-db-v1:
2631

2732
SAVE IMAGE ${container}:${tag}
2833

29-
package-haproxy:
34+
testing-package-haproxy:
3035
FROM haproxy:alpine
3136

3237
USER root
@@ -56,7 +61,7 @@ rust-tests-builder:
5661
RUN cargo nextest archive --release --archive-file cat-gateway-tests.tar.zst
5762
SAVE ARTIFACT cat-gateway-tests.tar.zst cat-gateway-tests.tar.zst
5863

59-
package-rust-tests-runner:
64+
testing-package-rust-tests-runner:
6065
FROM debian:stable-slim
6166

6267
WORKDIR $HOME/build-tmp

catalyst-gateway/tests/api_tests/Earthfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@ builder:
2121
DO python-ci+BUILDER_WITH_POETRY
2222

2323
# Creates a package of the python integration test runner
24-
package:
24+
testing-package:
2525
FROM +builder
2626

2727
ENV ASSETS_DATA_PATH="./cardano-asset-preprod.json"
2828
ENV MK_SIGNED_DOC_PATH="./mk_signed_doc"
2929
ENV DEP_MK_SIGNED_DOC_PATH="./dep_mk_signed_doc"
3030

3131
# Install socat
32-
RUN apt-get update \
32+
RUN apt-get clean && apt-get autoremove && apt-get update \
3333
&& apt-get install -y --no-install-recommends socat \
3434
&& rm -rf /var/lib/apt/lists/*
3535

catalyst-gateway/tests/api_tests/api/v1/cardano.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,14 @@
44

55
# cardano assets GET
66
def assets(stake_address: str, slot_no: int, token: str | None = None):
7-
url = cat_gateway_endpoint_url(f"api/v1/cardano/assets/{stake_address}?asat=SLOT:{slot_no}")
7+
url = cat_gateway_endpoint_url(
8+
f"api/v1/cardano/assets/{stake_address}?asat=SLOT:{slot_no}"
9+
)
810
headers = {
911
"Content-Type": "application/json",
1012
}
1113

1214
if token is not None:
1315
headers["Authorization"] = f"Bearer {token}"
14-
16+
1517
return requests.get(url, headers=headers)
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
from api import cat_gateway_endpoint_url
2+
23
LIVE_URL = "api/v1/health/live"
34
READY_URL = "api/v1/health/ready"
45

6+
57
def live():
68
return cat_gateway_endpoint_url(LIVE_URL)
79

10+
811
def ready():
912
return cat_gateway_endpoint_url(READY_URL)

catalyst-gateway/tests/api_tests/api/v1/rbac.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
URL = cat_gateway_endpoint_url("api/v1/rbac/registration")
55

6+
67
def get(lookup: str | None, token: str, extra_headers: dict | None = None):
78
headers = {
89
"Authorization": f"Bearer {token}",

0 commit comments

Comments
 (0)