Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[wip]chore: fix cucumber test #6087

Open
wants to merge 5 commits into
base: development
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
19 changes: 11 additions & 8 deletions integration_tests/tests/cucumber.rs
Expand Up @@ -41,14 +41,17 @@ pub mod steps;
pub const LOG_TARGET: &str = "cucumber";
pub const LOG_TARGET_STDOUT: &str = "stdout";

fn flush_stdout(buffer: &Arc<Mutex<Vec<u8>>>) {
fn try_flush_stdout(buffer: &Arc<Mutex<Vec<u8>>>) {
// After each test we flush the stdout to the logs.
info!(
target: LOG_TARGET_STDOUT,
"{}",
str::from_utf8(&buffer.lock().unwrap()).unwrap()
);
buffer.lock().unwrap().clear();
let mut lock = buffer.try_lock();
if let Ok(ref mut mutex) = lock {
info!(
target: LOG_TARGET_STDOUT,
"{}",
str::from_utf8(&mutex).unwrap()
);
mutex.clear();
}
}

fn main() {
Expand Down Expand Up @@ -78,7 +81,7 @@ fn main() {
.after(move |_feature, _rule, scenario, ev, maybe_world| {
let stdout_buffer = stdout_buffer_clone.clone();
Box::pin(async move {
flush_stdout(&stdout_buffer);
try_flush_stdout(&stdout_buffer);
match ev {
ScenarioFinished::StepFailed(_capture_locations, _location, _error) => {
error!(target: LOG_TARGET, "Scenario failed");
Expand Down