Skip to content

Commit

Permalink
Fixed test feature call lint, fixed test script, fixed flakey unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
1Dragoon committed Mar 13, 2024
1 parent f8d6fe0 commit 23cf90e
Show file tree
Hide file tree
Showing 10 changed files with 23 additions and 10 deletions.
6 changes: 3 additions & 3 deletions bin/test
Original file line number Diff line number Diff line change
Expand Up @@ -24,22 +24,22 @@ else
(cd diesel_cli && cargo test --features "sqlite" --no-default-features "$*")
(cd diesel_migrations && cargo test --features "sqlite diesel/sqlite" "$*")
(cd diesel_migrations && cargo test --features "sqlite diesel/sqlite" "$*")
(cd diesel_derives && cargo test --features "diesel/sqlite" "$*")
(cd diesel_derives && cargo test --features "sqlite diesel/sqlite" "$*")
(cd diesel_tests && cargo test --features "sqlite" --no-default-features "$*")
(cd diesel_dynamic_schema && cargo test --features "sqlite diesel/sqlite" "$*")
(cd diesel_bench && cargo test --features "sqlite" --benches "$*")

(cd diesel_migrations && cargo test --features "postgres diesel/postgres" "$*")
(cd diesel_migrations/migrations_macros && cargo test --features "diesel/postgres postgres" "$*")
(cd diesel_derives && cargo test --features "diesel/postgres" "$*")
(cd diesel_derives && cargo test --features "postgres diesel/postgres" "$*")
(cd diesel_cli && cargo test --features "postgres" --no-default-features "$*")
(cd diesel_tests && cargo test --features "postgres" --no-default-features "$*")
(cd diesel_dynamic_schema && cargo test --features "postgres diesel/postgres" "$*")
(cd diesel_bench && cargo test --features "postgres" --benches "$*")

(cd diesel_migrations && cargo test --features "mysql diesel/mysql" "$*" -- --test-threads 1)
(cd diesel_migrations/migrations_macros && cargo test --features "diesel/mysql mysql" "$*" -- --test-threads 1)
(cd diesel_derives && cargo test --features "diesel/mysql" "$*" -- --test-threads 1)
(cd diesel_derives && cargo test --features "mysql diesel/mysql" "$*" -- --test-threads 1)
(cd diesel_cli && cargo test --features "mysql" --no-default-features "$*" -- --test-threads 1)
(cd diesel_tests && cargo test --features "mysql" --no-default-features "$*" -- --test-threads 1)
(cd diesel_dynamic_schema && cargo test --features "mysql diesel/mysql" "$*" -- --test-threads 1)
Expand Down
2 changes: 1 addition & 1 deletion diesel_cli/src/infer_schema_internals/foreign_keys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ pub fn remove_unsafe_foreign_keys_for_codegen(
"Error loading primary keys for `{}`",
fk.parent_table
));
pk_columns.len() == 1 && Some(&pk_columns[0]) == fk.primary_key_columns.get(0)
pk_columns.len() == 1 && Some(&pk_columns[0]) == fk.primary_key_columns.first()
})
.filter(|fk| !duplicates.contains(&fk.ordered_tables()))
.cloned()
Expand Down
4 changes: 2 additions & 2 deletions diesel_compile_tests/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion diesel_tests/tests/joins.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ fn select_single_from_join() {
let select_title = source.select(posts::title);

let expected_names = vec!["Sean".to_string(), "Tess".to_string()];
let actual_names: Vec<String> = select_name.load(connection).unwrap();
let mut actual_names: Vec<String> = select_name.load(connection).unwrap();
actual_names.sort();

assert_eq!(expected_names, actual_names);

Expand Down
1 change: 1 addition & 0 deletions examples/mysql/getting_started_step_1/src/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
diesel::table! {
posts (id) {
id -> Integer,
#[max_length = 255]
title -> Varchar,
body -> Text,
published -> Bool,
Expand Down
1 change: 1 addition & 0 deletions examples/mysql/getting_started_step_2/src/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
diesel::table! {
posts (id) {
id -> Integer,
#[max_length = 255]
title -> Varchar,
body -> Text,
published -> Bool,
Expand Down
1 change: 1 addition & 0 deletions examples/mysql/getting_started_step_3/src/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
diesel::table! {
posts (id) {
id -> Integer,
#[max_length = 255]
title -> Varchar,
body -> Text,
published -> Bool,
Expand Down
6 changes: 5 additions & 1 deletion examples/postgres/advanced-blog-cli/src/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,8 @@ diesel::joinable!(comments -> posts (post_id));
diesel::joinable!(comments -> users (user_id));
diesel::joinable!(posts -> users (user_id));

diesel::allow_tables_to_appear_in_same_query!(comments, posts, users,);
diesel::allow_tables_to_appear_in_same_query!(
comments,
posts,
users,
);
7 changes: 6 additions & 1 deletion examples/postgres/relations/src/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,9 @@ diesel::joinable!(books_authors -> authors (author_id));
diesel::joinable!(books_authors -> books (book_id));
diesel::joinable!(pages -> books (book_id));

diesel::allow_tables_to_appear_in_same_query!(authors, books, books_authors, pages,);
diesel::allow_tables_to_appear_in_same_query!(
authors,
books,
books_authors,
pages,
);
2 changes: 1 addition & 1 deletion rust-toolchain
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.68.0
1.74.0

0 comments on commit 23cf90e

Please sign in to comment.