Fix test harness

Don't try to initiate an actual connection (right now). Instead,
try to see if the TCP port is live and can be connected to.

Also added some misc `rustfmt` fixes.
next
Sayan Nandan 10 months ago
parent fddb24ad0b
commit f923a4fc39
No known key found for this signature in database
GPG Key ID: 42EEDF4AE9D96B54

1
Cargo.lock generated

@ -520,7 +520,6 @@ dependencies = [
"log",
"openssl",
"powershell_script",
"skytable",
"zip",
]

@ -7,7 +7,6 @@ edition = "2021"
[dependencies]
# internal deps
skytable = { git = "https://github.com/skytable/client-rust.git", branch = "octave" }
libsky = { path = "../libsky" }
# external deps
env_logger = "0.10.0"

@ -32,10 +32,6 @@ use {
util::{self},
HarnessError, HarnessResult, ROOT_DIR,
},
skytable::{
error::{ClientResult, Error},
Config, Connection,
},
std::{
io::ErrorKind,
path::Path,
@ -55,9 +51,9 @@ const TESTSUITE_SERVER_HOST: &str = "127.0.0.1";
/// The workspace root
const WORKSPACE_ROOT: &str = env!("ROOT_DIR");
fn connect_db(host: &str, port: u16) -> ClientResult<Connection> {
let cfg = Config::new(host, port, "root", "password12345678");
cfg.connect()
fn connect_db(host: &str, port: u16) -> std::io::Result<std::net::TcpStream> {
let tcp_stream = std::net::TcpStream::connect((host, port))?;
Ok(tcp_stream)
}
/// Get the command to start the provided server1
@ -99,10 +95,10 @@ pub(super) fn wait_for_server_exit() -> HarnessResult<()> {
Ok(())
}
fn connection_refused<T>(input: ClientResult<T>) -> HarnessResult<bool> {
fn connection_refused<T>(input: std::io::Result<T>) -> HarnessResult<bool> {
match input {
Ok(_) => Ok(false),
Err(Error::IoError(e))
Err(e)
if matches!(
e.kind(),
ErrorKind::ConnectionRefused | ErrorKind::ConnectionReset

@ -307,7 +307,7 @@ impl FractalMgr {
}
}
Err(_) => {
log::error!(
error!(
"fhp: error writing data batch for model {}. retrying ...",
model_id.uuid()
);

@ -40,7 +40,7 @@ use {
},
std::{cell::Cell, net::SocketAddr, pin::Pin, time::Duration},
tokio::{
io::{AsyncRead, AsyncWrite, BufWriter, AsyncWriteExt},
io::{AsyncRead, AsyncWrite, AsyncWriteExt, BufWriter},
net::{TcpListener, TcpStream},
sync::{broadcast, mpsc, Semaphore},
},
@ -220,7 +220,7 @@ impl Listener {
/*
SECURITY: IGNORE THIS ERROR
*/
log::error!("failed to accept connection on TCP socket: `{e}`");
warn!("failed to accept connection on TCP socket: `{e}`");
continue;
}
};
@ -232,7 +232,7 @@ impl Listener {
);
tokio::spawn(async move {
if let Err(e) = handler.run().await {
log::error!("error handling client connection: `{e}`");
warn!("error handling client connection: `{e}`");
}
});
// return the permit
@ -274,7 +274,7 @@ impl Listener {
/*
SECURITY: Once again, ignore this error
*/
log::error!("failed to accept connection on TLS socket: `{e:#?}`");
warn!("failed to accept connection on TLS socket: `{e}`");
continue;
}
};
@ -286,7 +286,7 @@ impl Listener {
);
tokio::spawn(async move {
if let Err(e) = handler.run().await {
log::error!("error handling client TLS connection: `{e}`");
warn!("error handling client TLS connection: `{e}`");
}
});
}

@ -217,7 +217,7 @@ const SFQ_BOOL_FALSE: &[u8] = b"\x01\0";
const SFQ_BOOL_TRUE: &[u8] = b"\x01\x01";
const SFQ_UINT: &[u8] = b"\x0218446744073709551615\n";
const SFQ_SINT: &[u8] = b"\x03-9223372036854775808\n";
const SFQ_FLOAT: &[u8] = b"\x0411\n3.141592654";
const SFQ_FLOAT: &[u8] = b"\x043.141592654\n";
const SFQ_BINARY: &[u8] = "\x0546\ncringe😃😄😁😆😅😂🤣😊😸😺".as_bytes();
const SFQ_STRING: &[u8] = "\x0646\ncringe😃😄😁😆😅😂🤣😊😸😺".as_bytes();

@ -130,8 +130,10 @@ fn open_log(
log_name: &str,
db: &Database,
) -> RuntimeResult<JournalWriter<super::VirtualFS, DatabaseTxnAdapter>> {
journal::open_or_create_journal::<DatabaseTxnAdapter, super::VirtualFS, spec::TestFile>(log_name, db)
.map(|v| v.into_inner())
journal::open_or_create_journal::<DatabaseTxnAdapter, super::VirtualFS, spec::TestFile>(
log_name, db,
)
.map(|v| v.into_inner())
}
#[test]

@ -24,7 +24,6 @@
*
*/
use {
super::atm::{ORD_ACQ, ORD_REL, ORD_RLX},
std::{

Loading…
Cancel
Save