Skip to content

Commit

Permalink
feat:RA-45: java based rosetta testing (#132)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlksndrSlgb committed May 6, 2024
2 parents 0b6d0e1 + d20ebc7 commit 237c273
Show file tree
Hide file tree
Showing 8 changed files with 84 additions and 0 deletions.
1 change: 1 addition & 0 deletions .env.IntegrationTest
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ DB_HOST="db" # Service name in docker-compose or local db
DB_PORT="5432"
DB_SCHEMA=${NETWORK}
DB_PATH="data"
UPDATE_GENESIS_BLOCK_QUERY="UPDATE preprod.block SET number = 0 WHERE number = -1; UPDATE preprod.block SET prev_hash = 'Genesis' WHERE number = 1"

# Cardano Node variables
CARDANO_NODE_HOST="yaci-cli" # Service name in docker-compose or local cardano node
Expand Down
9 changes: 9 additions & 0 deletions .github/workflows/integration-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,18 @@ jobs:
uses: actions/setup-node@v1
with:
node-version: '21.x'
- name: "Update Genesis block number"
run: |
source ./.env.IntegrationTest
echo "$UPDATE_GENESIS_BLOCK_QUERY" > temp.sql
PGPASSWORD=$DB_ADMIN_USER_SECRET psql -h localhost -p 5432 -d $DB_NAME -U $DB_ADMIN_USER_NAME -f temp.sql
- name: "Install newman"
run: npm install -g newman
- name: "Install rosetta-cli"
run: curl -sSfL https://raw.githubusercontent.com/coinbase/rosetta-cli/master/scripts/install.sh | sh -s
- name: "Run tests"
run: newman run ./postmanTests/rosetta-java.postman_collection.json -e postmanTests/Rosetta-java-env.postman_environment.json -r cli
- name: "Run rosetta check:data tests"
run: ./bin/rosetta-cli check:data --configuration-file ./rosetta-cli-tests/data/byron_sample.json
- name: "Tear down environment"
run: docker compose --env-file .env.IntegrationTest -f docker-integration-test-environment.yaml down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ So the Node itself needs extra configuration to be able to query mempool transac
- [Cardano specific API Additions](./docs/cardano-specific-api-additions.md)
- [Dev H2 Quickstart Guide](./docs/dev-h2-quick-start-guide.md)
- [Environment Variables](./docs/environment-variables.md)
- [Rosetta-cli tests](./docs/rosetta-cli-tests.md)

## Contributing

Expand Down
8 changes: 8 additions & 0 deletions docs/rosetta-cli-tests.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# `rosetta-cli` checks

## `data`
The verification
``` console
./rosetta-cli check:data --configuration-file ./configuration/data/byron_sample.json
```
occurs at the stage of [integration tests](/.github/workflows/integration-test.yaml) only against the first 200 blocks within the devkit.
16 changes: 16 additions & 0 deletions rosetta-cli-tests/data/byron_sample.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"online_url": "http://localhost:8081",
"data": {
"start_index": 0,
"end_conditions": {
"index": 200
}
},
"network": {
"blockchain": "cardano",
"network": "devkit"
},
"http_timeout": 100000,
"tip_delay": 10000,
"max_sync_concurrency": 32
}
17 changes: 17 additions & 0 deletions rosetta-cli-tests/data/preview_sample.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"online_url": "http://localhost:8081",
"data": {
"start_index": 1,
"end_conditions": {
"index": 10000
}
},
"network": {
"blockchain": "cardano",
"network": "preview"
},
"http_timeout": 100000,
"tip_delay": 10000,
"max_sync_concurrency": 32
}

16 changes: 16 additions & 0 deletions rosetta-cli-tests/data/shelley_sample.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"online_url": "http://localhost:8081",
"data": {
"start_index": 4603000,
"end_conditions": {
"index": 4608000
}
},
"network": {
"blockchain": "cardano",
"network": "mainnet"
},
"http_timeout": 100000,
"tip_delay": 10000,
"max_sync_concurrency": 32
}
16 changes: 16 additions & 0 deletions rosetta-cli-tests/data/shelley_transition.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"online_url": "http://localhost:8081",
"data": {
"start_index": 4490000,
"end_conditions": {
"index": 4495000
}
},
"network": {
"blockchain": "cardano",
"network": "mainnet"
},
"http_timeout": 100000,
"tip_delay": 10000,
"max_sync_concurrency": 32
}

0 comments on commit 237c273

Please sign in to comment.