Skip to content

Commit cab6412

Browse files
author
Chris Pick
committed
Set order for distinct integration tests
Explicitly set the order for the integration tests in 'diesel_tests/tests/distinct.rs'. Previously, the tests could fail with an error like the following: $ bin/test integration postgres -- distinct::simple_distinct ... ---- distinct::simple_distinct stdout ---- thread 'distinct::simple_distinct' panicked at 'assertion failed: `(left == right)` left: `["Sean", "Tess"]`, right: `["Tess", "Sean"]`', tests/distinct.rs:17:4 note: Run with `RUST_BACKTRACE=1` for a backtrace. ...
1 parent 5bf0774 commit cab6412

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

diesel_tests/tests/distinct.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ fn simple_distinct() {
1010
.execute("INSERT INTO users (name) VALUES ('Sean'), ('Sean'), ('Tess')")
1111
.unwrap();
1212

13-
let source = users.select(name).distinct();
13+
let source = users.select(name).distinct().order(name);
1414
let expected_data = vec!["Sean".to_string(), "Tess".to_string()];
1515
let data: Vec<String> = source.load(&connection).unwrap();
1616

@@ -29,7 +29,7 @@ fn distinct_on() {
2929
)
3030
.unwrap();
3131

32-
let source = users.select((name, hair_color)).distinct_on(name);
32+
let source = users.select((name, hair_color)).order(name).distinct_on(name);
3333
let expected_data = vec![
3434
("Sean".to_string(), Some("black".to_string())),
3535
("Tess".to_string(), None),

0 commit comments

Comments
 (0)