Skip to content

Commit

Permalink
Extend timeouts for test reliability (#919)
Browse files Browse the repository at this point in the history
* Extend timeouts for test reliability

The tests in this PR fail occasionally in CI test runs and then pass on re-run. I'm extending the timeouts in the hopes this will result in more stability.

* Extend timeouts for test reliability

The tests in this PR fail occasionally in CI test runs and then pass on re-run. I'm extending the timeouts in the hopes this will result in more stability.
  • Loading branch information
colincasey authored Sep 4, 2024
1 parent fc2db89 commit c17411a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
2 changes: 1 addition & 1 deletion buildpacks/nodejs-engine/tests/integration_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use test_support::{
set_node_engine, wait_for, PORT,
};

const APPLICATION_STARTUP_TIMEOUT: Duration = Duration::from_secs(5);
const APPLICATION_STARTUP_TIMEOUT: Duration = Duration::from_secs(10);
const METRICS_SEND_INTERVAL: Duration = Duration::from_secs(10);
const METRICS_SEND_TIMEOUT: Duration = Duration::from_secs(15);

Expand Down
24 changes: 19 additions & 5 deletions buildpacks/nodejs-function-invoker/tests/integration_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,14 @@ use base64::Engine;
use libcnb_test::{assert_contains, assert_not_contains, TestContext};
use rand::RngCore;
use std::net::SocketAddr;
use std::time::Duration;
use test_support::{
function_integration_test, retry, start_container, DEFAULT_RETRIES, DEFAULT_RETRY_DELAY,
function_integration_test, retry, start_container, wait_for, DEFAULT_RETRIES,
DEFAULT_RETRY_DELAY,
};

const FUNCTION_LOGGING_TIMEOUT: Duration = Duration::from_secs(5);

#[test]
#[ignore]
fn simple_javascript_function() {
Expand All @@ -21,8 +25,13 @@ fn simple_javascript_function() {
let payload = serde_json::json!({});
let result = invoke_function(socket_addr, &payload);
assert_eq!(result, serde_json::Value::String("hello world".to_string()));
let container_logs = container.logs_now();
assert_contains!(container_logs.stdout, "logging info is a fun 1");
wait_for(
|| {
let container_logs = container.logs_now();
assert_contains!(container_logs.stdout, "logging info is a fun 1");
},
FUNCTION_LOGGING_TIMEOUT,
);
});
});
}
Expand Down Expand Up @@ -107,8 +116,13 @@ fn function_with_no_lockfile() {
let payload = serde_json::json!({});
let result = invoke_function(socket_addr, &payload);
assert_eq!(result, serde_json::Value::String("hello world".to_string()));
let container_logs = container.logs_now();
assert_contains!(container_logs.stdout, "logging info is a fun 1");
wait_for(
|| {
let container_logs = container.logs_now();
assert_contains!(container_logs.stdout, "logging info is a fun 1");
},
FUNCTION_LOGGING_TIMEOUT,
);
});
});
}
Expand Down

0 comments on commit c17411a

Please sign in to comment.