Skip to content

Commit

Permalink
fix multiple task unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
ss-es committed May 22, 2024
1 parent 9b655ed commit 94dbb5a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
14 changes: 10 additions & 4 deletions crates/macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,9 @@ pub fn test_scripts(input: proc_macro::TokenStream) -> TokenStream {
while let Ok(input) = loop_receiver.try_recv() {
#(
tracing::debug!("Test sent: {:?}", input);


// If this particular script has been marked as completed,
// we completely skip re-broadcasting events.
if #script_completed_names {
continue;
}
Expand All @@ -402,17 +404,21 @@ pub fn test_scripts(input: proc_macro::TokenStream) -> TokenStream {
let output_asserts = &mut #task_expectations[stage_number].output_asserts;

if #output_index_names >= output_asserts.len() {
// If we've seen all output events without a panic,
// we mark the script as completed and ignore further events.
if #scripts.ignore_trailing {
#script_completed_names = true;
break;
} else {
panic_extra_output_in_script(stage_number, #script_names.to_string(), &received_output);
}
};

if #output_index_names < output_asserts.len() {
let mut assert = &mut output_asserts[#output_index_names];

let mut assert = &mut output_asserts[#output_index_names];

validate_output_or_panic_in_script(stage_number, #script_names.to_string(), &received_output, &**assert).await;
validate_output_or_panic_in_script(stage_number, #script_names.to_string(), &received_output, &**assert).await;
}

#output_index_names += 1;
}
Expand Down
2 changes: 1 addition & 1 deletion crates/testing/src/script.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use hotshot_types::traits::node_implementation::NodeType;

use crate::predicates::{Predicate, PredicateResult};

pub const RECV_TIMEOUT: Duration = Duration::from_millis(250);
pub const RECV_TIMEOUT: Duration = Duration::from_millis(100);

pub struct TestScriptStage<TYPES: NodeType, S: TaskState<Event = HotShotEvent<TYPES>>> {
pub inputs: Vec<HotShotEvent<TYPES>>,
Expand Down

0 comments on commit 94dbb5a

Please sign in to comment.