]> Untitled Git - lemmy.git/commit
Support plain `cargo test` and disable unused doctests for speed
authorAndrew Yoon <andrew@nothing-to-say.org>
Thu, 25 Feb 2021 19:43:39 +0000 (14:43 -0500)
committerAndrew Yoon <andrew@nothing-to-say.org>
Thu, 25 Feb 2021 20:44:30 +0000 (15:44 -0500)
commit600ae662a57f1c2343eeba858141de30c699fd10
treec0aed4b05c478ecf207da5d3d13280340c7bdcb2
parentea3c0e177201e0e5e3e88a4b301cabdc6c1dafc5
Support plain `cargo test` and disable unused doctests for speed

Since DB tests execute diesel migrations automatically, concurrent
execution causes flaky failures from simultaneous migrations. This can
be worked around using `cargo test --workspace -- --test-threads=1`,
which is what the CI config does, but this is not intuitive for
newcomer developers and unnecessarily slows down the test suite for
the majority of tests which are safe to run concurrently. This fixes
this issue by integrating with the small test crate `serial_test` and
using it to explicitly mark DB tests to run sequentially while
allowing all other tests to run in parallel.

Additionally, this greatly improves the speed of `cargo test` by
disabling doc-tests in all crates, since these are aren't currently
used and cargo's doc-test pass, even when no doc-tests exist, has
significant overhead. On my machine, this change significantly
improves test suite times by about 85%, making it much more practical
to develop with tools like `cargo watch` auto-running tests.
32 files changed:
.drone.yml
Cargo.lock
Cargo.toml
crates/api/Cargo.toml
crates/apub/Cargo.toml
crates/db_queries/Cargo.toml
crates/db_queries/src/aggregates/comment_aggregates.rs
crates/db_queries/src/aggregates/community_aggregates.rs
crates/db_queries/src/aggregates/post_aggregates.rs
crates/db_queries/src/aggregates/site_aggregates.rs
crates/db_queries/src/aggregates/user_aggregates.rs
crates/db_queries/src/lib.rs
crates/db_queries/src/source/activity.rs
crates/db_queries/src/source/comment.rs
crates/db_queries/src/source/community.rs
crates/db_queries/src/source/moderator.rs
crates/db_queries/src/source/password_reset_request.rs
crates/db_queries/src/source/post.rs
crates/db_queries/src/source/private_message.rs
crates/db_queries/src/source/user.rs
crates/db_queries/src/source/user_mention.rs
crates/db_schema/Cargo.toml
crates/db_views/Cargo.toml
crates/db_views/src/comment_view.rs
crates/db_views/src/lib.rs
crates/db_views/src/post_view.rs
crates/db_views_actor/Cargo.toml
crates/db_views_moderator/Cargo.toml
crates/routes/Cargo.toml
crates/structs/Cargo.toml
crates/utils/Cargo.toml
crates/websocket/Cargo.toml