-
Notifications
You must be signed in to change notification settings - Fork 18
Client ActivityType [Go] #179
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,6 +11,7 @@ use crate::protos::temporal::{ | |
| HandlerInvocation, RemoteActivityOptions, ReturnResultAction, SetPatchMarkerAction, | ||
| TestInput, TimerAction, UpsertMemoAction, UpsertSearchAttributesAction, WithStartClientAction, | ||
| WorkflowInput, WorkflowState, | ||
| execute_activity_action::{ClientActivity, PayloadActivity}, | ||
| }, | ||
| }; | ||
| use anyhow::Error; | ||
|
|
@@ -581,13 +582,28 @@ impl<'a> Arbitrary<'a> for ExecuteActivityAction { | |
| } else { | ||
| execute_activity_action::Locality::IsLocal(()) | ||
| }; | ||
| let delay = u.int_in_range(0..=1_000)?; | ||
|
|
||
| let activity_type_choice = u.int_in_range(1..=100)?; | ||
| let activity_type = match activity_type_choice { | ||
| 1..=85 => { | ||
| let delay = u.int_in_range(0..=1_000)?; | ||
| execute_activity_action::ActivityType::Delay( | ||
| Duration::from_millis(delay) | ||
| .try_into() | ||
| .expect("proto duration works"), | ||
| ) | ||
| } | ||
| 86..=90 => { | ||
| execute_activity_action::ActivityType::Payload(u.arbitrary()?) | ||
| } | ||
| 91..=100 => { | ||
| execute_activity_action::ActivityType::Client(u.arbitrary()?) | ||
| } | ||
| _ => unreachable!(), | ||
| }; | ||
|
|
||
| Ok(Self { | ||
| activity_type: Some(execute_activity_action::ActivityType::Delay( | ||
| Duration::from_millis(delay) | ||
| .try_into() | ||
| .expect("proto duration works"), | ||
| )), | ||
| activity_type: Some(activity_type), | ||
| start_to_close_timeout: Some(Duration::from_secs(5).try_into().unwrap()), | ||
| locality: Some(locality), | ||
| awaitable_choice: Some(u.arbitrary()?), | ||
|
|
@@ -691,6 +707,36 @@ impl<'a> Arbitrary<'a> for UpsertSearchAttributesAction { | |
| } | ||
| } | ||
|
|
||
| impl<'a> Arbitrary<'a> for ClientActivity { | ||
| fn arbitrary(u: &mut Unstructured<'a>) -> arbitrary::Result<Self> { | ||
| let client_sequence = ClientSequence { | ||
| action_sets: vec![ClientActionSet { | ||
| actions: vec![u.arbitrary()?], | ||
| concurrent: false, | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should this be allowed to be true? Seemingly the support is already there?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The support for Go is there but the support for the other SDKs isn't there yet. #188 will only add support for non-current client activity there. |
||
| wait_at_end: None, | ||
| wait_for_current_run_to_finish_at_end: false, | ||
| }], | ||
| }; | ||
|
|
||
| Ok(Self { | ||
| client_sequence: Some(client_sequence), | ||
| }) | ||
| } | ||
| } | ||
|
|
||
|
|
||
| impl<'a> Arbitrary<'a> for PayloadActivity { | ||
| fn arbitrary(u: &mut Unstructured<'a>) -> arbitrary::Result<Self> { | ||
| let max_payload_size = ARB_CONTEXT.with_borrow(|c| c.config.max_payload_size) as i32; | ||
|
|
||
| Ok(Self { | ||
| bytes_to_receive: u.int_in_range(0..=max_payload_size)?, | ||
| bytes_to_return: u.int_in_range(0..=max_payload_size)?, | ||
| }) | ||
| } | ||
| } | ||
|
|
||
|
|
||
| impl<'a> Arbitrary<'a> for RemoteActivityOptions { | ||
| fn arbitrary(u: &mut Unstructured<'a>) -> arbitrary::Result<Self> { | ||
| Ok(RemoteActivityOptions { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Including the new client activity.