ApeWorX / ApeWorX/web3.py

Flaky Integration Test(s)

Open
#3,366 2 comments 0 reactions 0 assignees View on GitHub
priority: p2 normal
Dominant language
Python
Stars
5.5k
Forks
1.7k
Avg merge
3d 10h
Merged PRs (30d)
2

Description

### What happened?

Every now and then we get failures in CI from tests that appear to flake. Investigate and fix the flakiness.

Running with `pytest-flakefinder` shows exactly where things break down. I found that running all tests with in `TestGoEthereumAsyncEthModuleTest` with the flakefinder, `tests/integration/go_ethereum/test_goethereum_ws/test_async_ctx_manager_w3.py::TestGoEthereumAsyncEthModuleTest::test_eth_modify_transaction` passes the first 30ish times or so but then hangs for a bit and starts failing.

**It appears that the request ID is not being matched with the cached response properly**, if the response even exists. The test itself modifies the transaction but I'm not sure if it would effectively overwrite the original transaction in the cache. Perhaps this is why the IDs get messed up or the queue is not the expected size. Still digging.

After further investigation, it seems that slowing down the test with sleep or even using `wait_for_transaction_receipt` will cause the failure to happen on the 14th run.

Added `@flaky_geth_dev_mining` but it isn't working either.

### Code that produced the error

```python
pytest tests/integration/go_ethereum/test_goethereum_ws/test_async_ctx_manager_w3.py::TestGoEthereumAsyncEthModuleTest
```

### Full error output

_No response_

### Fill this section in if you know how this could or should be fixed

Will need to investigate. Could be some context somewhere that's getting reused, like an object that should be copied instead of assigned.

### web3 Version

_No response_

### Python Version

_No response_

### Operating System

_No response_

### Output from `pip freeze`

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.