Sort vecs before assert to avoid random test failures (#2569)

* Sort language read queries to avoid random test failures

* change sort columns
This commit is contained in:
Nutomic 2022-11-19 01:30:59 +00:00 committed by GitHub
parent 23d0f3ed3c
commit a39cf31466
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

View file

@ -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?;

View file

@ -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