Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
159 commits
Select commit Hold shift + click to select a range
dc707e8
Add category unit tests
james-toussaint Oct 15, 2024
a5ff3d1
Codegen before test
james-toussaint Oct 15, 2024
38b8b1f
Test bellecour build
james-toussaint Oct 15, 2024
eae18b0
Rename job
james-toussaint Oct 15, 2024
9d68dd1
Add prettier for staged files
james-toussaint Oct 16, 2024
8a4f6a2
Format category unit tests
james-toussaint Oct 16, 2024
1614600
Update package-lock.json
james-toussaint Oct 16, 2024
ee9ec3b
Merge pull request #20 from iExecBlockchainComputing/feature/add-cate…
james-toussaint Oct 16, 2024
3672b1b
Add protocol integration test
james-toussaint Oct 17, 2024
a096630
Add jenkinsfile for itest
james-toussaint Oct 17, 2024
bf6b8a2
Up stack before itest
james-toussaint Oct 18, 2024
f130385
Login to registry
james-toussaint Oct 18, 2024
8e8c25c
Increase graphnode healthcheck retries
james-toussaint Oct 18, 2024
147f3bf
Build graphclient in itest
james-toussaint Oct 18, 2024
c28d57d
Use apollo client in itest
james-toussaint Oct 18, 2024
253e965
Use testcontainers for itest
james-toussaint Oct 21, 2024
67ece5f
Close chain port 8546 which is not bound after 60s
james-toussaint Oct 25, 2024
d862eb8
Wait for graphnode to ingest a few blocks before querying it
james-toussaint Oct 25, 2024
ea137fe
Set compose startup time to 2min
james-toussaint Oct 28, 2024
9ce4aa9
Pull chain before itest
james-toussaint Oct 28, 2024
e290803
Set compose startup time to 3min
james-toussaint Oct 28, 2024
852f818
Run itest with mocha
james-toussaint Oct 29, 2024
86d9cd9
Increase mocha timeout
james-toussaint Oct 29, 2024
b2d1e8f
Remove react dependency
james-toussaint Oct 29, 2024
55e7101
Always docker logout
james-toussaint Oct 29, 2024
be41ef5
Update changelog
james-toussaint Oct 29, 2024
47f83b6
Removed exposed ports which already mapped externally
james-toussaint Oct 30, 2024
d8ef02f
Move npm install to lower layer
james-toussaint Oct 30, 2024
60f469d
Merge pull request #21 from iExecBlockchainComputing/feature/add-prot…
james-toussaint Oct 30, 2024
a8ef9ad
udpate poco subgraph to deal with sponsored MO
gfournieriExec Nov 20, 2024
3066697
deploy local graphnode with setting a particular starting block
gfournieriExec Nov 26, 2024
779569a
update timeout
gfournieriExec Nov 27, 2024
86f747d
test its
gfournieriExec Nov 27, 2024
e4a0c39
separate docker local test and it test
gfournieriExec Nov 27, 2024
e83569a
get back all vesion
gfournieriExec Nov 27, 2024
bf31ccc
add end of file line
gfournieriExec Nov 27, 2024
909e869
update timeout
gfournieriExec Nov 27, 2024
f38a77b
update waiting seconds
gfournieriExec Nov 27, 2024
ff7c1a7
remve console log
gfournieriExec Nov 27, 2024
b4582d4
re-add seconds
gfournieriExec Nov 27, 2024
7cf21ad
remove console log
gfournieriExec Nov 27, 2024
ab8d12b
Merge branch 'feature/local-test' into feature/poco-sponsoring
gfournieriExec Nov 28, 2024
8221169
update packages
gfournieriExec Nov 28, 2024
732876f
remove un necessary file
gfournieriExec Nov 28, 2024
4adf814
rest old files and update poco package
gfournieriExec Nov 28, 2024
9ae5fcb
update iexec solidity package version
gfournieriExec Nov 28, 2024
282fee6
update schema
gfournieriExec Nov 28, 2024
1fe6d7e
change dealId to deal
gfournieriExec Nov 28, 2024
09714cf
expose handleDealSponsored
gfournieriExec Nov 28, 2024
e5e2153
remove formating
gfournieriExec Nov 28, 2024
f1338ba
update header
gfournieriExec Nov 28, 2024
6d21031
update header
gfournieriExec Nov 28, 2024
c5dc4c3
Create UT for DealSponsored
gfournieriExec Nov 28, 2024
95caf7f
test set timout and wait seconds back
gfournieriExec Nov 28, 2024
6cde1a8
set back 10 seconds
gfournieriExec Nov 28, 2024
7fab256
update header and formating
gfournieriExec Dec 3, 2024
6df6834
update waiting time
gfournieriExec Dec 3, 2024
28dbf09
change timeout
gfournieriExec Dec 3, 2024
405d861
remove timeout
gfournieriExec Dec 3, 2024
e667a57
debug
gfournieriExec Dec 3, 2024
72e6108
update docker with install git
gfournieriExec Dec 3, 2024
80845ea
update timeout
gfournieriExec Dec 3, 2024
eac0891
wait longer
gfournieriExec Dec 3, 2024
dc53392
set debug config back
gfournieriExec Dec 3, 2024
a4af2b0
update debug it
gfournieriExec Dec 3, 2024
3cd738a
remove debug
gfournieriExec Dec 3, 2024
025f616
remove get install git
gfournieriExec Dec 9, 2024
50d1bdb
back to installing git in dockerfil
gfournieriExec Dec 9, 2024
cfa1b6e
Merge branch 'feature/formatting-sponsor' into feature/poco-sponsoring
gfournieriExec Dec 9, 2024
550d4de
Merge pull request #24 from iExecBlockchainComputing/feature/formatti…
gfournieriExec Dec 10, 2024
2a2653a
Merge branch 'develop' into feature/poco-sponsoring
gfournieriExec Dec 10, 2024
becc924
test add git in jenkins IT
gfournieriExec Dec 10, 2024
a198c31
remove install git from docker
gfournieriExec Dec 10, 2024
2b5ca07
set back
gfournieriExec Dec 10, 2024
0e5e74e
update test
gfournieriExec Dec 11, 2024
c0cae68
add blank line
gfournieriExec Dec 11, 2024
5e146f4
update to dealId
gfournieriExec Dec 11, 2024
6d47957
update test
gfournieriExec Dec 12, 2024
5543087
load event to prevent re-indexing trick
gfournieriExec Dec 12, 2024
adf93ca
set only husky if not CI
gfournieriExec Dec 12, 2024
63b78c6
nest false
gfournieriExec Dec 12, 2024
f1859ed
test
gfournieriExec Dec 12, 2024
c756e49
remove git intstall
gfournieriExec Dec 12, 2024
cefcb2b
set husky not in CI
gfournieriExec Dec 12, 2024
783245b
get logs
gfournieriExec Dec 12, 2024
352be55
invert the logic to test
gfournieriExec Dec 12, 2024
d821747
set else
gfournieriExec Dec 12, 2024
43c7b55
test bullshit
gfournieriExec Dec 12, 2024
c174b25
update
gfournieriExec Dec 12, 2024
5cfc1e7
rest prepare
gfournieriExec Dec 12, 2024
0d99128
update test prepare
gfournieriExec Dec 12, 2024
bfe1942
update package.json
gfournieriExec Dec 12, 2024
e0efce4
update dealID to deal to match interface
gfournieriExec Dec 12, 2024
697376e
set prepare back to husky no impact
gfournieriExec Dec 13, 2024
bb34272
test without git
gfournieriExec Dec 13, 2024
83ba20f
wait 5 minutes
gfournieriExec Dec 13, 2024
508680d
debug option to have testcontainer logs
gfournieriExec Dec 13, 2024
619bfa6
Merge pull request #23 from iExecBlockchainComputing/feature/poco-spo…
gfournieriExec Dec 13, 2024
7130964
Run coverage
james-toussaint Jan 8, 2025
58ab469
Move coverage to dedicated workflow
james-toussaint Jan 9, 2025
f9cb327
Show coverage logs
james-toussaint Jan 9, 2025
0424e46
Start check-runs output title
james-toussaint Jan 9, 2025
dbcb39c
Add summary
james-toussaint Jan 9, 2025
734acb9
Run coverage on PR
james-toussaint Jan 9, 2025
7240686
Remove status
james-toussaint Jan 9, 2025
9f7c8c2
Remove branch
james-toussaint Jan 9, 2025
7569f55
Set completed status
james-toussaint Jan 9, 2025
5d6b37f
Add conclusion
james-toussaint Jan 9, 2025
d84389f
Start coverage in title
james-toussaint Jan 9, 2025
ec3070e
Add sample coverage
james-toussaint Jan 9, 2025
bf73289
Print coverage
james-toussaint Jan 9, 2025
d22c338
Test direct coverage env
james-toussaint Jan 9, 2025
bc4d1e5
Get coverage from Github env
james-toussaint Jan 9, 2025
fbe8f7e
Clean workflow
james-toussaint Jan 9, 2025
6e0ec86
Remove returns in data
james-toussaint Jan 9, 2025
40c4f58
Merge pull request #25 from iExecBlockchainComputing/feature/coverage…
james-toussaint Jan 9, 2025
71d52cd
Add comments
james-toussaint Jan 9, 2025
667f949
Move export
james-toussaint Jan 10, 2025
51722d5
Merge pull request #26 from iExecBlockchainComputing/feature/coverage
james-toussaint Jan 13, 2025
e61ed67
Bump to jenkins-library 2.8.1 and apply related modifications + Use I…
Jan 15, 2025
d8138a9
Use fixed ubuntu 22.04 for CI tests
james-toussaint Jan 16, 2025
09f90af
Update changelog
james-toussaint Jan 17, 2025
89a722a
Merge pull request #29 from iExecBlockchainComputing/feature/develop_…
james-toussaint Jan 17, 2025
9b1075a
Change Jenkinsfile to use new IPFS architecture and GraphNode
Jan 29, 2025
9b0b1ea
Add DealSponsored event and update IexecInterfaceNative contract path…
gfournieriExec Jan 30, 2025
83631f8
Add `sponsor` to `deal`
james-toussaint Jan 30, 2025
e90fe59
Set FixedBytes for bytes32
james-toussaint Jan 30, 2025
f29227c
Use tuple
james-toussaint Jan 30, 2025
61f2d84
Use changetype
james-toussaint Jan 30, 2025
555bdbf
Create mock
james-toussaint Jan 30, 2025
d2b6f0e
Return flat deal
james-toussaint Jan 30, 2025
62fd3b7
Create mock event
james-toussaint Jan 30, 2025
07ad250
Handle orders matched
james-toussaint Jan 30, 2025
92a3b94
Only save deal
james-toussaint Jan 30, 2025
8299551
View deal
james-toussaint Jan 30, 2025
32d286d
Fetch deal
james-toussaint Jan 30, 2025
e33ce77
Log bot
james-toussaint Jan 30, 2025
a5ef818
Fetch deal
james-toussaint Jan 30, 2025
f9a978d
Only fetch deal
james-toussaint Jan 30, 2025
5a6252e
Check sponsor saved to deal
james-toussaint Jan 30, 2025
335c9e3
Refactor should handle OrdersMatched test
james-toussaint Jan 31, 2025
e42fc30
Use existing RLC unit converter
james-toussaint Feb 3, 2025
9ab9703
Merge pull request #31 from iExecBlockchainComputing/feature/add-spon…
james-toussaint Feb 3, 2025
6d710e2
Merge remote-tracking branch 'origin/develop' into feature/new_ipfs_a…
james-toussaint Feb 3, 2025
e26755a
Remove handleDealSponsored from bellecour yml
james-toussaint Feb 3, 2025
f73ab34
Update changelog
james-toussaint Feb 3, 2025
dedc639
Merge pull request #30 from iExecBlockchainComputing/feature/new_ipfs…
james-toussaint Feb 3, 2025
bbdd080
Bump version labels for staging and prod
james-toussaint Feb 3, 2025
da33978
Update changelog
james-toussaint Feb 3, 2025
160d6c4
1.1.0
james-toussaint Feb 3, 2025
3602ed3
Create sponsor account if missing
james-toussaint Feb 3, 2025
56f520a
Set 4 months ago bellecour block
james-toussaint Feb 5, 2025
aa61ce3
Relocate 4 months ago bellecour block setting to bellecour.yml config
james-toussaint Feb 6, 2025
1be7018
Bump few blocks later
james-toussaint Feb 6, 2025
e993a3c
Travel few blocks before poco sponsoring release
james-toussaint Feb 7, 2025
cb18748
Handle `sponsor` introduced on Bellecour for the PoCo v5.5.0 release
james-toussaint Feb 7, 2025
613bfc0
Set 30277777 strablock in Bellecour config
james-toussaint Feb 7, 2025
8410be4
Reset addresses & startblock in configs
james-toussaint Feb 7, 2025
157d280
Reset abi file path
james-toussaint Feb 7, 2025
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
31 changes: 31 additions & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
on:
pull_request:
branches:
- develop
- main

jobs:
coverage:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Init
run: npm ci
- name: Run Coverage
run: (npm run coverage 2>&1) | tee /tmp/coverage.out | cat
- name: Extract coverage
run: echo "COVERAGE=$(cat /tmp/coverage.out | grep "Global test coverage")" >> $GITHUB_ENV
- name: Display coverage in Github PR checks
# See https://docs.github.com/en/rest/checks/runs?apiVersion=2022-11-28#create-a-check-run
# and https://www.kenmuse.com/blog/creating-github-checks/
env:
GH_TOKEN: ${{ github.token }}
run: | # TODO: Set "failure" conclusion if coverage is too low
curl -L -X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer $GH_TOKEN"\
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/${{ github.repository }}/check-runs \
-d '{"name":"Coverage ratio", "head_sha":"${{ github.event.pull_request.head.sha }}", "status":"completed", "conclusion":"success", "output":{"title":"${{env.COVERAGE}}", "summary":""}}'

23 changes: 23 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
on:
push:
branches:
- feature/*
- bugfix/*
- develop
- release/*
- hotfix/*
- main

jobs:
test:
runs-on: ubuntu-22.04 # For 24.04+, see https://github.com/graphprotocol/graph-tooling/issues/1546#issuecomment-2589680195
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Init
run: npm ci
- name: Run unit tests
run: npm run test
- name: Test build
run: npm run build
# See Jenkinsfile-itest for "Run integration tests" step
24 changes: 0 additions & 24 deletions .github/workflows/nodejs.yml

This file was deleted.

3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@ node_modules
build
generated
yarn.lock
test/.bin
subgraph.yaml
subgraph.test.yaml
1 change: 1 addition & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
lint-staged
6 changes: 6 additions & 0 deletions .mocharc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"extension": ["ts"],
"spec": "itest/**/*.ts",
"require": ["ts-node/register"],
"timeout": 1000000
}
10 changes: 10 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"printWidth": 100,
"singleQuote": true,
"tabWidth": 4,
"trailingComma": "all",
"endOfLine": "auto",
"plugins": [
"prettier-plugin-organize-imports"
]
}
21 changes: 10 additions & 11 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
# Changelog

All notable changes to this project will be documented in this file.

## next

### Added

### Changed

### Removed

## 1.0.0 - initial release
## v1.1.0 - Support deal sponsor
- Add `sponsor` to `deal`. (#31)
- Update deployment hosts:
- production (#30)
- staging (#29)
- Display coverage in Github PR checks. (#26)
- Add integration test suite. (#21)
- Add unit test suite. (#20)

## v1.0.0 - initial release

### features

Expand Down
31 changes: 31 additions & 0 deletions Jenkinsfile-itest
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
node('docker') {
stage('Clone') {
cleanWs()
checkoutInfo = checkout(scm)
echo "git checkout: ${checkoutInfo}"
}
stage('Pull images') {
withCredentials([
usernamePassword(credentialsId: 'docker-regis',
usernameVariable: 'username', passwordVariable: 'password')
]) {
def registry = 'docker-regis.iex.ec'
try {
sh "echo -n '${password}' | docker login --username '${username}' --password-stdin ${registry}"
sh 'cd docker/test/ && docker compose pull chain'
} finally {
sh "docker logout ${registry}"
}
}
}
docker.image('node:22-alpine')
.inside('-v /var/run/docker.sock:/var/run/docker.sock --network=host --user=root') {
stage('Init') {
sh 'apk add docker docker-compose' // TODO: Use already built image for a faster job execution
sh 'npm ci'
}
stage('Integration tests') {
sh 'npm run itest'
}
}
}
7 changes: 4 additions & 3 deletions Jenkinsfile_Subgraph_bellecour
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
//Readme @ http://gitlab.iex.ec:30000/iexec/jenkins-library

@Library('global-jenkins-library@2.7.7') _
@Library('global-jenkins-library@2.8.1') _
deploySubGraph(
targetRemoteHost : 'azubgrpbp-thegraph-bellecour.public.az2.internal',
targetRemoteHostGraphNode : 'azubgrpbp-thegraph.public.az2.internal',
targetRemoteHostIPFS : 'ipfs-upload.v8-bellecour.iex.ec',
subgraphFolder: './',
subgraphFilename: 'subgraph.bellecour.yaml',
subgraphVersionLabel: 'v1.0.0-rc.1',
subgraphVersionLabel: 'v1.1.0',
subgraphLabel: 'bellecour/poco-v5'
)
11 changes: 11 additions & 0 deletions Jenkinsfile_Subgraph_bellecour_stagingv8
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
//Readme @ http://gitlab.iex.ec:30000/iexec/jenkins-library

@Library('global-jenkins-library@2.8.1') _
deploySubGraph(
targetRemoteHostGraphNode : 'azubgrpbx-thegraph-staging.public.az2.internal',
targetRemoteHostIPFS : 'ipfs-upload.stagingv8.iex.ec',
subgraphFolder: './',
subgraphFilename: 'subgraph.bellecour.yaml',
subgraphVersionLabel: 'v1.1.0',
subgraphLabel: 'bellecour/poco-v5'
)
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@ A subgraph to explore the PoCo smarcontracts

[CHANGELOG](./CHANGELOG.md)

# Setup coverage⁠

> In order for Matchstick to check which handlers are being run, those handlers need to be exported from the test file.

Check how to export handlers with [Matchstick - Test Coverage documentation](https://thegraph.com/docs/en/subgraphs/developing/creating/unit-testing-framework/#test-coverage).

> [!NOTE]
> Since Matchstick code coverage is in very early stages, Matchstick cannot check for branch coverage, but rely on the assertion that a given handler has been called.


## local dev

run local services:
Expand Down
9 changes: 9 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM node:22
WORKDIR /iexec-poco-subgraph
COPY package*.json .
RUN npm ci
COPY schema.graphql .
COPY subgraph.template.yaml .
COPY networks.json .
COPY src src
ENTRYPOINT [ "npm", "run", "deploy:all" ]
3 changes: 2 additions & 1 deletion docker/test/.env
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
DATA=/home/tmp/graph-test
DB_USER=graphnode
DB_PASSWORD=somerandompasswordthatishardtoguess
DB_NAME=graphnode
DB_NAME=graphnode-db
NETWORK_NAME=test
90 changes: 42 additions & 48 deletions docker/test/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,69 +1,63 @@
version: "3"

networks:
thegraph:
blockchain:

services:
chain:
image: "iexechub/poco-chaintest:5.3.0-token-parity"
image: docker-regis.iex.ec/poco-chain:1.0.0-poco-v5.5.0-voucher-v1.0.0-nethermind
restart: unless-stopped
networks:
- blockchain
expose:
- 8545
- 8546
ports:
- 8545:8545
- 8546:8546
# - 8546:8546 # port (not required for integration tests) fails to open on CI

ipfs:
image: ipfs/go-ipfs:v0.10.0
restart: unless-stopped
networks:
- thegraph
image: ipfs/go-ipfs:v0.22.0
ports:
- 8080:8080
- 5001:5001
volumes:
- ${DATA}/ipfs:/data/ipfs

postgres:
image: postgres:12
graphnode-postgres:
image: postgres:16.4
restart: unless-stopped
networks:
- thegraph
command:
- "postgres"
- "-cshared_preload_libraries=pg_stat_statements"
ports:
- 5432:5432
expose:
- 5432
environment:
POSTGRES_USER: "${DB_USER}"
POSTGRES_PASSWORD: "${DB_PASSWORD}"
POSTGRES_DB: "${DB_NAME}"
POSTGRES_USER: ${DB_USER}
POSTGRES_PASSWORD: ${DB_PASSWORD}
POSTGRES_DB: ${DB_NAME}
POSTGRES_INITDB_ARGS: "-E UTF8 --locale=C"

graphnode:
image: graphprotocol/graph-node:v0.27.0
image: graphprotocol/graph-node:v0.35.1
restart: unless-stopped
networks:
- blockchain
- thegraph
depends_on:
- ipfs
- postgres
- chain
ports:
- 8000:8000 # http
- 8001:8001 # ws
- 8020:8020 # deploy
- 8030:8030 # monitoring
- 8040:8040 # prometeus
- 8000:8000 # GraphQL HTTP
# - 8001:8001 # GraphQL WS
- 8020:8020 # admin RPC
# - 8040:8040 # metrics
environment:
postgres_host: graphnode-postgres
postgres_port: 5432
postgres_user: ${DB_USER}
postgres_pass: ${DB_PASSWORD}
postgres_db: ${DB_NAME}
ipfs: ipfs:5001
ethereum: ${NETWORK_NAME}:http://chain:8545
healthcheck:
test: netcat -w 1 0.0.0.0 8020
interval: 10s
timeout: 5s
retries: 10
start_period: 30s

poco-subgraph-deployer:
build:
context: ../..
dockerfile: docker/Dockerfile
environment:
RUST_BACKTRACE: 1
postgres_host: postgres
postgres_user: "${DB_USER}"
postgres_pass: "${DB_PASSWORD}"
postgres_db: "${DB_NAME}"
ipfs: "ipfs:5001"
ethereum: "test:http://chain:8545"
GRAPH_NODE_ID: "graphnode_id"
GRAPHNODE_URL: http://graphnode:8020
IPFS_URL: http://ipfs:5001
NETWORK_NAME: ${NETWORK_NAME}
depends_on:
graphnode:
condition: service_healthy
54 changes: 54 additions & 0 deletions itest/integration.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import { ApolloClient, gql, InMemoryCache } from '@apollo/client';
import { equal } from 'assert';
import { DockerComposeEnvironment, Wait } from 'testcontainers';

const SECONDS = 1000;
const MINUTES = 60 * SECONDS;
const APIURL = 'http://localhost:8000/subgraphs/name/test/poco';
const client = new ApolloClient({
uri: APIURL,
cache: new InMemoryCache(),
});

describe('Integration tests', () => {
/**
* Services are started only once before running all tests to get a decent test
* suite duration with multiple tests. Please switch to `beforeEach` if necessary.
* Shutdown of services is handled by `testcontainers` framework.
*/
before(async () => {
console.log('Starting services..');
const environment = new DockerComposeEnvironment('docker/test/', 'docker-compose.yml')
.withStartupTimeout(5 * MINUTES)
.withWaitStrategy(
'poco-subgraph-deployer-1',
Wait.forLogMessage(
'Deployed to http://graphnode:8000/subgraphs/name/test/poco/graphql',
),
);
await environment.up();
const secondsToWait = 10;
console.log(
`Waiting ${secondsToWait}s for graphnode to ingest a few blocks before querying it..`,
);
await new Promise((resolve) => {
return setTimeout(resolve, secondsToWait * SECONDS);
});
});

it('should get protocol', async () => {
const result = await client.query({
query: gql(`
query {
protocol(id: "iExec") {
id
tvl
}
}
`),
});
const protocol = result.data.protocol;
equal(protocol.id, 'iExec');
equal(protocol.tvl, '0.02025');
});
});
2 changes: 2 additions & 0 deletions matchstick.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
testsFolder: test
manifestPath: subgraph.template.yaml
Loading