diff options
author | Vika <vika@fireburn.ru> | 2021-05-04 21:08:56 +0300 |
---|---|---|
committer | Vika <vika@fireburn.ru> | 2021-05-04 21:08:56 +0300 |
commit | b0763ade5d16a68654256b4cbfd029210981970d (patch) | |
tree | fec500975c0e5c3bbf90f62aeba6da72255db2ba /src | |
parent | 12a4906117349fa518e4be5550bd8901941abcf0 (diff) | |
download | kittybox-b0763ade5d16a68654256b4cbfd029210981970d.tar.zst |
Fixed Redis tests
Diffstat (limited to 'src')
-rw-r--r-- | src/database/mod.rs | 8 | ||||
-rw-r--r-- | src/database/redis/mod.rs | 2 |
2 files changed, 6 insertions, 4 deletions
diff --git a/src/database/mod.rs b/src/database/mod.rs index 82bbea5..e676008 100644 --- a/src/database/mod.rs +++ b/src/database/mod.rs @@ -233,7 +233,7 @@ mod tests { let client = redis::Client::open(uri.clone()).unwrap(); let millisecond = Duration::from_millis(1); let mut retries: usize = 0; - const MAX_RETRIES: usize = 10 * 1000/*ms*/; + const MAX_RETRIES: usize = 60 * 1000/*ms*/; while let Err(err) = client.get_connection() { if err.is_connection_refusal() { async_std::task::sleep(millisecond).await; @@ -252,14 +252,16 @@ mod tests { #[async_std::test] async fn test_redis_storage_basic_operations() { - let (_, mut redis, backend) = get_redis_backend().await; + let (tempdir, mut redis, backend) = get_redis_backend().await; test_backend_basic_operations(backend).await; redis.kill().expect("Redis wasn't running"); + drop(tempdir); } #[async_std::test] async fn test_redis_storage_channel_support() { - let (_, mut redis, backend) = get_redis_backend().await; + let (tempdir, mut redis, backend) = get_redis_backend().await; test_backend_get_channel_list(backend).await; redis.kill().expect("Redis wasn't running"); + drop(tempdir); } } diff --git a/src/database/redis/mod.rs b/src/database/redis/mod.rs index 2377fac..faf9c13 100644 --- a/src/database/redis/mod.rs +++ b/src/database/redis/mod.rs @@ -263,7 +263,7 @@ impl Storage for RedisStorage { .take(limit); match std::panic::AssertUnwindSafe(posts.collect::<Vec<serde_json::Value>>()).catch_unwind().await { Ok(posts) => feed["children"] = json!(posts), - Err(err) => return Err(StorageError::new(ErrorKind::Other, "Unknown error encountered while assembling feed, see logs for more info")) + Err(_) => return Err(StorageError::new(ErrorKind::Other, "Unknown error encountered while assembling feed, see logs for more info")) } } return Ok(Some(feed)); |