Skip to content

Commit

Permalink
fix: test is sync and send
Browse files Browse the repository at this point in the history
  • Loading branch information
veeso committed Oct 26, 2024
1 parent d045763 commit 9af4143
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 0 deletions.
30 changes: 30 additions & 0 deletions src/kube_container_fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1690,6 +1690,36 @@ mod test {
.is_err());
}

fn is_send<T: Send>(_send: T) {}

fn is_sync<T: Sync>(_sync: T) {}

#[test]
fn test_should_be_sync() {
let runtime = Arc::new(
tokio::runtime::Builder::new_current_thread()
.enable_all()
.build()
.unwrap(),
);
let client = KubeContainerFs::new("pod", "alpine", &runtime);

is_sync(client);
}

#[test]
fn test_should_be_send() {
let runtime = Arc::new(
tokio::runtime::Builder::new_current_thread()
.enable_all()
.build()
.unwrap(),
);
let client = KubeContainerFs::new("pod", "alpine", &runtime);

is_send(client);
}

// -- test utils

#[cfg(feature = "integration-tests")]
Expand Down
30 changes: 30 additions & 0 deletions src/kube_multipod_fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1404,6 +1404,36 @@ mod test {
finalize_client(api, client);
}

fn is_send<T: Send>(_send: T) {}

fn is_sync<T: Sync>(_sync: T) {}

#[test]
fn test_should_be_sync() {
let runtime = Arc::new(
tokio::runtime::Builder::new_current_thread()
.enable_all()
.build()
.unwrap(),
);
let client = KubeMultiPodFs::new(&runtime);

is_sync(client);
}

#[test]
fn test_should_be_send() {
let runtime = Arc::new(
tokio::runtime::Builder::new_current_thread()
.enable_all()
.build()
.unwrap(),
);
let client = KubeMultiPodFs::new(&runtime);

is_send(client);
}

#[cfg(feature = "integration-tests")]
fn setup_client() -> (Api<Pod>, KubeMultiPodFs) {
crate::log_init();
Expand Down

0 comments on commit 9af4143

Please sign in to comment.