Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/init/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ async fn main() {
);

const START_PORT: u32 = 3;
const INITIAL_POOL_SIZE: u32 = 1; // start at pool size 1, grow based on manifest/args as necessary (see Reaper)
const INITIAL_POOL_SIZE: u8 = 1; // start at pool size 1, grow based on manifest/args as necessary (see Reaper)
let core_pool = StreamPool::new(
SocketAddress::new_vsock(cid, START_PORT, VMADDR_NO_FLAGS),
INITIAL_POOL_SIZE,
Expand Down
9 changes: 9 additions & 0 deletions src/integration/src/bin/pivot_pool_size.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
use integration::PIVOT_POOL_SIZE_SUCCESS_FILE;

fn main() {
if std::env::var("POOL_SIZE").is_err() {
panic!("invalid pool size specified")
}

integration::Cli::execute(PIVOT_POOL_SIZE_SUCCESS_FILE);
}
8 changes: 6 additions & 2 deletions src/integration/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use std::time::Duration;
use borsh::{BorshDeserialize, BorshSerialize};
use qos_core::{
client::SocketClient,
io::{SocketAddress, StreamPool, TimeVal, TimeValLike},
io::{SocketAddress, StreamPool},
parser::{GetParserForOptions, OptionsParser, Parser, Token},
};

Expand All @@ -19,12 +19,16 @@ pub const PIVOT_OK_SUCCESS_FILE: &str = "./pivot_ok_works";
pub const PIVOT_OK2_SUCCESS_FILE: &str = "./pivot_ok2_works";
/// Path to the file `pivot_ok3` writes on success for tests.
pub const PIVOT_OK3_SUCCESS_FILE: &str = "./pivot_ok3_works";
/// Path to the file `pivot_pool_size` writes on success for tests.
pub const PIVOT_POOL_SIZE_SUCCESS_FILE: &str = "./pivot_pool_size_works";
/// Path to pivot_ok bin for tests.
pub const PIVOT_OK_PATH: &str = "../target/debug/pivot_ok";
/// Path to pivot_ok2 bin for tests.
pub const PIVOT_OK2_PATH: &str = "../target/debug/pivot_ok2";
/// Path to pivot_ok3 bin for tests.
pub const PIVOT_OK3_PATH: &str = "../target/debug/pivot_ok3";
/// Path to pivot_pool_size bin for tests.
pub const PIVOT_POOL_SIZE_PATH: &str = "../target/debug/pivot_pool_size";
/// Path to pivot loop bin for tests.
pub const PIVOT_LOOP_PATH: &str = "../target/debug/pivot_loop";
/// Path to pivot_abort bin for tests.
Expand Down Expand Up @@ -132,7 +136,7 @@ pub struct AdditionProofPayload {
pub async fn wait_for_usock(path: &str) {
let addr = SocketAddress::new_unix(path);
let pool = StreamPool::new(addr, 1).unwrap().shared();
let client = SocketClient::new(pool, TimeVal::milliseconds(50));
let client = SocketClient::new(pool, Duration::from_millis(50));

for _ in 0..50 {
if std::fs::exists(path).unwrap() && client.try_connect().await.is_ok()
Expand Down
10 changes: 5 additions & 5 deletions src/integration/tests/client.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use std::sync::Arc;
use std::{sync::Arc, time::Duration};

use qos_core::{
client::SocketClient,
io::{SocketAddress, StreamPool, TimeVal, TimeValLike},
io::{SocketAddress, StreamPool},
server::SocketServerError,
server::{RequestProcessor, SocketServer},
};
Expand Down Expand Up @@ -37,7 +37,7 @@ async fn run_echo_server(
async fn direct_connect_works() {
let socket_path = "/tmp/async_client_test_direct_connect_works.sock";
let socket = SocketAddress::new_unix(socket_path);
let timeout = TimeVal::milliseconds(500);
let timeout = Duration::from_millis(500);
let pool = StreamPool::new(socket, 1)
.expect("unable to create async pool")
.shared();
Expand All @@ -54,7 +54,7 @@ async fn direct_connect_works() {
async fn times_out_properly() {
let socket_path = "/tmp/async_client_test_times_out_properly.sock";
let socket = SocketAddress::new_unix(socket_path);
let timeout = TimeVal::milliseconds(500);
let timeout = Duration::from_millis(500);
let pool = StreamPool::new(socket, 1)
.expect("unable to create async pool")
.shared();
Expand All @@ -68,7 +68,7 @@ async fn times_out_properly() {
async fn repeat_connect_works() {
let socket_path = "/tmp/async_client_test_repeat_connect_works.sock";
let socket = SocketAddress::new_unix(socket_path);
let timeout = TimeVal::milliseconds(500);
let timeout = Duration::from_millis(500);
let pool = StreamPool::new(socket, 1)
.expect("unable to create async pool")
.shared();
Expand Down
6 changes: 3 additions & 3 deletions src/integration/tests/enclave_app_client_socket_stress.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ use integration::{
use qos_core::{
client::SocketClient,
handles::Handles,
io::{SocketAddress, StreamPool, TimeVal, TimeValLike},
io::{SocketAddress, StreamPool},
protocol::{
msg::ProtocolMsg,
services::boot::{
Manifest, ManifestEnvelope, ManifestSet, Namespace, NitroConfig,
PivotConfig, RestartPolicy, ShareSet,
},
ProtocolError, ProtocolPhase, ENCLAVE_APP_SOCKET_CLIENT_TIMEOUT_SECS,
ProtocolError, ProtocolPhase, INITIAL_CLIENT_TIMEOUT,
},
reaper::{Reaper, REAPER_RESTART_DELAY},
};
Expand Down Expand Up @@ -103,7 +103,7 @@ async fn enclave_app_client_socket_stress() {
StreamPool::single(SocketAddress::new_unix(ENCLAVE_SOCK)).unwrap();
let enclave_client = SocketClient::new(
enclave_client_pool.shared(),
TimeVal::seconds(ENCLAVE_APP_SOCKET_CLIENT_TIMEOUT_SECS + 3), // needs to be bigger than the slow request below + some time for recovery
INITIAL_CLIENT_TIMEOUT + Duration::from_secs(3), // needs to be bigger than the slow request below + some time for recovery
);

let app_request =
Expand Down
8 changes: 4 additions & 4 deletions src/integration/tests/interleaving_socket_stress.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ use integration::{
};
use qos_core::{
client::{ClientError, SocketClient},
io::{SocketAddress, StreamPool, TimeVal, TimeValLike},
protocol::ENCLAVE_APP_SOCKET_CLIENT_TIMEOUT_SECS,
io::{SocketAddress, StreamPool},
protocol::INITIAL_CLIENT_TIMEOUT,
};
use qos_test_primitives::ChildWrapper;

Expand All @@ -27,12 +27,12 @@ async fn interleaving_socket_stress() {
wait_for_usock(SOCKET_STRESS_SOCK).await;

// needs to be long enough for process exit to register and not cause a timeout
let timeout = TimeVal::seconds(ENCLAVE_APP_SOCKET_CLIENT_TIMEOUT_SECS);
let app_pool =
StreamPool::new(SocketAddress::new_unix(SOCKET_STRESS_SOCK), pool_size)
.unwrap();

let enclave_client = SocketClient::new(app_pool.shared(), timeout);
let enclave_client =
SocketClient::new(app_pool.shared(), INITIAL_CLIENT_TIMEOUT);
let mut tasks = Vec::new();

// wait long enough for app to be running and listening
Expand Down
10 changes: 4 additions & 6 deletions src/integration/tests/proofs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ use borsh::BorshDeserialize;
use integration::{wait_for_usock, PivotProofMsg, PIVOT_PROOF_PATH};
use qos_core::{
client::SocketClient,
io::{SocketAddress, StreamPool, TimeVal, TimeValLike},
protocol::ENCLAVE_APP_SOCKET_CLIENT_TIMEOUT_SECS,
io::{SocketAddress, StreamPool},
protocol::INITIAL_CLIENT_TIMEOUT,
};

use qos_p256::P256Public;
Expand All @@ -27,10 +27,8 @@ async fn fetch_and_verify_app_proof() {
StreamPool::single(SocketAddress::new_unix(PROOF_TEST_ENCLAVE_SOCKET))
.unwrap();

let enclave_client = SocketClient::new(
enclave_pool.shared(),
TimeVal::seconds(ENCLAVE_APP_SOCKET_CLIENT_TIMEOUT_SECS),
);
let enclave_client =
SocketClient::new(enclave_pool.shared(), INITIAL_CLIENT_TIMEOUT);

let app_request =
borsh::to_vec(&PivotProofMsg::AdditionRequest { a: 2, b: 2 }).unwrap();
Expand Down
Loading