Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API-72: first integration of chain simulator #1381

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
96d3a1c
added dockerfile, workflow and entrypoint (#1364)
dragos-rebegea Oct 29, 2024
a815b28
Add guardianData to GatewayComponentRequest in GatewayService (#1377)
cfaur09 Nov 12, 2024
74c71ea
API-72: first integration of chain simulator
bogdan-rosianu Nov 14, 2024
f6638e9
API-72: npm init
bogdan-rosianu Nov 14, 2024
1aaeeac
API-72: refactoring
bogdan-rosianu Nov 14, 2024
7bd5b43
API-72: fix workflow file + cs start script
bogdan-rosianu Nov 14, 2024
7e105f4
API-72: fix workflow file
bogdan-rosianu Nov 14, 2024
ccc4712
API-72: update chain simulator tests and configuration
cfaur09 Nov 14, 2024
2cc680f
Enhance e2e test workflow: add API startup delay and shutdown step; i…
cfaur09 Nov 14, 2024
ed50e0f
Replace accounts e2e tests with new blocks e2e tests for improved cov…
cfaur09 Nov 15, 2024
4672d97
Update blocks e2e test to filter by nonce 0 for accurate count valida…
cfaur09 Nov 15, 2024
b6ad48a
Update blocks e2e test to adjust epoch filter and add validation for …
cfaur09 Nov 15, 2024
2dee24d
Add e2e test for GET /blocks/latest endpoint with property and type v…
cfaur09 Nov 15, 2024
58b9539
Add e2e test for blocks count with high epoch and nonce values
cfaur09 Nov 15, 2024
b211e0b
Remove scheduledRootHash from expected properties and type validation…
cfaur09 Nov 15, 2024
38083fb
Add e2e tests for GET /blocks and GET /miniblocks endpoints with stat…
cfaur09 Nov 15, 2024
e5258e4
Add e2e tests for GET /miniblocks endpoint with pagination and type f…
cfaur09 Nov 15, 2024
9554a75
Add e2e tests for GET /rounds
cfaur09 Nov 15, 2024
7672364
small refactoring
cfaur09 Nov 15, 2024
1d0494d
small refactoring
cfaur09 Nov 15, 2024
09362f1
small refactoring_2
cfaur09 Nov 15, 2024
d511195
small refactoring_2
cfaur09 Nov 15, 2024
44d34c0
update file formatting
cfaur09 Nov 15, 2024
b8bf473
Create results.cs-e2e.ts
cfaur09 Nov 15, 2024
fa18b04
Update results.cs-e2e.ts
cfaur09 Nov 16, 2024
6b64688
Update results.cs-e2e.ts
cfaur09 Nov 16, 2024
874aa18
Add issueMultipleESDT + tokens.cs-e2e.ts
cfaur09 Nov 16, 2024
fce09a0
Update tokens.cs-e2e.ts
cfaur09 Nov 16, 2024
db89051
Update tokens.cs-e2e.ts
cfaur09 Nov 16, 2024
cd618d2
Update tokens.cs-e2e.ts
cfaur09 Nov 17, 2024
f7b19d8
Update tokens.cs-e2e.ts
cfaur09 Nov 17, 2024
92ce317
API-72: fix workflow file (#1385)
dragos-rebegea Nov 18, 2024
470a829
Merge main development (#1386)
dragos-rebegea Nov 18, 2024
820bbf2
Merge branch 'main' into development
dragos-rebegea Nov 18, 2024
9037a37
Development (#1387)
dragos-rebegea Nov 18, 2024
dfc65cf
add EOL
cfaur09 Nov 20, 2024
540331f
add stop-chain-simulator script
cfaur09 Nov 20, 2024
a4cbeb0
API-91: type + subType fixes (#1390)
bogdan-rosianu Nov 21, 2024
3733c7d
fix get profile (#1391)
dragos-rebegea Nov 22, 2024
9638379
Merge branch 'main' into development
dragos-rebegea Nov 22, 2024
83876fb
Merge pull request #1392 from multiversx/development
dragos-rebegea Nov 22, 2024
5cf7be0
fix fields query in transactions (#1397)
cfaur09 Nov 27, 2024
429c410
hotfix
bogdan-rosianu Nov 27, 2024
f8ec9c1
Merge pull request #1398 from multiversx/hotfix-empty-token-type-from…
bogdan-rosianu Nov 28, 2024
36dd6bc
Update load-tests.yml
bogdan-rosianu Nov 28, 2024
b7ee557
Merge pull request #1400 from multiversx/update-load-test-workflow-tr…
bogdan-rosianu Nov 28, 2024
3f1bb7f
Multi transfer EGLD-000000 support (#1401)
dragos-rebegea Dec 2, 2024
bf46995
Merge branch 'development' into API-72-first-integration-of-cs-in-api…
cfaur09 Dec 2, 2024
768cb95
refactorin + adding utils checks
cfaur09 Dec 2, 2024
d185d50
move chain simulator operations into utils
cfaur09 Dec 2, 2024
a29e5f2
add issueMultipleNftsCollections + env Alice Address
cfaur09 Dec 2, 2024
8b3384b
update tokens and collections tests + added bob address in config
cfaur09 Dec 2, 2024
cd3eddb
Update collections.cs-e2e.ts
cfaur09 Dec 2, 2024
41e7039
update docker file + overridable-config
cfaur09 Dec 3, 2024
41c5aa5
revert chainsimulator image
cfaur09 Dec 3, 2024
f604ab9
update chainsimulator image
cfaur09 Dec 3, 2024
de7a2ca
fixes after review
cfaur09 Dec 3, 2024
91290e3
Update .gitignore
cfaur09 Dec 3, 2024
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
51 changes: 0 additions & 51 deletions src/test/chain-simulator/accounts.cs-e2e.ts

This file was deleted.

97 changes: 97 additions & 0 deletions src/test/chain-simulator/blocks.cs-e2e.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
import axios from "axios";
const CHAIN_SIMULATOR_URL = 'http://localhost:8085';
const API_SERVICE_URL = 'http://localhost:3001';

describe('Blocks e2e tests with chain simulator', () => {
beforeAll(async () => {
try {
const response = await axios.get(`${CHAIN_SIMULATOR_URL}/simulator/observers`);
let numRetries = 0;
while (true) {
if (response.status === 200) {
await axios.post(`${CHAIN_SIMULATOR_URL}/simulator/generate-blocks-until-epoch-reached/2`, {});
break;
}

numRetries += 1;
if (numRetries > 50) {
fail("Chain simulator not started!");
}
}
} catch (e) {
console.error(e);
}
});

beforeEach(() => {
jest.clearAllMocks();
});

describe('GET /blocks', () => {
it('should handle invalid block requests gracefully', async () => {
try {
await axios.get(`${API_SERVICE_URL}/blocks/invalid`);
} catch (error: any) {
expect(error.response.status).toBe(400);
}
});
});

describe('GET /blocks/count', () => {
it('should return blocks count', async () => {
const response = await axios.get(`${API_SERVICE_URL}/blocks/count`);
const count = response.data;

expect(count).toBeGreaterThan(0);
});

it('should return blocks count filter by shard', async () => {
const response = await axios.get(`${API_SERVICE_URL}/blocks/count?shard=1`);
const count = response.data;

expect(count).toBeGreaterThan(0);
});

it('should return blocks count filter by epoch', async () => {
const response = await axios.get(`${API_SERVICE_URL}/blocks/count?epoch=2`);
const count = response.data;

expect(count).toBeGreaterThan(2);
});

it('should return blocks count filter by nonce', async () => {
const response = await axios.get(`${API_SERVICE_URL}/blocks/count?nonce=2`);
const count = response.data;

expect(count).toBeGreaterThan(2);
});
});

describe('GET /blocks filter tests', () => {
it('should support pagination', async () => {
const response = await axios.get(`${API_SERVICE_URL}/blocks?size=10`);
const blocks = response.data;

expect(blocks).toBeInstanceOf(Array);
expect(blocks.length).toBeLessThanOrEqual(10);
});

it('should filter blocks by shard', async () => {
const response = await axios.get(`${API_SERVICE_URL}/blocks?shard=1`);
const blocks = response.data;

for (const block of blocks) {
expect(block.shard).toBe(1);
}
});

it('should filter blocks by epoch', async () => {
const response = await axios.get(`${API_SERVICE_URL}/blocks?epoch=2`);
const blocks = response.data;

for (const block of blocks) {
expect(block.epoch).toBe(2);
}
});
});
});
Loading