Skip to content

Commit 0092595

Browse files
committed
Fix flaky shutdown test
1 parent 87162f5 commit 0092595

1 file changed

Lines changed: 17 additions & 6 deletions

File tree

  • crates/sdk-core/tests/shared_tests

crates/sdk-core/tests/shared_tests/mod.rs

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,15 @@ use temporalio_client::{
1414
use temporalio_common::{
1515
UntypedWorkflow,
1616
protos::temporal::api::{
17-
enums::v1::{EventType, WorkflowTaskFailedCause::GrpcMessageTooLarge},
18-
history::v1::history_event::Attributes::{
19-
WorkflowExecutionTerminatedEventAttributes, WorkflowTaskFailedEventAttributes,
17+
enums::v1::{
18+
EventType,
19+
WorkflowTaskFailedCause::{self, GrpcMessageTooLarge},
20+
},
21+
history::v1::history_event::{
22+
self,
23+
Attributes::{
24+
WorkflowExecutionTerminatedEventAttributes, WorkflowTaskFailedEventAttributes,
25+
},
2026
},
2127
},
2228
worker::WorkerTaskTypes,
@@ -197,9 +203,14 @@ pub(crate) async fn shutdown_during_active_timer_activity_workflows() {
197203
let bad_events: Vec<_> = history
198204
.events()
199205
.iter()
200-
.filter(|e| {
201-
e.event_type() == EventType::WorkflowTaskFailed
202-
|| e.event_type() == EventType::WorkflowTaskTimedOut
206+
.filter(|e| match &e.attributes {
207+
Some(history_event::Attributes::WorkflowTaskFailedEventAttributes(f))
208+
if f.cause() != WorkflowTaskFailedCause::ForceCloseCommand =>
209+
{
210+
true
211+
}
212+
Some(history_event::Attributes::WorkflowTaskTimedOutEventAttributes(_)) => true,
213+
_ => false,
203214
})
204215
.collect();
205216
assert!(

0 commit comments

Comments
 (0)