Skip to content

Commit

Permalink
chore: integrated server command in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tglman committed Oct 23, 2024
1 parent c29a573 commit 7bd0586
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 15 deletions.
2 changes: 1 addition & 1 deletion orientdb-client/src/sync/protocol/v37/encoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ impl VersionedEncoder for Protocol37 {
}

fn encode_server_query(buf: &mut OBuffer, query: ServerQuery) -> OrientResult<()> {
buf.put_i8(45)?;
buf.put_i8(50)?;
buf.put_i32(query.session_id)?;

if let Some(t) = query.token {
Expand Down
34 changes: 20 additions & 14 deletions orientdb-client/tests/common/mod.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use dotenv::dotenv;
use std::env;

use orientdb_client::sync::types::resultset::ResultSet;
use orientdb_client::DatabaseType;
use orientdb_client::OSession;
use orientdb_client::OrientDB;
use std::env;

#[derive(Debug)]
pub struct OrientDBTest {
Expand Down Expand Up @@ -98,13 +98,17 @@ pub fn create_database(db: &str, odb: &OrientDB, config: &OrientDBTest) {
)
.expect(&format!("Cannot drop database with name {}", db));
}
odb.create_database(
db,
odb.execute(
&config.r_password,
&config.r_password,
DatabaseType::Memory,
&format!("create database {} memory users(admin identified by 'admin' role admin, reader identified by 'reader' role reader, writer identified by 'writer' role writer)", db)
)
.expect(&format!("Cannot create database with name {}", db));
.expect(&format!("Cannot create database with name {}", db)).
run()
.expect(&format!("Cannot create database with name {}", db))
.close()
.expect(&format!("Cannot create database with name {}", db))
;
}

#[allow(dead_code)]
Expand Down Expand Up @@ -219,13 +223,15 @@ pub mod asynchronous {
.await
.expect(&format!("Cannot drop database with name {}", db));
}
odb.create_database(
db,
&config.r_password,
&config.r_password,
DatabaseType::Memory,
)
.await
.expect(&format!("Cannot create database with name {}", db));

let _ = odb.execute(
&config.r_password,
&config.r_password,
&format!("create database {} memory users(admin identified by 'admin' role admin, reader identified by 'reader' role reader, writer identified by 'writer' role writer)", db)
).await
.expect(&format!("Cannot create database with name {}", db)).
run().await
.expect(&format!("Cannot create database with name {}", db))
;
}
}

0 comments on commit 7bd0586

Please sign in to comment.