Skip to content

Commit e5dd53d

Browse files
authored
tests: refactor integration tests (#4249)
* tests: sort alphabetically deps in Cargo.toml * tests: move common/ up a level In preparation to splitting tests/integration-tests/ into 2 directories, we want common/ to be easily accessible from both, so I'm moving it up a level. * tests: new .gitignore * tests: isolate integration and runner tests * tests: refactor and make tests run faster
1 parent 0737908 commit e5dd53d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+13537
-945
lines changed

.gitignore

+6-7
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,11 @@ lcov.info
2020
/docker/parity/network/
2121
**/*/tests/fixtures/ipfs_folder/random.txt
2222

23-
/tests/integration-tests/**/build
24-
/tests/integration-tests/**/generated
25-
/tests/integration-tests/**/node_modules
26-
/tests/integration-tests/**/yarn.lock
27-
/tests/integration-tests/**/yarn-error.log
23+
/tests/**/build
24+
/tests/**/generated
25+
/tests/**/node_modules
26+
/tests/**/yarn-error.log
2827

2928
# Built solidity contracts.
30-
/tests/integration-tests/**/bin
31-
/tests/integration-tests/**/truffle_output
29+
/tests/**/bin
30+
/tests/**/truffle_output

Cargo.lock

+5-12
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/Cargo.toml

+8-8
Original file line numberDiff line numberDiff line change
@@ -4,31 +4,31 @@ version.workspace = true
44
edition.workspace = true
55

66
[dependencies]
7-
port_check = "0.1.5"
87
anyhow = "1.0"
8+
assert-json-diff = "2.0.2"
9+
async-stream = "0.3.3"
10+
bollard = "0.10"
911
futures = { version = "0.3", features = ["compat"] }
1012
graph = { path = "../graph" }
11-
tokio = { version = "1.16.1", features = ["rt", "macros", "process"] }
1213
graph-chain-ethereum = { path = "../chain/ethereum" }
13-
async-stream = "0.3.3"
1414
graph-node = { path = "../node" }
1515
graph-core = { path = "../core" }
1616
graph-mock = { path = "../mock" }
1717
graph-graphql = { path = "../graphql" }
1818
graph-store-postgres = { path = "../store/postgres" }
1919
graph-runtime-wasm = { path = "../runtime/wasm" }
2020
graph-server-index-node = { path = "../server/index-node" }
21-
slog = { version = "2.7.0", features = ["release_max_level_trace", "max_level_trace"] }
2221
graphql-parser = "0.4.0"
23-
hex = "0.4.3"
24-
serde_yaml = "0.8"
2522
hyper = "0.14"
2623
serde = "1.0"
27-
assert-json-diff = "2.0.2"
24+
serde_yaml = "0.8"
25+
slog = { version = "2.7.0", features = ["release_max_level_trace", "max_level_trace"] }
26+
tokio = { version = "1.16.1", features = ["rt", "macros", "process"] }
27+
uuid = { version = "1.2.2", features = ["v4"] }
2828

2929
[dev-dependencies]
30-
bollard = "0.10"
3130
anyhow = "1.0.69"
31+
bollard = "0.10"
3232
lazy_static = "1.4.0"
3333
tokio-stream = "0.1"
3434
serde_yaml = "0.8"
File renamed without changes.

tests/integration-tests/api-version-v0-0-4/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "api-version-v0-0-4",
33
"version": "0.1.0",
44
"scripts": {
5-
"build-contracts": "../common/build-contracts.sh",
5+
"build-contracts": "../../common/build-contracts.sh",
66
"codegen": "graph codegen --skip-migrations",
77
"test": "yarn build-contracts && truffle test --compile-none --network test",
88
"create:test": "graph create test/api-version-v0-0-4 --node $GRAPH_NODE_ADMIN_URI",

tests/integration-tests/api-version-v0-0-4/truffle.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ require("babel-register");
22
require("babel-polyfill");
33

44
module.exports = {
5-
contracts_directory: "../common",
6-
migrations_directory: "../common",
5+
contracts_directory: "../../common",
6+
migrations_directory: "../../common",
77
contracts_build_directory: "./truffle_output",
88
networks: {
99
test: {

tests/integration-tests/ganache-reverts/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "ganache-reverts",
33
"version": "0.1.0",
44
"scripts": {
5-
"build-contracts": "../common/build-contracts.sh",
5+
"build-contracts": "../../common/build-contracts.sh",
66
"codegen": "graph codegen --skip-migrations",
77
"test": "yarn build-contracts && truffle test --compile-none --network test",
88
"create:test": "graph create test/ganache-reverts --node $GRAPH_NODE_ADMIN_URI",

tests/integration-tests/host-exports/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "host-exports",
33
"version": "0.1.0",
44
"scripts": {
5-
"build-contracts": "../common/build-contracts.sh",
5+
"build-contracts": "../../common/build-contracts.sh",
66
"codegen": "graph codegen --skip-migrations",
77
"test": "yarn build-contracts && truffle test --compile-none --network test",
88
"create:test": "graph create test/host-exports --node $GRAPH_NODE_ADMIN_URI",

tests/integration-tests/host-exports/truffle.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ require("babel-register");
22
require("babel-polyfill");
33

44
module.exports = {
5-
contracts_directory: "../common",
6-
migrations_directory: "../common",
5+
contracts_directory: "../../common",
6+
migrations_directory: "../../common",
77
contracts_build_directory: "./truffle_output",
88
networks: {
99
test: {

tests/integration-tests/non-fatal-errors/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "non-fatal-errors",
33
"version": "0.1.0",
44
"scripts": {
5-
"build-contracts": "../common/build-contracts.sh",
5+
"build-contracts": "../../common/build-contracts.sh",
66
"codegen": "graph codegen --skip-migrations",
77
"test": "yarn build-contracts && truffle test --compile-none --network test",
88
"create:test": "graph create test/non-fatal-errors --node $GRAPH_NODE_ADMIN_URI",

tests/integration-tests/non-fatal-errors/truffle.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ require("babel-register");
22
require("babel-polyfill");
33

44
module.exports = {
5-
contracts_directory: "../common",
6-
migrations_directory: "../common",
5+
contracts_directory: "../../common",
6+
migrations_directory: "../../common",
77
contracts_build_directory: "./truffle_output",
88
networks: {
99
test: {

tests/integration-tests/overloaded-contract-functions/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "overloaded-contract-functions",
33
"version": "0.1.0",
44
"scripts": {
5-
"build-contracts": "../common/build-contracts.sh",
5+
"build-contracts": "../../common/build-contracts.sh",
66
"codegen": "graph codegen --skip-migrations",
77
"test": "yarn build-contracts && truffle test --compile-none --network test",
88
"create:test": "graph create test/overloaded-contract-functions --node $GRAPH_NODE_ADMIN_URI",

tests/integration-tests/package.json

+1-7
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,12 @@
22
"private": true,
33
"workspaces": [
44
"api-version-v0-0-4",
5-
"data-source-revert",
6-
"data-source-revert2",
7-
"fatal-error",
85
"ganache-reverts",
96
"host-exports",
107
"non-fatal-errors",
118
"overloaded-contract-functions",
129
"poi-for-failed-subgraph",
1310
"remove-then-update",
14-
"typename",
15-
"value-roundtrip",
16-
"dynamic-data-source",
17-
"file-data-sources"
11+
"value-roundtrip"
1812
]
1913
}

tests/integration-tests/poi-for-failed-subgraph/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "poi-for-failed-subgraph",
33
"version": "0.1.0",
44
"scripts": {
5-
"build-contracts": "../common/build-contracts.sh",
5+
"build-contracts": "../../common/build-contracts.sh",
66
"codegen": "graph codegen --skip-migrations",
77
"test": "yarn build-contracts && truffle test --compile-none --network test",
88
"create:test": "graph create test/poi-for-failed-subgraph --node $GRAPH_NODE_ADMIN_URI",

tests/integration-tests/poi-for-failed-subgraph/truffle.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ require("babel-register");
22
require("babel-polyfill");
33

44
module.exports = {
5-
contracts_directory: "../common",
6-
migrations_directory: "../common",
5+
contracts_directory: "../../common",
6+
migrations_directory: "../../common",
77
contracts_build_directory: "./truffle_output",
88
networks: {
99
test: {

tests/integration-tests/remove-then-update/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "remove-then-update",
33
"version": "0.1.0",
44
"scripts": {
5-
"build-contracts": "../common/build-contracts.sh",
5+
"build-contracts": "../../common/build-contracts.sh",
66
"codegen": "graph codegen --skip-migrations",
77
"test": "yarn build-contracts && truffle test --compile-none --network test",
88
"create:test": "graph create test/remove-then-update --node $GRAPH_NODE_ADMIN_URI",

tests/integration-tests/remove-then-update/truffle.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ require("babel-register");
22
require("babel-polyfill");
33

44
module.exports = {
5-
contracts_directory: "../common",
6-
migrations_directory: "../common",
5+
contracts_directory: "../../common",
6+
migrations_directory: "../../common",
77
contracts_build_directory: "./truffle_output",
88
networks: {
99
test: {

tests/integration-tests/value-roundtrip/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "value-roundtrip",
33
"version": "0.1.0",
44
"scripts": {
5-
"build-contracts": "../common/build-contracts.sh",
5+
"build-contracts": "../../common/build-contracts.sh",
66
"codegen": "graph codegen --skip-migrations",
77
"test": "yarn build-contracts && truffle test --compile-none --network test",
88
"create:test": "graph create test/value-roundtrip --node $GRAPH_NODE_ADMIN_URI",

tests/integration-tests/value-roundtrip/truffle.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ require("babel-register");
22
require("babel-polyfill");
33

44
module.exports = {
5-
contracts_directory: "../common",
6-
migrations_directory: "../common",
5+
contracts_directory: "../../common",
6+
migrations_directory: "../../common",
77
contracts_build_directory: "./truffle_output",
88
networks: {
99
test: {

tests/integration-tests/dynamic-data-source/package.json tests/runner-tests/dynamic-data-source/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "dynamic-data-source",
33
"version": "0.1.0",
44
"scripts": {
5-
"build-contracts": "../common/build-contracts.sh",
5+
"build-contracts": "../../common/build-contracts.sh",
66
"codegen": "graph codegen --skip-migrations",
77
"test": "yarn build-contracts && truffle test --compile-none --network test",
88
"create:test": "graph create test/dynamic-data-source --node $GRAPH_NODE_ADMIN_URI",

tests/integration-tests/fatal-error/package.json tests/runner-tests/fatal-error/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@
1717
"babel-register": "^6.26.0",
1818
"gluegun": "^4.6.1"
1919
}
20-
}
20+
}

tests/runner-tests/package.json

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"private": true,
3+
"workspaces": [
4+
"data-source-revert",
5+
"data-source-revert2",
6+
"dynamic-data-source",
7+
"fatal-error",
8+
"file-data-sources",
9+
"typename"
10+
]
11+
}

0 commit comments

Comments
 (0)