From: Nutomic Date: Sat, 19 Nov 2022 01:30:59 +0000 (+0000) Subject: Sort vecs before assert to avoid random test failures (#2569) X-Git-Url: http://these/git/%7B%60%24%7Bdocument.location.origin%7D/feeds/readmes/%7Bicon?a=commitdiff_plain;h=a39cf314661dea65c1922209772fc38b5ed31a59;p=lemmy.git Sort vecs before assert to avoid random test failures (#2569) * Sort language read queries to avoid random test failures * change sort columns --- diff --git a/crates/db_schema/src/impls/actor_language.rs b/crates/db_schema/src/impls/actor_language.rs index 4b8f3e37..4f7b45ff 100644 --- a/crates/db_schema/src/impls/actor_language.rs +++ b/crates/db_schema/src/impls/actor_language.rs @@ -24,6 +24,7 @@ impl LocalUserLanguage { Box::pin(async move { let langs = local_user_language .filter(local_user_id.eq(for_local_user_id)) + .order(language_id) .select(language_id) .get_results(conn) .await?; @@ -77,6 +78,7 @@ impl SiteLanguage { site::table .inner_join(local_site::table) .inner_join(site_language::table) + .order(site_language::id) .select(site_language::language_id) .load(conn) .await @@ -87,6 +89,7 @@ impl SiteLanguage { let langs = site_language::table .filter(site_language::site_id.eq(for_site_id)) + .order(site_language::language_id) .select(site_language::language_id) .load(conn) .await?; @@ -202,6 +205,7 @@ impl CommunityLanguage { let langs = community_language .filter(community_id.eq(for_community_id)) + .order(language_id) .select(language_id) .get_results(conn) .await?; diff --git a/scripts/test.sh b/scripts/test.sh index 513bc3c6..5a6130a4 100755 --- a/scripts/test.sh +++ b/scripts/test.sh @@ -9,5 +9,5 @@ export LEMMY_DATABASE_URL=postgres://lemmy:password@localhost:5432/lemmy # so to load the config we need to traverse to the repo root export LEMMY_CONFIG_LOCATION=../../config/config.hjson RUST_BACKTRACE=1 \ - cargo test --workspace --no-fail-fast + cargo test --workspace --all-features --no-fail-fast # Add this to do printlns: -- --nocapture