Skip to content

Commit

Permalink
Add persist tests for keyspace creation/deletion
Browse files Browse the repository at this point in the history
  • Loading branch information
ohsayan committed Mar 29, 2022
1 parent 08cffa1 commit 9374404
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
2 changes: 0 additions & 2 deletions .gitignore
Expand Up @@ -12,7 +12,5 @@ snapstore.partmap
.sky_pid
.devcontainer
*.deb
server1
server2
.skytest_*
*.pem
18 changes: 18 additions & 0 deletions server/src/tests/persist/mod.rs
Expand Up @@ -24,13 +24,31 @@
*
*/

use sky_macros::dbtest_func as dbtest;
use skytable::{
aio::Connection,
query,
types::{Array, RawString},
Element, Query, RespCode,
};

#[dbtest(skip_if_cfg = "persist-suite", norun = true, port = 2007)]
async fn store_keyspace() {
assert_okay!(con, query!("create", "keyspace", "universe"));
switch_entity!(con, "universe");
assert_okay!(con, query!("create", "table", "warp", "keymap(str,str)"));
switch_entity!(con, "universe:warp");
assert_okay!(con, query!("set", "x", "100"));
}
#[dbtest(run_if_cfg = "persist-suite", norun = true, port = 2007)]
async fn load_keyspace() {
switch_entity!(con, "universe:warp");
runeq!(con, query!("get", "x"), Element::String("100".to_owned()));
switch_entity!(con, "default");
assert_okay!(con, query!("drop", "table", "universe:warp"));
assert_okay!(con, query!("drop", "keyspace", "universe"));
}

macro_rules! bin {
($input:expr) => {{
const INVALID_SEQ: [u8; 2] = *b"\x80\x81";
Expand Down

0 comments on commit 9374404

Please sign in to comment.