Skip to content

Commit

Permalink
stabilize tests for colima
Browse files Browse the repository at this point in the history
  • Loading branch information
jondot committed May 12, 2024
1 parent 68be79c commit 4e2a905
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 4 deletions.
5 changes: 4 additions & 1 deletion teller-cli/tests/flow_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ fn build_providers() -> Test {
#[test]
#[cfg(not(windows))]
fn providers_smoke_test() {
use std::env;
use std::{env, time::Duration};

if env::var("RUNNER_OS").unwrap_or_default() == "macOS" {
return;
Expand All @@ -58,6 +58,9 @@ fn providers_smoke_test() {
let user = "linus";
let password = "torvalds123";
let vault_server: VaultServer = instance.server();
// banner is not enough for vault, we have to wait for the image to stabilize
tokio::time::sleep(Duration::from_secs(2)).await;

let localstack_server: LocalStackServer = instance.server();

fs::write(
Expand Down
5 changes: 5 additions & 0 deletions teller-providers/src/providers/hashicorp_consul.rs
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,8 @@ mod tests {
#[test]
#[cfg(not(windows))]
fn sanity_test() {
use std::time::Duration;

if env::var("RUNNER_OS").unwrap_or_default() == "macOS" {
return;
}
Expand All @@ -304,6 +306,9 @@ mod tests {
"address": server.external_url(),
});

// banner is not enough, we have to wait for the image to stabilize
tokio::time::sleep(Duration::from_secs(2)).await;

let p = Box::new(
super::HashiCorpConsul::new(
"hashicorp_consul",
Expand Down
9 changes: 6 additions & 3 deletions teller-providers/src/providers/hashicorp_vault.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ fn parse_path(pm: &PathMap) -> Result<(&str, &str, &str)> {
}

fn xerr(pm: &PathMap, e: ClientError) -> Error {
println!("{e:?}");
match e {
ClientError::RestClientError { source } => match source {
rustify::errors::ClientError::ServerResponseError { code, content } => {
Expand Down Expand Up @@ -275,17 +276,16 @@ mod tests {
use super::*;
use crate::providers::test_utils;

const PORT: u32 = 9200;

#[test]
#[cfg(not(windows))]
fn sanity_test() {
use std::time::Duration;

if env::var("RUNNER_OS").unwrap_or_default() == "macOS" {
return;
}

let config = VaultServerConfig::builder()
.port(PORT)
.version("1.8.2".into())
.build()
.unwrap();
Expand All @@ -300,6 +300,9 @@ mod tests {
"token": server.token
});

// banner is not enough, we have to wait for the image to stabilize
tokio::time::sleep(Duration::from_secs(2)).await;

let p = Box::new(
super::Hashivault::new(
"hashicorp_vault",
Expand Down
1 change: 1 addition & 0 deletions teller-providers/src/providers/test_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ impl ProviderTest {
for (root_path, keys) in path_tree {
let path_map = PathMap::from_path(&self.get_key_path(root_path));
let res = self.provider.as_ref().put(&path_map, keys).await;
println!("{res:?}");
assert!(res.is_ok());
assert_debug_snapshot!(format!("[put-{}]", root_path.replace('/', "_"),), res);
}
Expand Down

0 comments on commit 4e2a905

Please sign in to comment.