-
Notifications
You must be signed in to change notification settings - Fork 139
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add basic test to deadpool-memcached
- Loading branch information
1 parent
c64504e
commit f6374bb
Showing
3 changed files
with
22 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -66,3 +66,6 @@ services: | |
- rabbitmq.env | ||
volumes: | ||
- rabbitmq-data:/var/lib/rabbitmq | ||
|
||
memcached: | ||
image: memcached:1.6 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
//! Basic tests for deadpool-memcached | ||
use deadpool_memcached::{Manager, Pool}; | ||
|
||
#[tokio::test] | ||
async fn test_set_get() { | ||
let test_key = "test:basic:test_set_get"; | ||
let test_value = "answer_42"; | ||
let manager = Manager::new("memcached:11211"); | ||
let pool = Pool::builder(manager).build().unwrap(); | ||
let mut conn = pool.get().await.unwrap(); | ||
let _ = conn.delete(test_key).await; | ||
assert_eq!(conn.get(test_key).await.unwrap(), None); | ||
conn.set(test_key, test_value, None, None).await.unwrap(); | ||
let value = String::from_utf8(conn.get(test_key).await.unwrap().unwrap().data).unwrap(); | ||
assert_eq!(value, test_value); | ||
} |