Skip to content
This repository has been archived by the owner on Oct 25, 2024. It is now read-only.

Commit

Permalink
chore: add suite of qa tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Rashad Alston authored and Rashad Alston committed Sep 18, 2023
1 parent 1b345b0 commit d412e6a
Show file tree
Hide file tree
Showing 11 changed files with 627 additions and 47 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ docs/book/
# There's not really a great way to cleanup the test manifest assets
# used by the trybuild tests, and we don't want to commit these test
# files so as to not clutter the repo. So, we'll just ignore them.
packages/fuel-indexer-tests/trybuild/*.yaml
packages/fuel-indexer-tests/trybuild/*.yaml

8 changes: 8 additions & 0 deletions Cargo.lock

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

42 changes: 6 additions & 36 deletions examples/fuel-explorer/fuel-explorer/fuel_explorer.manifest.yaml
Original file line number Diff line number Diff line change
@@ -1,43 +1,13 @@
# A namespace is a logical grouping of declared names. Think of the namespace
# as an organization identifier
---
namespace: fuellabs

# The identifier field is used to identify the given index.
identifier: explorer

# The abi option is used to provide a link to the Sway JSON ABI that is generated when you
# build your project.
abi: ~

# The particular start block after which you'd like your indexer to start indexing events.
start_block: ~

# The particular end block after which you'd like your indexer to stop indexing events.
end_block: ~

# The `fuel_client` denotes the address (host, port combination) of the running Fuel client
# that you would like your indexer to index events from. In order to use this per-indexer
# `fuel_client` option, the indexer service at which your indexer is deployed will have to run
# with the `--indexer_net_config` option.
fuel_client: ~

# The contract_id specifies which particular contract you would like your index to subscribe to.
contract_id: ~

# The graphql_schema field contains the file path that points to the GraphQL schema for the
# given index.
graphql_schema: examples/fuel-explorer/fuel-explorer/schema/fuel_explorer.schema.graphql

# The module field contains a file path that points to code that will be run as an executor inside
# of the indexer.
# Important: At this time, wasm is the preferred method of execution.
graphql_schema: examples/fuel-explorer/fuel-explorer/schema/fuel_explorer.schema.graphql
module:
wasm: target/wasm32-unknown-unknown/release/fuel_explorer.wasm

# The report_metrics field contains boolean whether or not to report Prometheus metrics to the
# Fuel backend
report_metrics: true

# The resumable field contains a boolean that specifies whether or not the indexer should, synchronise
# with the latest block if it has fallen out of sync.
metrics: ~
contract_id: ~
start_block: 0
end_block: 10000
resumable: true
2 changes: 1 addition & 1 deletion packages/fuel-indexer-api-server/src/uses.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ pub(crate) async fn remove_indexer(
// unnecessary DatabaseError's appearing in the logs.
tokio::time::sleep(std::time::Duration::from_secs(1)).await;

// Allways remove data when removing an indexer.
// Always remove data when removing an indexer.
if let Err(e) =
queries::remove_indexer(&mut conn, &namespace, &identifier, true).await
{
Expand Down
12 changes: 12 additions & 0 deletions packages/fuel-indexer-benchmarks/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,15 @@ name = "wasm"
name = "fuel_indexer_benchmarks"
crate-type = ["cdylib", "rlib"]

[[bin]]
name = "qa"
path = "src/bin/qa.rs"

[dependencies]
chrono = { version = "0.4", features = ["serde"] }
clap = { workspace = true }
criterion = { version = "0.5.1", features = ["html_reports", "async_tokio"] }
duct = "0.13"
fuel-core-client = "0.20"
fuel-indexer = { workspace = true }
fuel-indexer-database = { workspace = true }
Expand All @@ -27,4 +34,9 @@ fuel-indexer-lib = { workspace = true }
fuel-indexer-schema = { workspace = true }
fuel-indexer-tests = { path = "../fuel-indexer-tests" }
futures = "0.3"
reqwest = { version = "0.11", default-features = false, features = ["json", "rustls-tls", "multipart", "stream"] }
serde = { workspace = true }
serde_json = { workspace = true }
tokio = { workspace = true, features = ["macros", "rt-multi-thread"] }
tracing = { workspace = true }
tracing-subscriber = { version = "0.2", features = ["env-filter"] }
8 changes: 8 additions & 0 deletions packages/fuel-indexer-benchmarks/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,21 @@ in the `/scripts/utils` folder of the repo root.

## Usage

### `criterion` benchmarking

Ensure that you are in the `fuel-indexer-benchmarks` directory and then run `cargo bench`. The
compile time for benchmarks is a bit longer than that of normal compilation, so it may take longer
than one would expect. Eventually, timings will be logged to the terminal, showing you the minimum,
average, and maximum times for each benchmark; they will also be saved for comparison against future
runs in `target/criterion`. Additionally, an HTML file with plots and statistics can be found at
`target/criterion/report/index.html`.

### QA suite

```bash
cargo run -p fuel-indexer-benchmarks --bin qa -- --network beta-4.fuel.network
```

### Comparing Branches

You can compare branches by switching to the base branch, running `cargo bench`, then switching to your
Expand Down
Loading

0 comments on commit d412e6a

Please sign in to comment.