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

Improve integration testing (file organization, time, memory) #664

Merged
merged 26 commits into from
Jan 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
ab6c42b
Remove unused bench; apply cippy to all targets
FabijanC Dec 12, 2024
bc1105d
Move tests to integration/tests [WIP] [skip ci]
FabijanC Dec 17, 2024
a7905ba
Merge branch 'main' into fix-test-org [skip ci]
FabijanC Dec 17, 2024
87a9d67
Address clippy: remove redundant modules, fix felt manipulation
FabijanC Dec 18, 2024
1f9d728
Use serde renaming instead of clippy suppression in testing FeeUnit
FabijanC Dec 18, 2024
7845bd6
Fix running of BackgroundDevnet
FabijanC Dec 18, 2024
0091d0b
Fix trace tests
FabijanC Dec 19, 2024
327018d
Fix account artifact path in fork test
FabijanC Dec 19, 2024
6aac963
Fix getConfig test
FabijanC Dec 19, 2024
0152729
Add 'cargo build' to config.yml; test with 'cargo test'
FabijanC Dec 19, 2024
6aa4a61
Merge branch 'main' into fix-test-org
FabijanC Dec 19, 2024
b29ccca
Extend BackgroundDevnet startup time to 20 s
FabijanC Dec 19, 2024
40057d7
Merge branch 'main' into fix-test-org
FabijanC Jan 2, 2025
3181e84
Add TODO in config.yml [skip ci]
FabijanC Jan 2, 2025
b4ff654
Merge branch 'main' into fix-test-org
FabijanC Jan 3, 2025
1284ae4
Improve DevnetNotStartable message
FabijanC Jan 3, 2025
744c9ad
Remove cargo build from .circlec/config.yml
FabijanC Jan 3, 2025
a0bcc10
Remove criterion and other unused dependencies
FabijanC Jan 3, 2025
612332b
Move cargo build after checks; add cargo check
FabijanC Jan 3, 2025
f36636a
Do not recompile in BackgroundDevnet
FabijanC Jan 3, 2025
8df2d75
Use different BackgroundDevnet command depending on testing environment
FabijanC Jan 3, 2025
987e9cd
Extend BackgroundDevnet spawn retries from 20 to 40
FabijanC Jan 7, 2025
ced18c9
Replace crate netstat2 with listeners
FabijanC Jan 7, 2025
c46ac31
Update testing docs; add comment to config.yml [skip ci]
FabijanC Jan 7, 2025
7382fdf
Use constant for default eth private key
FabijanC Jan 7, 2025
d54e884
Remove TODO; reduce literal JSON line count
FabijanC Jan 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
16 changes: 8 additions & 8 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,9 @@ jobs:
name: Verify lockfile
command: cargo update -w --locked
- run:
name: Build
command: cargo build --release
# Despite later running cargo build --release, this step is executed on all targets, so might discover testing code issues
name: Check
command: cargo check --workspace --all-targets
- run:
name: Clippy check
command: ./scripts/clippy_check.sh
Expand All @@ -71,19 +72,18 @@ jobs:
- run:
name: Code spell check
command: ./scripts/check_spelling.sh
- run:
name: Build in release mode (for BackgroundDevnet)
command: cargo build --release
- run:
name: Save cache
command: .circleci/scripts/cache.sh save
- run:
name: Cleanup old cache
command: .circleci/scripts/cache.sh cleanup
- run:
name: Unit tests
command: cargo test --lib --bins --no-fail-fast
- run:
name: Integration tests
# fails if jobs not limited; read more in https://github.com/0xSpaceShard/starknet-devnet-rs/issues/378
command: cargo test --jobs 9 --test '*' --no-fail-fast
name: Tests
command: cargo test --no-fail-fast
marioiordanov marked this conversation as resolved.
Show resolved Hide resolved

binary-build:
parameters:
Expand Down
22 changes: 0 additions & 22 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,32 +119,10 @@ Run all tests using all available CPUs with:
$ cargo test
```

The previous command might cause your testing to die along the way due to memory issues. In that case, limiting the number of jobs helps, but depends on your machine (rule of thumb: N=6):

```
$ cargo test --jobs <N>
```

#### Benchmarking

To test if your contribution presents an improvement in execution time, check out the script at `scripts/benchmark/command_stat_test.py`.

##### Cargo Bench execution

To run the criterion benchmarks and generate a performance report:

```
$ cargo bench
```

This command will compile the benchmarks and run them using all available CPUs on your machine. Criterion will perform multiple iterations of each benchmark to collect performance data and generate statistical analysis.

Check the report created at `target/criterion/report/index.html`

Criterion is highly configurable and offers various options to customise the benchmarking process. You can find more information about Criterion and its features in the [Criterion documentation](https://bheisler.github.io/criterion.rs/book/index.html).

To measure and benchmark memory it is best to use external tools such as Valgrind, Leaks, etc.

### Updating OpenZeppelin contracts

Tests in devnet require an erc20 contract with the `Mintable` feature, keep in mind that before the compilation process of [cairo-contracts](https://github.com/OpenZeppelin/cairo-contracts/) you need to mark the `Mintable` check box in this [wizard](https://wizard.openzeppelin.com/cairo) and copy this implementation to `/src/presets/erc20.cairo`.
Expand Down
Loading