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

A typo can lead to accidentally skipping all tests #1108

Closed
dpc opened this issue Nov 14, 2023 · 3 comments
Closed

A typo can lead to accidentally skipping all tests #1108

dpc opened this issue Nov 14, 2023 · 3 comments

Comments

@dpc
Copy link

dpc commented Nov 14, 2023

I've discovered that our CI was not running quite a few of test suites we have. It was weird because when running locally they were being ran, but in the CI they were not.

After quite a lot of debugging I discovered that a typo can lead to strange behavior. The typo was that if the CARGO_PROFILE env var was set (to a custom ci profile in the CI), the scripts would pass -profile ci (instead of the desired --profile ci).

This leads to logs of tests being skipped:

> cargo nextest run --cargo-profile ci -profile ci --workspace --all-targets
    Finished ci [unoptimized + debuginfo] target(s) in 0.23s
    Starting 2 tests across 50 binaries (176 skipped)
        PASS [   0.004s] fedimint-mint-client tests::select_notes_uses_big_note_if_small_amounts_are_not_sufficient
        PASS [   0.011s] tbs tests::test_insufficient_shares
------------
     Summary [   0.012s] 2 tests run: 2 passed, 176 skipped

I still don't know how is this being parsed. I thought -p might be considered cargo's --package/-p, but we don't have a rofile package, so why wouldn't it fail?

@sunshowers
Copy link
Member

Hmm, so cargo build -profile --workspace also works, even though rofile doesn't match any packages -- I think this should be detected and at least warned about, possibly eventually made a failure, in upstream Cargo.

I think the fact that we accept filter arguments over the CLI comes back to bite us (the ci gets interpreted as a filter). Perhaps that was a mistake: we should always have required filters to be passed in after --, and we should consider deprecating filters passed in before -- at some point.

sunshowers added a commit that referenced this issue Nov 14, 2023
I think we should always require that filters be passed in after --, similar to
`cargo test`. This avoids issues like #1108.

There will be a retraining period but overall we'll be left in a better place.

See #1109.
@sunshowers
Copy link
Member

I've proposed #1109 to deprecate and disable test name filters before --. You're not the first and probably not the last to run into this.

@dpc
Copy link
Author

dpc commented Nov 15, 2023

Thanks. All makes sense. I guess this issue can be closed as the new issues are more specific and cover everything.

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

No branches or pull requests

2 participants