Fix a flaky test

This commit is contained in:
Georg Semmler 2024-09-24 19:30:15 +02:00
parent 325ffc5412
commit 33ff9ee606
No known key found for this signature in database
GPG Key ID: A87BCEE5205CE489
2 changed files with 9 additions and 4 deletions

View File

@ -73,9 +73,9 @@ jobs:
run: |
sudo systemctl start mysql.service
mysql -e "create database diesel_test; create database diesel_unit_test; grant all on \`diesel_%\`.* to 'root'@'localhost';" -uroot -proot
echo "MYSQL_DATABASE_URL=mysql://root:root@localhost/diesel_test" >> $GITHUB_ENV
echo "MYSQL_EXAMPLE_DATABASE_URL=mysql://root:root@localhost/diesel_example" >> $GITHUB_ENV
echo "MYSQL_UNIT_TEST_DATABASE_URL=mysql://root:root@localhost/diesel_unit_test" >> $GITHUB_ENV
echo "MYSQL_DATABASE_URL=mysql://root:root@127.0.0.1/diesel_test" >> $GITHUB_ENV
echo "MYSQL_EXAMPLE_DATABASE_URL=mysql://root:root@127.0.0.1/diesel_example" >> $GITHUB_ENV
echo "MYSQL_UNIT_TEST_DATABASE_URL=mysql://root:root@127.0.0.1/diesel_unit_test" >> $GITHUB_ENV
- name: Install postgres (MacOS)
if: matrix.os == 'macos-13' && matrix.backend == 'postgres'
@ -227,7 +227,8 @@ jobs:
- name: Run tests
shell: bash
run: cargo xtask run-tests ${{ matrix.backend }} $NO_DOC_TESTS $EXAMPLE_SCHEMA_CHECKS -- --no-fail-fast $FLAGS
run: |
cargo xtask run-tests ${{ matrix.backend }} $NO_DOC_TESTS $EXAMPLE_SCHEMA_CHECKS -- --no-fail-fast $FLAGS
- name: Run diesel_benches
if: runner.os == 'Linux'

View File

@ -461,6 +461,7 @@ mod tests {
use std::sync::mpsc;
use std::sync::Arc;
use std::thread;
use std::time::Duration;
use crate::r2d2::*;
use crate::test_helpers::*;
@ -636,6 +637,9 @@ mod tests {
assert_eq!(release_count.load(Ordering::Relaxed), 2);
assert_eq!(checkin_count.load(Ordering::Relaxed), 3);
assert_eq!(checkout_count.load(Ordering::Relaxed), 3);
// this is required to workaround a segfault while shutting down
// the pool
std::thread::sleep(Duration::from_millis(100));
}
#[cfg(feature = "postgres")]