Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 91
feat: run all test locally#1493
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
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
dd116d94d968872678c7a21be3688cdf03a0341babFile filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,16 +1,21 @@ | ||
| FROM node:16-alpine | ||
| FROM node:18-alpine | ||
| RUN apk add --no-cache git | ||
| RUN npm install -g solc | ||
| WORKDIR /app | ||
| ## Warning! This Docker config is meant to be used for development and debugging, not in prod. | ||
| RUN apk add --virtual .build-deps git python g++ bash make | ||
| WORKDIR /base | ||
| COPY package.json . | ||
| COPY yarn.lock . | ||
| RUN yarn | ||
| RUN yarn install && \ | ||
| yarn cache clean | ||
| COPY . . | ||
| RUN yarn | ||
| RUN yarn build | ||
| RUN yarn clean && \ | ||
| yarn build && \ | ||
| yarn cache clean | ||
| RUN apk del .build-deps | ||
| # Port configuration | ||
| ENV PORT 3000 | ||
| EXPOSE 3000 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| # Warning! This Docker config is meant to be used for development and debugging, specially for running tests, not in prod. | ||
| services: | ||
| graph-node: | ||
| image: graphprotocol/graph-node:v0.25.0 | ||
rodrigopavezi marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| ports: | ||
| - '8000:8000' | ||
| - '8001:8001' | ||
| - '8020:8020' | ||
| - '8030:8030' | ||
| - '8040:8040' | ||
| depends_on: | ||
| - ipfs | ||
| - postgres | ||
| - ganache | ||
| environment: | ||
| postgres_host: postgres | ||
| postgres_user: graph-node | ||
| postgres_pass: let-me-in | ||
| postgres_db: graph-node | ||
| ipfs: 'ipfs:5001' | ||
| ethereum: 'private:http://ganache:8545' | ||
| RUST_LOG: info | ||
| GRAPH_ALLOW_NON_DETERMINISTIC_IPFS: 1 | ||
| ipfs: | ||
| image: requestnetwork/request-ipfs:v0.13.0 | ||
| ports: | ||
| - '5001:5001' | ||
| restart: on-failure:20 | ||
| # volumes: | ||
| # - ./data/ipfs:/data/ipfs | ||
| ganache: | ||
| image: trufflesuite/ganache:v7.6.0 | ||
| ports: | ||
| - 8545:8545 | ||
| command: | ||
| - '-l' | ||
| - '90000000' | ||
| - '-m' | ||
| - 'candy maple cake sugar pudding cream honey rich smooth crumble sweet treat' | ||
rodrigopavezi marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| - '-k' | ||
| - 'london' | ||
| restart: on-failure:20 | ||
| postgres: | ||
| image: postgres | ||
| ports: | ||
| - '5432:5432' | ||
| command: ['postgres', '-cshared_preload_libraries=pg_stat_statements'] | ||
| environment: | ||
| POSTGRES_USER: graph-node | ||
| POSTGRES_PASSWORD: let-me-in | ||
| POSTGRES_DB: graph-node | ||
rodrigopavezi marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| restart: on-failure:20 | ||
| graph-deploy: | ||
| build: | ||
| context: https://github.com/RequestNetwork/docker-images.git#main | ||
| dockerfile: request-subgraph-storage/Dockerfile | ||
| depends_on: | ||
| - ipfs | ||
| - postgres | ||
| - graph-node | ||
| - ganache | ||
| environment: | ||
| GRAPH_NODE: 'http://graph-node:8020' | ||
| IPFS_HOST: 'ipfs:5001' | ||
| KEEP_ALIVE: 0 | ||
| SUBGRAPH_FILE: 'subgraph-private.yaml' | ||
| restart: on-failure:20 | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| { | ||
| "tasksRunnerOptions": { | ||
| "default": { | ||
| "runner": "nx/tasks-runners/default", | ||
| "options": { | ||
| "cacheableOperations": ["build", "test"] | ||
| } | ||
| } | ||
| }, | ||
| "targetDefaults": { | ||
| "build": { | ||
| "dependsOn": ["^build"] | ||
| }, | ||
| "test": { | ||
| "dependsOn": ["build"] | ||
| } | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| MNEMONIC="wave easy stick sentence horse spin join winner blade brand primary giggle" | ||
| WEB3_PROVIDER_URL="https://fluent-tame-borough.ethereum-sepolia.quiknode.pro/0d83fabcb680ecddfbe5a92352b7fa4c9ac20213/" | ||
| ETHEREUM_NETWORK_ID=11155111 | ||
| IPFS_URL="https://shared-ipfs.p8f0ey.easypanel.host" | ||
| GRAPH_NODE_URL="https://sepolia.graph-node.stage.request.network/subgraphs/name/RequestNetwork/request-storage/" | ||
| # WEB3_PROVIDER_URL="http://localhost:8545" | ||
| # ETHEREUM_NETWORK_ID=0 | ||
| # IPFS_URL="http://localhost:5001" | ||
| # GRAPH_NODE_URL="http://localhost:8000/subgraphs/name/RequestNetwork/request-storage" | ||
| LOG_LEVEL=DEBUG | ||
| GAS_PRICE_MAX=20000000000000 | ||
| GAS_PRICE_MULTIPLIER=300 | ||
| PORT=8080 | ||
| LIT_PROTOCOL_NETWORK="datil-test" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -5,9 +5,10 @@ import { getRequestNode } from '../src/server'; | ||
| import { RequestNode } from '../src/requestNode'; | ||
| import { providers } from 'ethers'; | ||
| const channelId = '010aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'; | ||
| const time = Date.now(); | ||
| const channelId = `01aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa${time}`; | ||
| const transactionData = { data: `this is sample data for a transaction ${Date.now()}` }; | ||
| const transactionData = { data: `this is sample data for a transaction ${time}` }; | ||
| const transactionHash = normalizeKeccak256Hash(transactionData).value; | ||
| const provider = new providers.JsonRpcProvider('http://localhost:8545'); | ||
| @@ -41,14 +42,13 @@ describe('getConfirmedTransaction', () => { | ||
| .set('Accept', 'application/json') | ||
| .expect(StatusCodes.NOT_FOUND); | ||
| // mining is required for TheGraph to index data | ||
| await provider.send('evm_mine', []); | ||
| let serverResponse: request.Response | undefined; | ||
| // retry mechanism to account for ganache delay | ||
| for (let i = 0; i < 10; i++) { | ||
| for (let i = 0; i < 20; i++) { | ||
| // wait a bit for the confirmation | ||
| await new Promise((resolve): any => setTimeout(resolve, 1000)); | ||
| // mining is required for TheGraph to index data | ||
| await provider.send('evm_mine', []); | ||
rodrigopavezi marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| serverResponse = await request(server) | ||
| .get('/getConfirmedTransaction') | ||
| @@ -64,7 +64,7 @@ describe('getConfirmedTransaction', () => { | ||
| expect(serverResponse!.body.result).toMatchObject({}); | ||
| // 'getConfirmedTransaction request meta' | ||
| expect(serverResponse!.body.meta.storageMeta.state).toBe('confirmed'); | ||
| }, 30000); | ||
| }, 40000); | ||
| it('responds with status 422 to requests with no value', async () => { | ||
| await request(server) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -3,14 +3,16 @@ import request from 'supertest'; | ||
| import { getRequestNode } from '../src/server'; | ||
| import { RequestNode } from '../src/requestNode'; | ||
| const channelId = '01aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab'; | ||
| const anotherChannelId = '01bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbc'; | ||
| const nonExistentChannelId = '01cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccd'; | ||
| jest.setTimeout(20000); | ||
| const time = Date.now(); | ||
| const channelId = `01aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa${time}`; | ||
| const anotherChannelId = `01bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb${time}`; | ||
| const nonExistentChannelId = `01ccccccccccccccccccccccccccccccccccccccccccccccccccc${time}`; | ||
| const transactionData = { | ||
| data: `this is sample data for a transaction to test getTransactionsByChannelId ${Date.now()}`, | ||
| data: `this is sample data for a transaction to test getTransactionsByChannelId ${time}`, | ||
| }; | ||
| const otherTransactionData = { | ||
| data: 'this is other sample data for a transaction to test getTransactionsByChannelId', | ||
| data: `this is other sample data for a transaction to test getTransactionsByChannelId ${time}`, | ||
rodrigopavezi marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| }; | ||
| let requestNodeInstance: RequestNode; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| describe('Empty Test FIXME', () => { | ||
| it('should pass', () => { | ||
| expect(true).toBe(true); | ||
| }); | ||
| }); |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.