summaryrefslogtreecommitdiff
path: root/instrumentation
diff options
context:
space:
mode:
Diffstat (limited to 'instrumentation')
-rw-r--r--instrumentation/src/gateway.rs3
-rw-r--r--instrumentation/src/main.rs5
-rw-r--r--instrumentation/src/utils.rs14
3 files changed, 11 insertions, 11 deletions
diff --git a/instrumentation/src/gateway.rs b/instrumentation/src/gateway.rs
index 3f24dab..e783303 100644
--- a/instrumentation/src/gateway.rs
+++ b/instrumentation/src/gateway.rs
@@ -194,8 +194,7 @@ pub fn api(ctx: TestCtx) {
// Compression bomb
let mut compressor = Compressor::new(CompressionLvl::best());
- let mut compressed = Vec::new();
- compressed.resize(compressor.deflate_compress_bound(big_hello.len()), 0);
+ let mut compressed = vec![0u8; compressor.deflate_compress_bound(big_hello.len())];
let size = compressor
.deflate_compress(big_hello.as_bytes(), &mut compressed)
.unwrap();
diff --git a/instrumentation/src/main.rs b/instrumentation/src/main.rs
index 5990c12..f196d7d 100644
--- a/instrumentation/src/main.rs
+++ b/instrumentation/src/main.rs
@@ -87,11 +87,11 @@ pub fn main() {
build_bin(&p, name, Some("fail"), &format!("{name}-fail"));
}
p.finish_and_clear();
-
+
// Run tests
let m = MultiProgress::new();
let start_style =
- &ProgressStyle::with_template("{prefix:.magenta} {elapsed:.dim}").unwrap();
+ &ProgressStyle::with_template("{prefix:.magenta} {msg} {elapsed:.dim}").unwrap();
let ok_style =
&ProgressStyle::with_template("{prefix:.magenta} {msg:.green} {elapsed:.dim}")
.unwrap();
@@ -110,6 +110,7 @@ pub fn main() {
let pb = m.add(ProgressBar::new_spinner());
pb.set_style(start_style.clone());
pb.set_prefix(*name);
+ pb.set_message("RUN");
pb.enable_steady_tick(Duration::from_millis(1000));
let join = s.spawn(move || {
let start = Instant::now();
diff --git a/instrumentation/src/utils.rs b/instrumentation/src/utils.rs
index 158876b..835764a 100644
--- a/instrumentation/src/utils.rs
+++ b/instrumentation/src/utils.rs
@@ -20,7 +20,7 @@ use std::{
io::Write as _,
net::{Ipv4Addr, SocketAddrV4, TcpListener, TcpStream},
ops::{Deref, DerefMut},
- path::PathBuf,
+ path::{Path, PathBuf},
process::{Child, Command, Stdio},
str::FromStr,
sync::{Arc, Mutex},
@@ -194,7 +194,7 @@ pub fn retry_opt<T>(mut lambda: impl FnMut() -> Option<T>) -> T {
}
pub fn retry(mut lambda: impl FnMut() -> bool) {
- retry_opt(|| lambda().then(|| ()))
+ retry_opt(|| lambda().then_some(()))
}
#[derive(Clone)]
@@ -206,12 +206,12 @@ pub struct TestCtx {
impl TestCtx {
pub fn new(name: &str) -> Self {
// Create log dir
- let log_dir = format!("log/{name}").into();
+ let log_dir = format!("log/{name}");
std::fs::remove_dir_all(&log_dir).ok();
std::fs::create_dir_all(&log_dir).unwrap();
// Generate password
let pwd: String = (0..30).map(|_| fastrand::alphanumeric()).collect();
- std::env::set_var("PASSWORD", &pwd);
+ std::env::set_var("PASSWORD", pwd);
Self {
log_dir,
@@ -315,7 +315,7 @@ impl TalerCtx {
),
)
.unwrap();
- let db = TalerCtx::start_db(&db_dir, &ctx);
+ let db = TalerCtx::start_db(&db_dir, ctx);
retry(|| {
let mut psql = ChildGuard(
Command::new("psql")
@@ -325,7 +325,7 @@ impl TalerCtx {
std::fs::File::options()
.append(true)
.create(true)
- .open(&ctx.log("postgres"))
+ .open(ctx.log("postgres"))
.unwrap(),
)
.stdin(Stdio::piped())
@@ -430,7 +430,7 @@ impl TalerCtx {
/* ----- Database ----- */
- fn start_db(db_dir: &PathBuf, ctx: &TestCtx) -> ChildGuard {
+ fn start_db(db_dir: &Path, ctx: &TestCtx) -> ChildGuard {
cmd_redirect(
"postgres",
&["-D", db_dir.to_string_lossy().as_ref()],