Skip to content

Commit 215b323

Browse files
authored
Merge branch 'main' into feature/new-rbac
2 parents 3e72aee + e4e1b13 commit 215b323

File tree

13 files changed

+231
-142
lines changed

13 files changed

+231
-142
lines changed

.github/workflows/gateway-tests.yml

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -106,18 +106,6 @@ jobs:
106106
run: |
107107
docker compose -f catalyst-gateway/tests/docker-compose.yml up api-tests-runner --exit-code-from api-tests-runner
108108
109-
# Skip for now as it adds ~10mins to CI execution time, will try to incorporate this in nightly instead
110-
- name: Integration health thru proxy tests
111-
if: false
112-
env:
113-
API_TEST_MARKS: "health_with_proxy_endpoint"
114-
EVENT_DB_URL: "haproxy:18080"
115-
INDEX_DB_URL: "haproxy:18090"
116-
run: |
117-
docker stop cat-gateway || true
118-
docker compose -f catalyst-gateway/tests/docker-compose.yml up haproxy --detach
119-
docker compose -f catalyst-gateway/tests/docker-compose.yml up api-tests-runner --exit-code-from api-tests-runner
120-
121109
- name: Collect and upload test reports
122110
uses: actions/upload-artifact@v4
123111
if: success() || failure()

.github/workflows/nightly-ci.yml

Lines changed: 51 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -69,28 +69,65 @@ jobs:
6969
id: gateway-healthy
7070
if: ${{ steps.gateway-started.conclusion == 'success' }}
7171
run: |
72-
echo "Waiting for container to be healthy..."
73-
for i in {1..500}; do
74-
STATUS=$(docker inspect --format='{{.State.Health.Status}}' cat-gateway)
75-
echo "Health status: $STATUS"
76-
if [ "$STATUS" == "healthy" ]; then
77-
echo "Container is healthy!"
78-
break
79-
fi
80-
if [ "$STATUS" == "unhealthy" ]; then
81-
echo "Container became unhealthy."
82-
exit 1
83-
fi
84-
sleep 5
85-
done
72+
echo "Waiting for container to be healthy..."
73+
for i in {1..500}; do
74+
STATUS=$(docker inspect --format='{{.State.Health.Status}}' cat-gateway)
75+
echo "Health status: $STATUS"
76+
if [ "$STATUS" == "healthy" ]; then
77+
echo "Container is healthy!"
78+
break
79+
fi
80+
if [ "$STATUS" == "unhealthy" ]; then
81+
echo "Container became unhealthy."
82+
exit 1
83+
fi
84+
sleep 5
85+
done
8686
8787
- name: Schemathesis tests
88+
id: schemathesis-tests
8889
if: ${{ steps.gateway-healthy.conclusion == 'success' }}
8990
run: |
9091
export HYPOTHESIS_MAX_EXAMPLES=5000
9192
export MAX_RESPONSE_TIME=25000
9293
docker compose -f catalyst-gateway/tests/docker-compose.yml up schemathesis-runner --exit-code-from schemathesis-runner
9394
95+
- name: Spin up catalyst-gateway with haproxy
96+
id: gateway-with-proxy-started
97+
env:
98+
EVENT_DB_URL: "haproxy:18080"
99+
INDEX_DB_URL: "haproxy:18090"
100+
run: |
101+
docker stop cat-gateway || true
102+
docker compose -f catalyst-gateway/tests/docker-compose.yml up haproxy --detach
103+
docker compose -f catalyst-gateway/tests/docker-compose.yml up cat-gateway --detach
104+
105+
- name: Wait for cat-gateway to become healthy
106+
id: gateway-with-proxy-healthy
107+
if: ${{ steps.gateway-with-proxy-started.conclusion == 'success' }}
108+
run: |
109+
echo "Waiting for container to be healthy..."
110+
for i in {1..500}; do
111+
STATUS=$(docker inspect --format='{{.State.Health.Status}}' cat-gateway)
112+
echo "Health status: $STATUS"
113+
if [ "$STATUS" == "healthy" ]; then
114+
echo "Container is healthy!"
115+
break
116+
fi
117+
if [ "$STATUS" == "unhealthy" ]; then
118+
echo "Container became unhealthy."
119+
exit 1
120+
fi
121+
sleep 5
122+
done
123+
124+
- name: Integration health thru proxy tests
125+
if: ${{ steps.gateway-with-proxy-healthy.conclusion == 'success' }}
126+
env:
127+
API_TEST_MARKS: "health_with_proxy_endpoint"
128+
run: |
129+
docker compose -f catalyst-gateway/tests/docker-compose.yml up api-tests-runner --exit-code-from api-tests-runner
130+
94131
slack:
95132
name: slack notification
96133
needs: tests

catalyst-gateway/tests/api_tests/integration/test_health_thru_proxy.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import pytest
44

55
from api.v1 import rbac
6-
from api.v1 import document
6+
from api.v2 import document
77
from utils import health
88
from utils.rbac_chain import rbac_chain_factory, Chain
99
from utils import ProxyHelper
@@ -39,7 +39,7 @@ def test_ready_endpoint_with_event_db_outage(event_db_proxy, rbac_chain_factory)
3939
event_db_proxy.disable()
4040
health.is_ready() #assertion
4141
# event-db threshold to start returning 503
42-
sleep(35)
42+
sleep(120)
4343
resp = document.post(filter={},limit=10,page=0)
4444
assert(resp.status_code == 503), f"Expected document index to fail: {resp.status_code} - {resp.text}"
4545
health.is_not_ready(5) #assertion
@@ -84,19 +84,20 @@ def test_ready_endpoint_with_index_db_outage(index_db_proxy, rbac_chain_factory)
8484
index_db_proxy.disable()
8585
health.is_ready() #assertion
8686
# index-db threshold to start returning 503
87-
sleep(180)
88-
# Index DB testing
89-
resp = rbac.get(lookup=stake_address_not_registered, token=auth_token)
90-
assert(resp.status_code == 503), f"Expected RBAC lookup to fail: {resp.status_code} - {resp.text}"
87+
health.is_not_ready(380) #assertion
9188
# Event DB testing
9289
resp = document.post(filter={},limit=10,page=0)
9390
assert(resp.status_code == 503), f"Expected document index to fail: {resp.status_code} - {resp.text}"
91+
# Index DB testing
92+
resp = rbac.get(lookup=stake_address_not_registered, token=auth_token)
93+
assert(resp.status_code == 503), f"Expected RBAC lookup to fail: {resp.status_code} - {resp.text}"
9494

9595
# resume index db comms
9696
index_db_proxy.enable()
9797
# wait for cat-gateway API to recover
9898
health.is_ready() #assertion
99-
99+
# sleep needs to stay until bug is fixed https://github.com/input-output-hk/catalyst-voices/issues/3705
100+
sleep(20)
100101
# Index DB testing
101102
resp = rbac.get(lookup=stake_address_not_registered, token=auth_token)
102103
assert(resp.status_code == 404), f"Expected not registered stake address: {resp.status_code} - {resp.text}"

catalyst-gateway/tests/docker-compose.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,9 +159,6 @@ services:
159159
- SERVICE_LIVE_TIMEOUT_INTERVAL=30
160160
command: >
161161
poetry run pytest -m "${API_TEST_MARKS}" -s --junitxml junit-report.xml --cov integration --cov-report lcov
162-
depends_on:
163-
cat-gateway:
164-
condition: service_healthy
165162
166163
schemathesis-runner:
167164
image: schemathesis-runner:latest

catalyst_voices/apps/voices/e2e_tests/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ These tests cover browser-based end-to-end workflows for the Catalyst Voices app
3434

3535
```bash
3636
cd catalyst_voices/apps/voices &&
37-
flutter run --dart-define=ENV_NAME=preprod --web-port 5555 \
37+
flutter run --dart-define=ENV_NAME=dev --web-port 5555 \
3838
--web-header "Cross-Origin-Opener-Policy=same-origin" \
3939
--web-header "Cross-Origin-Embedder-Policy=require-corp" \
4040
-d web-server --target lib/configs/main.dart

catalyst_voices/apps/voices/e2e_tests/data/browserExtensionConfigs.ts

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
import {
2-
BrowserExtensionModel,
3-
BrowserExtensionName,
4-
} from "../models/browserExtensionModel";
1+
import { BrowserExtensionModel, BrowserExtensionName } from "../models/browserExtensionModel";
52

63
/* cspell: disable */
74
export const browserExtensions: BrowserExtensionModel[] = [
@@ -17,23 +14,24 @@ export const browserExtensions: BrowserExtensionModel[] = [
1714
},
1815
{
1916
Name: BrowserExtensionName.Yoroi,
20-
Id: "poonlenmfdfbjfeeballhiibknlknepo",
17+
Id: "ffnbelfdoeiohenkjibnmadjiehjhajb",
2118
HomeUrl: "/main_window.html#",
2219
},
2320
{
2421
Name: BrowserExtensionName.Nufi,
2522
Id: "hbklpdnlgiadjhdadfnfmemmklbopbcm",
2623
HomeUrl: "/index.html#",
2724
},
25+
{
26+
Name: BrowserExtensionName.Vespr,
27+
Id: "bedogdpgdnifilpgeianmmdabklhfkcn",
28+
HomeUrl: "/index.html#",
29+
},
2830
];
2931
/* cspell: enable */
3032

31-
export const getBrowserExtension = (
32-
name: BrowserExtensionName
33-
): BrowserExtensionModel => {
34-
const extension = browserExtensions.find(
35-
(extension) => extension.Name === name
36-
);
33+
export const getBrowserExtension = (name: BrowserExtensionName): BrowserExtensionModel => {
34+
const extension = browserExtensions.find((extension) => extension.Name === name);
3735
if (!extension) {
3836
throw new Error(`Browser extension with name ${name} not found`);
3937
}

catalyst_voices/apps/voices/e2e_tests/data/walletConfigs.ts

Lines changed: 39 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,11 @@ export const walletConfigs: WalletConfigModel[] = [
2525
],
2626
network: "preprod",
2727
username: "test123",
28-
password: "test12345678@",
28+
password: "Test12345678@!!",
2929
cipBridge: ["cip-95"],
3030
mainAddress:
3131
"addr_test1qq2fckuzdvxu074ngumdkwn68tuuse67yg55r8exmkwdnn2lc30fwlx8jy6e54em6dcql0ma3gz75rc4ywuzuny7p7csr9kx9g",
32-
stakeAddress:
33-
"stake_test1up0ugh5h0nrezdv62uaaxuq0ha7c5p02pu2j8wpwfj0qlvg2det9t",
32+
stakeAddress: "stake_test1up0ugh5h0nrezdv62uaaxuq0ha7c5p02pu2j8wpwfj0qlvg2det9t",
3433
},
3534
{
3635
name: "Eternl",
@@ -54,12 +53,11 @@ export const walletConfigs: WalletConfigModel[] = [
5453
],
5554
network: "preprod",
5655
username: "test123",
57-
password: "test12345678@!!",
56+
password: "Test12345678@!!",
5857
cipBridge: ["cip-30", "cip-95"],
5958
mainAddress:
6059
"addr_test1qq2fckuzdvxu074ngumdkwn68tuuse67yg55r8exmkwdnn2lc30fwlx8jy6e54em6dcql0ma3gz75rc4ywuzuny7p7csr9kx9g",
61-
stakeAddress:
62-
"stake_test1up0ugh5h0nrezdv62uaaxuq0ha7c5p02pu2j8wpwfj0qlvg2det9t",
60+
stakeAddress: "stake_test1up0ugh5h0nrezdv62uaaxuq0ha7c5p02pu2j8wpwfj0qlvg2det9t",
6361
},
6462
{
6563
name: "Yoroi",
@@ -83,12 +81,11 @@ export const walletConfigs: WalletConfigModel[] = [
8381
],
8482
network: "preprod",
8583
username: "test123",
86-
password: "test12345678@!!",
84+
password: "Test12345678@!!",
8785
cipBridge: ["cip-95"],
8886
mainAddress:
8987
"addr_test1qq2fckuzdvxu074ngumdkwn68tuuse67yg55r8exmkwdnn2lc30fwlx8jy6e54em6dcql0ma3gz75rc4ywuzuny7p7csr9kx9g",
90-
stakeAddress:
91-
"stake_test1up0ugh5h0nrezdv62uaaxuq0ha7c5p02pu2j8wpwfj0qlvg2det9t",
88+
stakeAddress: "stake_test1up0ugh5h0nrezdv62uaaxuq0ha7c5p02pu2j8wpwfj0qlvg2det9t",
9289
},
9390
{
9491
name: "Nufi",
@@ -112,12 +109,39 @@ export const walletConfigs: WalletConfigModel[] = [
112109
],
113110
network: "preprod",
114111
username: "test123",
115-
password: "test12345678@!!",
112+
password: "Test12345678@!!",
116113
cipBridge: ["cip-95"],
117114
mainAddress:
118115
"addr_test1qq2fckuzdvxu074ngumdkwn68tuuse67yg55r8exmkwdnn2lc30fwlx8jy6e54em6dcql0ma3gz75rc4ywuzuny7p7csr9kx9g",
119-
stakeAddress:
120-
"stake_test1up0ugh5h0nrezdv62uaaxuq0ha7c5p02pu2j8wpwfj0qlvg2det9t",
116+
stakeAddress: "stake_test1up0ugh5h0nrezdv62uaaxuq0ha7c5p02pu2j8wpwfj0qlvg2det9t",
117+
},
118+
{
119+
name: "Vespr",
120+
extension: getBrowserExtension(BrowserExtensionName.Vespr),
121+
seed: [
122+
"stomach",
123+
"horn",
124+
"rail",
125+
"afraid",
126+
"flip",
127+
"also",
128+
"abandon",
129+
"speed",
130+
"chaos",
131+
"daring",
132+
"soon",
133+
"soft",
134+
"okay",
135+
"online",
136+
"benefit",
137+
],
138+
network: "preprod",
139+
username: "test123",
140+
password: "Test12345678@!!",
141+
cipBridge: ["cip-95"],
142+
mainAddress:
143+
"addr_test1qq2fckuzdvxu074ngumdkwn68tuuse67yg55r8exmkwdnn2lc30fwlx8jy6e54em6dcql0ma3gz75rc4ywuzuny7p7csr9kx9g",
144+
stakeAddress: "stake_test1up0ugh5h0nrezdv62uaaxuq0ha7c5p02pu2j8wpwfj0qlvg2det9t",
121145
},
122146
];
123147
// cspell: enable
@@ -128,9 +152,7 @@ export const walletConfigs: WalletConfigModel[] = [
128152
* @returns The wallet config
129153
*/
130154
export const getWalletConfigByName = (name: string): WalletConfigModel => {
131-
const walletConfig = walletConfigs.find(
132-
(walletConfig) => walletConfig.name === name
133-
);
155+
const walletConfig = walletConfigs.find((walletConfig) => walletConfig.name === name);
134156
if (!walletConfig) {
135157
throw new Error(`Wallet config with name ${name} not found`);
136158
}
@@ -142,12 +164,8 @@ export const getWalletConfigByName = (name: string): WalletConfigModel => {
142164
* @param name - The name of the extension
143165
* @returns The wallet config
144166
*/
145-
export const getWalletConfigByExtensionName = (
146-
name: BrowserExtensionName
147-
): WalletConfigModel => {
148-
const walletConfig = walletConfigs.find(
149-
(walletConfig) => walletConfig.extension.Name === name
150-
);
167+
export const getWalletConfigByExtensionName = (name: BrowserExtensionName): WalletConfigModel => {
168+
const walletConfig = walletConfigs.find((walletConfig) => walletConfig.extension.Name === name);
151169
if (!walletConfig) {
152170
throw new Error(`Wallet config with extension name ${name} not found`);
153171
}

catalyst_voices/apps/voices/e2e_tests/page-objects/onboarding/create-flow/step-9-input-seedphrase.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export class InputSeedPhrasePanel extends OnboardingBasePage {
2727

2828
async inputSeedPhraseWords() {
2929
for (const word of this.testModel.accountModel.seedPhrase) {
30-
await this.page.getByRole("button", { name: word, exact: true }).click();
30+
await this.page.getByRole("button", { name: word, exact: true }).first().click();
3131
await this.page.waitForTimeout(100);
3232
}
3333
}

catalyst_voices/apps/voices/e2e_tests/tests/onboarding.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import { test } from "../fixtures";
22
import { expect } from "@playwright/test";
3-
import { getOneOfEachExtensions, getWalletConfigByExtensionName } from "../data/walletConfigs";
3+
import { getOneOfEachExtensions, getWalletConfigByExtensionName, walletConfigs } from "../data/walletConfigs";
44
import { WalletListPanel } from "../page-objects/onboarding/create-flow/step-15-wallet-list";
55
import { createWalletActions } from "../utils/wallets/wallet-actions-factory";
66
import { WalletConnectedPanel } from "../page-objects/onboarding/create-flow/step-16-wallet-connected";
77
import { TestModel } from "../models/testModel";
88
import { getAccountModel } from "../data/accountConfigs";
99
import { BrowserExtensionName } from "../models/browserExtensionModel";
1010

11-
for (const walletConfig of [getWalletConfigByExtensionName(BrowserExtensionName.Lace)]) {
11+
for (const walletConfig of walletConfigs) {
1212
test.describe(`Onboarding ${walletConfig.extension.Name}`, () => {
1313
test.use({
1414
testModel: new TestModel(getAccountModel("DummyForTesting"), walletConfig),

0 commit comments

Comments
 (0)