Skip to content

Commit

Permalink
Update mock-mount-s3 to require '--max-throughput-gbps' argument (#1018)
Browse files Browse the repository at this point in the history
* Update mock-mount-s3 to require '--max-throughput-gbps' argument

Signed-off-by: Daniel Carl Jones <[email protected]>

* Fix error message

Signed-off-by: Daniel Carl Jones <[email protected]>

---------

Signed-off-by: Daniel Carl Jones <[email protected]>
  • Loading branch information
dannycjones authored Sep 24, 2024
1 parent 9040066 commit ed8d96b
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions mountpoint-s3/src/bin/mock-mount-s3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
//!
//! This binary is intended only for use in testing and development of Mountpoint.

use anyhow::anyhow;
use futures::executor::ThreadPool;

use mountpoint_s3::cli::CliArgs;
use mountpoint_s3::s3::S3Personality;
use mountpoint_s3_client::mock_client::throughput_client::ThroughputMockClient;
Expand All @@ -32,7 +34,11 @@ fn create_mock_client(args: &CliArgs) -> anyhow::Result<(ThroughputMockClient, T

tracing::warn!("using mock client");

let max_throughput_gbps = args.maximum_throughput_gbps.unwrap_or(10) as f64;
let Some(max_throughput_gbps) = args.maximum_throughput_gbps else {
return Err(anyhow!(
"must set --maximum-throughput-gbps when using mock-mount-s3 binary"
));
};
tracing::info!("mock client target network throughput {max_throughput_gbps} Gbps");

let config = MockClientConfig {
Expand All @@ -42,7 +48,7 @@ fn create_mock_client(args: &CliArgs) -> anyhow::Result<(ThroughputMockClient, T
enable_backpressure: true,
initial_read_window_size: 1024 * 1024 + 128 * 1024, // matching real MP
};
let client = ThroughputMockClient::new(config, max_throughput_gbps);
let client = ThroughputMockClient::new(config, max_throughput_gbps as f64);

let runtime = ThreadPool::builder().name_prefix("runtime").create()?;

Expand Down

0 comments on commit ed8d96b

Please sign in to comment.