Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion catalyst-gateway/tests/api_tests/Earthfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
COPY --dir ./utils .
COPY --dir ./test_data .
COPY cat-libs-rust+build/mk_signed_doc .
COPY ./snapshot_tool-56364174.json .
DO python-ci+BUILDER

test:
Expand All @@ -28,7 +27,7 @@
--load cat-gateway-with-scylla:latest=(./../+package-cat-gateway-with-scylla) \
--service cat-gateway-with-scylla \
--allow-privileged
RUN poetry run pytest -s --junitxml=junit-report.xml --cov=integration --cov-report lcov

Check failure on line 30 in catalyst-gateway/tests/api_tests/Earthfile

View workflow job for this annotation

GitHub Actions / ci / test / ./catalyst-gateway/tests/api_tests+test

Error

The command WITH DOCKER RUN --privileged poetry run pytest -s --junitxml=junit-report.xml --cov=integration --cov-report lcov did not complete successfully. Exit code 1

Check failure on line 30 in catalyst-gateway/tests/api_tests/Earthfile

View workflow job for this annotation

GitHub Actions / test_reporting / Generate test reports

Error

The command WITH DOCKER RUN --privileged poetry run pytest -s --junitxml=junit-report.xml --cov=integration --cov-report lcov did not complete successfully. Exit code 1
END
WAIT
SAVE ARTIFACT junit-report.xml AS LOCAL api-tests.junit-report.xml
Expand Down
14 changes: 14 additions & 0 deletions catalyst-gateway/tests/api_tests/api/v1/cardano.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import requests
from api import cat_gateway_endpoint_url

URL = cat_gateway_endpoint_url("api/v1/cardano")


# cardano assets GET
def assets(stake_address: str, slot_no: int, token: str):
url = f"{URL}/assets/{stake_address}?asat=SLOT:{slot_no}"
headers = {
"Authorization": f"Bearer {token}",
"Content-Type": "application/json",
}
return requests.get(url, headers=headers)
41 changes: 41 additions & 0 deletions catalyst-gateway/tests/api_tests/integration/test_assets.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import pytest
from loguru import logger
from utils.address import stake_public_key_to_address
from utils.snapshot import snapshot
from utils.auth_token import rbac_auth_token_factory
from api.v1 import cardano


@pytest.mark.skip("To be refactored when the api is ready")
def test_persistent_ada_amount_endpoint(snapshot, rbac_auth_token_factory):
# health.is_live()
# health.is_ready()
logger.info(f"{snapshot.network}, {snapshot.slot_no}")
token = rbac_auth_token_factory()

total_len = len(snapshot.data)
for i, entry in enumerate(snapshot.data):
logger.info(f"Checking .... {round(i / total_len * 100, 1)}%")
expected_amount = entry["voting_power"]
stake_address = stake_public_key_to_address(
key=entry["stake_public_key"][2:],
is_stake=True,
network_type=snapshot.network,
)
resp = cardano.assets(stake_address, snapshot.slot_no, token)
if expected_amount == 0 and resp.status_code == 404:
# it is possible that snapshot tool collected data for the stake key which does not have any unspent utxo
# at this case cat-gateway return 404, that is why we are checking this case additionally
continue

assert (
resp.status_code == 200
), f"Cannot find assets for stake_address: {stake_address}"
assets = resp.json()
if assets["persistent"]["ada_amount"] != expected_amount:
logger.error(
f"Not expected ada amount for stake_address: {stake_address}, {entry["stake_public_key"]}"
)
# assert (
# assets["persistent"]["ada_amount"] == expected_amount
# ), f"Not expected ada amount for stake_address: {stake_address}, {entry["stake_public_key"]}"
42 changes: 0 additions & 42 deletions catalyst-gateway/tests/api_tests/integration/test_utxo.py

This file was deleted.

Loading
Loading