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

Feat/chain simulator e2e #1402

Draft
wants to merge 59 commits into
base: development
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
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
dfc65cf
add EOL
cfaur09 Nov 20, 2024
540331f
add stop-chain-simulator script
cfaur09 Nov 20, 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
4b591c7
Merge pull request #1381 from multiversx/API-72-first-integration-of-…
bogdan-rosianu Dec 3, 2024
be170eb
Create stake.cs-e2e.ts (#1407)
cfaur09 Dec 3, 2024
1a73328
Create hello.cs-e2e.ts (#1405)
cfaur09 Dec 3, 2024
09c552e
Create delegation.cs-e2e.ts (#1403)
cfaur09 Dec 3, 2024
b729244
Create delegation-legacy.cs-e2e.ts (#1404)
cfaur09 Dec 3, 2024
428c2d6
Create accounts.cs-e2e.ts (#1409)
cfaur09 Dec 4, 2024
3660954
API-160: tx pool endpoint tests + new cs image (#1408)
bogdan-rosianu Dec 5, 2024
fc6a1f5
Create dapp.config.cs-e2e.ts (#1412)
cfaur09 Dec 5, 2024
5707d61
Create shards.cs-e2e.ts (#1406)
cfaur09 Dec 5, 2024
4a5e3dc
Update accounts.cs-e2e.ts (#1410)
cfaur09 Dec 10, 2024
b95b2e8
Create events.cs-e2e.ts (#1413)
cfaur09 Dec 10, 2024
1d99b54
Create identities.cs-e2e.ts (#1411)
cfaur09 Dec 12, 2024
3edb5bb
Create websocket-config.cs-e2e.ts (#1415)
cfaur09 Dec 12, 2024
adeeb5a
Merge branch 'refs/heads/development' into merge-development-feat-cs-…
bogdan-rosianu Dec 12, 2024
642aa7f
Merge pull request #1423 from multiversx/merge-development-feat-cs-e2…
bogdan-rosianu Dec 12, 2024
51c37da
added more cs tests (#1418)
cfaur09 Dec 16, 2024
6b722e3
Create nodes.cs-e2e.ts (#1416)
cfaur09 Dec 16, 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
62 changes: 62 additions & 0 deletions .github/workflows/chain-simulator-e2e-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Chain simulator e2e tests workflow

on:
pull_request:

jobs:
test-chainsimulator-e2e:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x]

steps:
- uses: actions/checkout@v3

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'

- name: Build and start chain simulator
run: npm run start-chain-simulator

- name: Wait for services to be ready
run: |
echo "Waiting for services to be healthy..."
docker ps
docker logs chainsimulator
sleep 20 # Wait for 20 seconds to ensure services are up

- name: Print docker containers
run: docker ps

- name: Start API Docker containers
run: |
cd .
docker compose up -d

- name: Wait for API docker containers to start
run: |
sleep 20
docker ps

- run: npm ci
- run: npm run init

- name: Start API
run: |
npm run start:mainnet:e2e &
sleep 10 # Wait a little more to ensure the API is fully up

- name: Prepare Test Data
run: npm run prepare:test-data

- name: Run e2e tests
run: npm run test:cs-e2e

- name: Stop API after tests
run: |
echo "Stopping the API..."
kill $(lsof -t -i:3001)
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,7 @@ lerna-debug.log*

/src/plugins

.env
.env

# CS Environment variables
src/test/chain-simulator/config/.env
145 changes: 119 additions & 26 deletions config/config.e2e.mainnet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,51 @@ network: 'mainnet'
metaChainShardId: 4294967295
api:
public: true
publicPort: 3001
private: true
graphql: true
privatePort: 4001
websocket: true
cron:
cacheWarmer: true
fastWarm: false
queueWorker: true
elasticUpdater: false
flags:
useRequestCaching: true
useKeepAliveAgent: true
useTracing: false
useRequestLogging: false
useVmQueryTracing: false
processNfts: true
collectionPropertiesFromGateway: false
features:
eventsNotifier:
enabled: false
port: 5674
url: 'amqp://guest:guest@127.0.0.1:5672'
exchange: 'all_events'
queue: 'api-process-logs-and-events'
guestCaching:
enabled: false
hitsThreshold: 100
ttl: 12
transactionPool:
enabled: true
transactionPoolWarmer:
enabled: true
cronExpression: '*/5 * * * * *'
ttlInSeconds: 60
updateCollectionExtraDetails:
enabled: false
updateAccountExtraDetails:
enabled: false
transfersLast24hUrl: 'https://tools.multiversx.com/growth-api/explorer/widgets/most-used/applications'
marketplace:
enabled: false
serviceUrl: 'https://nfts-graph.multiversx.com/graphql'
exchange:
enabled: false
serviceUrl: 'https://graph.xexchange.com/graphql'
dataApi:
enabled: false
serviceUrl: 'https://data-api.multiversx.com'
Expand All @@ -13,35 +55,93 @@ features:
maxExpirySeconds: 86400
acceptedOrigins:
- ''
admins:
- ''
jwtSecret: ''
stakingV4:
enabled: false
cronExpression: '*/5 * * * * *'
activationEpoch: 1391
nodeEpochsLeft:
enabled: false
transactionProcessor:
enabled: false
maxLookBehind: 1000
transactionCompleted:
enabled: false
maxLookBehind: 1000
logLevel: 'Error'
transactionBatch:
enabled: false
maxLookBehind: 1000
deepHistory:
enabled: false
url: ''
cron:
transactionProcessor: false
transactionProcessorMaxLookBehind: 1000
cacheWarmer: false
flags:
useRequestCaching: true
useKeepAliveAgent: true
useTracing: false
collectionPropertiesFromGateway: false
statusChecker:
enabled: false
thresholds:
tokens: 1000
nodes: 5000
providers: 150
tokenSupplyCount: 100
tokenAssets: 100
tokenAccounts: 1000
tokenTransactions: 1000
nodeValidators: 3260
nftScamInfo:
enabled: false
processNfts:
enabled: false
nftQueueName: 'api-process-nfts'
deadLetterQueueName: 'api-process-nfts-dlq'
tps:
enabled: false
maxLookBehindNonces: 100
nodesFetch:
enabled: false
serviceUrl: 'https://api.multiversx.com'
tokensFetch:
enabled: false
serviceUrl: 'https://api.multiversx.com'
providersFetch:
enabled: false
serviceUrl: 'https://api.multiversx.com'
assetsFetch:
enabled: false
assetesUrl: 'https://tools.multiversx.com/assets-cdn'
image:
width: 600
height: 600
type: 'png'
aws:
s3KeyId: ''
s3Secret: ''
s3Bucket: 'media.elrond.com'
s3Region: ''
urls:
self: 'https://api.multiversx.com'
self: 'http://localhost:3001'
elastic:
- 'https://index.multiversx.com'
- 'http://localhost:9200'
gateway:
- 'https://gateway.multiversx.com'
- 'http://localhost:8085'
verifier: 'https://play-api.multiversx.com'
redis: '127.0.0.1'
rabbitmq: 'amqp://127.0.0.1:5672'
providers: 'https://internal-delegation-api.multiversx.com/providers'
providers: 'https://delegation-api.multiversx.com/providers'
delegation: 'https://delegation-api.multiversx.com'
media: 'https://media.elrond.com'
nftThumbnails: 'https://media.elrond.com/nfts/thumbnail'
tmp: '/tmp'
ipfs: 'https://ipfs.io/ipfs'
socket: 'socket-api-fra.multiversx.com'
maiarId: 'https://id-api.multiversx.com'
indexer:
type: 'elastic'
maxPagination: 10000
database:
enabled: false
url: 'mongodb://127.0.0.1:27017/api?authSource=admin'
type: 'mysql'
host: 'localhost'
port: 3306
username: 'root'
Expand All @@ -50,7 +150,8 @@ database:
caching:
cacheTtl: 6
processTtl: 600
poolLimit: 10
poolLimit: 50
cacheDuration: 3
keepAliveTimeout:
downstream: 61000
upstream: 60000
Expand All @@ -69,14 +170,6 @@ inflation:
- 1130177
- 924690
- 719203
security:
admins:
jwtSecret:
test:
mockKeybases: false
mockNodes: false
mockTokens: false
mockPath: './src/test/mocks/'
transaction-action:
mex:
microServiceUrl: 'https://graph.xexchange.com/graphql'
nftProcess:
parallelism: 1
maxRetries: 3
5 changes: 3 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 11 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@
"start:mainnet": "npm run copy-mainnet-config & nest start",
"start:mainnet:watch": "npm run copy-mainnet-config & nest start --watch",
"start:mainnet:debug": "npm run copy-mainnet-config & nest start --watch --debug",
"start:mainnet:e2e": "npm run copy-e2e-mainnet-config & nest start",
"start:mainnet:e2e:watch": "npm run copy-e2e-mainnet-config & nest start --watch",
"start:mainnet:e2e:debug": "npm run copy-e2e-mainnet-config & nest start --watch --debug",
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\"",
"lint:fix": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
"test": "npm run copy-mainnet-config & nest build & jest",
Expand All @@ -41,6 +44,7 @@
"test:e2e:local": "npm run test:e2e:warm & npm run test:e2e",
"test:api": "jest --config ./src/test/jest-api.json --runInBand --detectOpenHandles --forceExit",
"test:graph": "jest --config ./src/test/jest-graph-spec.json --runInBand --detectOpenHandles --forceExit",
"test:cs-e2e": "jest --config ./src/test/jest-chain-simulator.json --runInBand --detectOpenHandles --forceExit",
"init": "run-script-os",
"copy-mainnet-config": "run-script-os",
"copy-testnet-config": "run-script-os",
Expand Down Expand Up @@ -73,7 +77,10 @@
"copy-e2e-mainnet-config:nix": "cp ./config/config.e2e.mainnet.yaml ./config/config.yaml",
"copy-e2e-mocked-mainnet-config:nix": "cp ./config/config.e2e-mocked.mainnet.yaml ./config/config.yaml",
"copy-e2e-mainnet-config:windows": "copy .\\config\\config.e2e.mainnet.yaml .\\config\\config.yaml",
"copy-e2e-mocked-mainnet-config:windows": "copy .\\config\\config.e2e-mocked.mainnet.yaml .\\config\\config.yaml"
"copy-e2e-mocked-mainnet-config:windows": "copy .\\config\\config.e2e-mocked.mainnet.yaml .\\config\\config.yaml",
"start-chain-simulator": "docker compose -f \"src/test/chain-simulator/docker/docker-compose.yml\" up -d --build",
"stop-chain-simulator": "docker compose -f \"src/test/chain-simulator/docker/docker-compose.yml\" down",
"prepare:test-data": "ts-node src/test/chain-simulator/utils/prepare-test-data.ts"
},
"dependencies": {
"@aws-sdk/client-s3": "^3.54.0",
Expand Down Expand Up @@ -149,6 +156,7 @@
"devDependencies": {
"@automock/adapters.nestjs": "^2.1.0",
"@automock/jest": "^2.1.0",
"@jest/test-sequencer": "^29.7.0",
"@nestjs/cli": "10.1.17",
"@nestjs/schematics": "10.0.2",
"@nestjs/testing": "10.2.4",
Expand All @@ -157,7 +165,7 @@
"@types/crypto-js": "^4.0.2",
"@types/express": "^4.17.13",
"@types/fluent-ffmpeg": "^2.1.20",
"@types/jest": "29.5.0",
"@types/jest": "^29.5.0",
"@types/js-yaml": "^4.0.5",
"@types/json-diff": "^0.7.0",
"@types/jsonwebtoken": "^8.5.8",
Expand All @@ -176,7 +184,7 @@
"prettier": "^2.5.1",
"run-script-os": "^1.1.6",
"supertest": "^6.2.2",
"ts-jest": "29.0.5",
"ts-jest": "^29.0.5",
"ts-loader": "9.4.2",
"ts-node": "10.7.0",
"tsconfig-paths": "^4.0.0",
Expand Down
Loading
Loading