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

fix: remove test code from neard #4333

Closed
wants to merge 1 commit into from

Conversation

matklad
Copy link
Contributor

@matklad matklad commented May 28, 2021

testlib is the library we use for testing, it makes no sense that we
compile it into our production code. Admittedly, I lack the context as
to why it was added as a non-dev dep in the first place. I have a
suspicion that it was a workaround some feature bugs.

Now that we use resolever=2, it makes sense to try to fix this in a more
principled way, so let's see if some tests start failing due to this
change.

testlib is the library we use for testing, it makes no sense that we
compile it into our production code. Admittedly, I lack the context as
to *why* it was added as a non-dev dep in the first place. I have a
suspicion that it was a workaround some feature bugs.

Now that we use resolever=2, it makes sense to try to fix this in a more
principled way, so let's see if some tests start failing due to this
change.
@ailisp
Copy link
Member

ailisp commented May 28, 2021

These two tests failed, related to nightly protocol features:


[2021-05-28T15:55:25Z] failures:
[2021-05-28T15:55:25Z] ---- test::test_delete_account_while_staking_runtime stdout ----
[2021-05-28T15:55:25Z] thread 'test::test_delete_account_while_staking_runtime' panicked at 'called `Result::unwrap()` on an `Err` value: TxExecutionError(InvalidTxError(NotEnoughBalance { signer_id: "eve.alice.near", balance: 511097000000000000000, cost: 957462125000000000000 }))', /var/lib/buildkite-agent/builds/buildkite-i-04fd6699e3607b392-1/nearprotocol/nearcore/test-utils/testlib/src/standard_test_cases.rs:1345:84
[2021-05-28T15:55:25Z]
[2021-05-28T15:55:25Z] ---- test::test_delete_account_implicit_beneficiary_account_runtime stdout ----
[2021-05-28T15:55:25Z] thread 'test::test_delete_account_implicit_beneficiary_account_runtime' panicked at 'assertion failed: view_result.is_err()', /var/lib/buildkite-agent/builds/buildkite-i-04fd6699e3607b392-1/nearprotocol/nearcore/test-utils/testlib/src/standard_test_cases.rs:1317:13
[2021-05-28T15:55:25Z] note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
[2021-05-28T15:55:25Z]
[2021-05-28T15:55:25Z]
[2021-05-28T15:55:25Z] failures:
[2021-05-28T15:55:25Z]     test::test_delete_account_implicit_beneficiary_account_runtime
[2021-05-28T15:55:25Z]     test::test_delete_account_while_staking_runtime
[2021-05-28T15:55:25Z]
[2021-05-28T15:55:25Z] test result: FAILED. 53 passed; 2 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.88s
[2021-05-28T15:55:25Z]
[2021-05-28T15:55:25Z] <span class="term-fg31 term-fg1">error</span><span class="term-fg1">:</span> test failed, to rerun pass '-p nearcore --test test_cases_runtime'

@matklad
Copy link
Contributor Author

matklad commented Jun 1, 2021

#4339 does this in a better way I think!

@matklad matklad closed this Jun 1, 2021
near-bulldozer bot pushed a commit that referenced this pull request Jun 2, 2021
We're sort of in a weird spot as it is, we have features within `nearcore` that are required but can't be enabled if they depend on crates listed under `dev-dependencies` (bug in cargo: rust-lang/cargo#6915). Temporarily listing them under `dependencies`, fixed the CI testing failures we had while working on #4292 (same error @ailisp highlighted: #4333 (comment)), but as pointed out in #4331 (comment), this method should be out of the question. If we remove it, however, we can't work with the tests that depend on those features.

This PR moves the _previously top-level_ tests into a new crate to have better dependency and feature handling as @matklad suggested

> * [move tests from `/test` folder somewhere -- either to some of the existing packages (neard perhaps?) or into a new `integration-tests` package](#4292 (comment))

This would ensure we have dependencies like `testlib`, `runtime-params-estimator` and `restored-receipts-verifier` that are only needed for testing and depend on nearcore without cyclic dependency issues while having all features relevant to testing in order.

The features within `neard` have been reduced to proxies to `nearcore` features, which partially resolves #4325 (though the intent for that has morphed a bit). This also makes for a cleaner dependency graph from `neard` perspective, removing extraneous dependencies that were previously required.

I also noticed removed the `old_tests` feature that should've been removed along with the rest of it in #928.

Updated some docs and code comments referencing the old `neard` path too.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants