Skip to content

Commit

Permalink
fix: tests reporting properly
Browse files Browse the repository at this point in the history
  • Loading branch information
Vovke committed Nov 19, 2024
1 parent 45dad7a commit a8b92e4
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 34 deletions.
15 changes: 8 additions & 7 deletions .github/workflows/kalatori-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,18 @@ jobs:
sudo chmod +x /usr/local/bin/docker-compose
docker-compose --version
- name: Build and Start Containers
- name: Build Containers
working-directory: ./tests
run: |
docker-compose up -d --build chopsticks-polkadot chopsticks-statemint kalatori-rust-app
docker-compose build
- name: Wait for Dependencies to Initialize
run: sleep 60
- name: Run Tests
working-directory: ./tests
run: |
docker-compose up --exit-code-from tests --abort-on-container-exit tests
- name: Run Tests and Capture Exit Code
- name: Tear Down Containers
working-directory: ./tests
if: always()
run: |
docker-compose run tests || exit_code=$?
docker-compose down
exit ${exit_code:-0}
2 changes: 1 addition & 1 deletion tests/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,4 @@ services:
- kalatori-rust-app
environment:
- DAEMON_HOST=http://kalatori-daemon:16726
command: /bin/sh -c "sleep 50 && yarn install && yarn test"
command: /bin/sh -c "sleep 180 && yarn install && yarn test"
2 changes: 1 addition & 1 deletion tests/kalatori-api-test-suite/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "1.0.0",
"main": "index.js",
"scripts": {
"test": "jest"
"test": "jest --silent"
},
"keywords": [],
"author": "",
Expand Down
2 changes: 1 addition & 1 deletion tests/kalatori-api-test-suite/src/polkadot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,5 @@ export async function transferFunds(rpcUrl: string, paymentAccount: string, amou
});

// Wait for transaction to be included in block
await new Promise(resolve => setTimeout(resolve, 10000));
await new Promise(resolve => setTimeout(resolve, 15000));
}
25 changes: 1 addition & 24 deletions tests/kalatori-api-test-suite/tests/order.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,7 @@ describe('Order Endpoint Blackbox Tests', () => {

await transferFunds(orderDetails.currency.rpc_url, paymentAccount, dotOrderData.amount);

// lets wait for the changes to get propagated on chain and app to catch them
await new Promise(resolve => setTimeout(resolve, 35000));
await new Promise(resolve => setTimeout(resolve, 20000));

const repaidOrderDetails = await getOrderDetails(orderId);
expect(repaidOrderDetails.payment_status).toBe('paid');
Expand All @@ -247,9 +246,6 @@ describe('Order Endpoint Blackbox Tests', () => {
orderDetails.currency.asset_id
);

// lets wait for the changes to get propagated on chain and app to catch them
await new Promise(resolve => setTimeout(resolve, 15000));

const repaidOrderDetails = await getOrderDetails(orderId);
expect(repaidOrderDetails.payment_status).toBe('paid');
expect(repaidOrderDetails.withdrawal_status).toBe('completed');
Expand All @@ -271,8 +267,6 @@ describe('Order Endpoint Blackbox Tests', () => {
halfAmount,
orderDetails.currency.asset_id
);
// lets wait for the changes to get propagated on chain and app to catch them
await new Promise(resolve => setTimeout(resolve, 15000));

let repaidOrderDetails = await getOrderDetails(orderId);
expect(repaidOrderDetails.payment_status).toBe('pending');
Expand All @@ -286,9 +280,6 @@ describe('Order Endpoint Blackbox Tests', () => {
orderDetails.currency.asset_id
);

// lets wait for the changes to get propagated on chain and app to catch them
await new Promise(resolve => setTimeout(resolve, 15000));

repaidOrderDetails = await getOrderDetails(orderId);
expect(repaidOrderDetails.payment_status).toBe('paid');
expect(repaidOrderDetails.withdrawal_status).toBe('completed');
Expand All @@ -310,8 +301,6 @@ describe('Order Endpoint Blackbox Tests', () => {
halfAmount,
orderDetails.currency.asset_id
);
// lets wait for the changes to get propagated on chain and app to catch them
await new Promise(resolve => setTimeout(resolve, 15000));

let repaidOrderDetails = await getOrderDetails(orderId);
expect(repaidOrderDetails.payment_status).toBe('pending');
Expand All @@ -325,9 +314,6 @@ describe('Order Endpoint Blackbox Tests', () => {
orderDetails.currency.asset_id
);

// lets wait for the changes to get propagated on chain and app to catch them
await new Promise(resolve => setTimeout(resolve, 15000));

repaidOrderDetails = await getOrderDetails(orderId);
expect(repaidOrderDetails.payment_status).toBe('paid');
expect(repaidOrderDetails.withdrawal_status).toBe('completed');
Expand All @@ -348,9 +334,6 @@ describe('Order Endpoint Blackbox Tests', () => {
assetId
);

// lets wait for the changes to get propagated on chain and app to catch them
await new Promise(resolve => setTimeout(resolve, 15000));

const repaidOrderDetails = await getOrderDetails(orderId);
expect(repaidOrderDetails.payment_status).toBe('pending');
expect(repaidOrderDetails.withdrawal_status).toBe('waiting');
Expand All @@ -365,9 +348,6 @@ describe('Order Endpoint Blackbox Tests', () => {

await transferFunds(orderDetails.currency.rpc_url, paymentAccount, dotOrderData.amount/2);

// lets wait for the changes to get propagated on chain and app to catch them
await new Promise(resolve => setTimeout(resolve, 15000));

const partiallyRepaidOrderDetails = await getOrderDetails(orderId);
expect(partiallyRepaidOrderDetails.payment_status).toBe('pending');
expect(partiallyRepaidOrderDetails.withdrawal_status).toBe('waiting');
Expand All @@ -390,9 +370,6 @@ describe('Order Endpoint Blackbox Tests', () => {

await transferFunds(orderDetails.currency.rpc_url, paymentAccount, usdcOrderData.amount/2);

// lets wait for the changes to get propagated on chain and app to catch them
await new Promise(resolve => setTimeout(resolve, 15000));

const partiallyRepaidOrderDetails = await getOrderDetails(orderId);
expect(partiallyRepaidOrderDetails.payment_status).toBe('pending');
expect(partiallyRepaidOrderDetails.withdrawal_status).toBe('waiting');
Expand Down

0 comments on commit a8b92e4

Please sign in to comment.