From 90e7d28173ae281ba8c4e396c98da9b093b3bb42 Mon Sep 17 00:00:00 2001 From: Jax Young Date: Mon, 5 Aug 2024 21:22:40 +0800 Subject: test: add env ATUIN_TEST_LOCAL_TIMEOUT to control test timeout of SQLite (#2337) * test: add env ATUIN_TEST_LOCAL_TIMEOUT to control test timeout of SQLite This make it possible to control the timeout of SQLite operations in test. And ATUIN_TEST_LOCAL_TIMEOUT defaults to the default local_timeout, which is actually used in the client. Instead of a small timeout (0.1), this change makes the test less likely to fail and better imitate the default behavior. SQLite operation timeout was first introduced from #1590, including connection and store timeout. The env ATUIN_TEST_SQLITE_STORE_TIMEOUT which added by #1703 only specify the store timeout. This commit doesn't deprecate ATUIN_TEST_SQLITE_STORE_TIMEOUT, but control it by setting its default to the new env ATUIN_TEST_LOCAL_TIMEOUT. * test!: replace ATUIN_TEST_SQLITE_STORE_TIMEOUT with ATUIN_TEST_LOCAL_TIMEOUT This deprecate ATUIN_TEST_SQLITE_STORE_TIMEOUT for simplicity as the new env ATUIN_TEST_LOCAL_TIMEOUT can control both connection and store timeout of SQLite in test. Details see 4d88611. Revert: #1703. --- crates/atuin-client/src/kv.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'crates/atuin-client/src/kv.rs') diff --git a/crates/atuin-client/src/kv.rs b/crates/atuin-client/src/kv.rs index fb26cadc..6c522a0e 100644 --- a/crates/atuin-client/src/kv.rs +++ b/crates/atuin-client/src/kv.rs @@ -197,7 +197,8 @@ mod tests { use crypto_secretbox::{KeyInit, XSalsa20Poly1305}; use rand::rngs::OsRng; - use crate::record::sqlite_store::{test_sqlite_store_timeout, SqliteStore}; + use crate::record::sqlite_store::SqliteStore; + use crate::settings::test_local_timeout; use super::{KvRecord, KvStore, KV_VERSION}; @@ -221,7 +222,7 @@ mod tests { #[tokio::test] async fn build_kv() { - let mut store = SqliteStore::new(":memory:", test_sqlite_store_timeout()) + let mut store = SqliteStore::new(":memory:", test_local_timeout()) .await .unwrap(); let kv = KvStore::new(); -- cgit v1.3.1