-
Notifications
You must be signed in to change notification settings - Fork 55
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
Fix continueAsNew with large snapshot(>4MB) #482
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
10b9a6b
Fix continueAsNew with large snapshot
longquanzheng e27f5d8
try fix cadence
longquanzheng e1cd041
try fix cadence
longquanzheng 2666c02
cadence
longquanzheng 0f585d8
cadence
longquanzheng 288df02
add back cadence test
longquanzheng 4cc8d4d
remove
longquanzheng a51ad7a
remove
longquanzheng 00258f8
minor
longquanzheng 1e52a4e
done
longquanzheng 99424a5
revert sh
longquanzheng 5e066b5
minor improvements
longquanzheng a670a39
add sleep to test
longquanzheng File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
26 changes: 0 additions & 26 deletions
26
.github/workflows/ci-cadence-integ-test-disable-sticky.yml
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
package integ | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
"github.com/indeedeng/iwf/gen/iwfidl" | ||
"github.com/indeedeng/iwf/integ/workflow/signal" | ||
"github.com/indeedeng/iwf/service" | ||
"github.com/indeedeng/iwf/service/common/ptr" | ||
"github.com/stretchr/testify/assert" | ||
"net/http" | ||
"strconv" | ||
"strings" | ||
"testing" | ||
"time" | ||
) | ||
|
||
func TestLargeDataAttributesTemporalContinueAsNew(t *testing.T) { | ||
if !*temporalIntegTest { | ||
t.Skip() | ||
} | ||
for i := 0; i < *repeatIntegTest; i++ { | ||
doTestLargeQueryAttributes(t, service.BackendTypeTemporal, minimumContinueAsNewConfigV0()) | ||
smallWaitForFastTest() | ||
} | ||
} | ||
|
||
func doTestLargeQueryAttributes(t *testing.T, backendType service.BackendType, config *iwfidl.WorkflowConfig) { | ||
if !*temporalIntegTest { | ||
t.Skip() | ||
} | ||
assertions := assert.New(t) | ||
|
||
// start test workflow server | ||
wfHandler := signal.NewHandler() | ||
closeFunc1 := startWorkflowWorker(wfHandler) | ||
defer closeFunc1() | ||
|
||
_, closeFunc2 := startIwfServiceWithClient(backendType) | ||
defer closeFunc2() | ||
|
||
wfId := signal.WorkflowType + strconv.Itoa(int(time.Now().UnixNano())) | ||
|
||
// start a workflow | ||
apiClient := iwfidl.NewAPIClient(&iwfidl.Configuration{ | ||
Servers: []iwfidl.ServerConfiguration{ | ||
{ | ||
URL: "http://localhost:" + testIwfServerPort, | ||
}, | ||
}, | ||
}) | ||
req := apiClient.DefaultApi.ApiV1WorkflowStartPost(context.Background()) | ||
_, httpResp, err := req.WorkflowStartRequest(iwfidl.WorkflowStartRequest{ | ||
WorkflowId: wfId, | ||
IwfWorkflowType: signal.WorkflowType, | ||
WorkflowTimeoutSeconds: 86400, | ||
IwfWorkerUrl: "http://localhost:" + testWorkflowServerPort, | ||
StartStateId: ptr.Any(signal.State1), | ||
// this is necessary for large DAs | ||
// otherwise the workflow task will fail when trying to execute a stateAPI with data attributes >4MB | ||
StateOptions: &signal.StateOptionsForLargeDataAttributes, | ||
WorkflowStartOptions: &iwfidl.WorkflowStartOptions{ | ||
WorkflowConfigOverride: config, | ||
}, | ||
}).Execute() | ||
panicAtHttpError(err, httpResp) | ||
|
||
assertions.Equal(httpResp.StatusCode, http.StatusOK) | ||
|
||
// Define the size of the string in bytes (1 MB = 1024 * 1024 bytes) | ||
const size = 1024 * 1024 | ||
|
||
OneMbDataObject := iwfidl.EncodedObject{ | ||
Encoding: iwfidl.PtrString("json"), | ||
Data: iwfidl.PtrString(strings.Repeat("a", size)), | ||
} | ||
|
||
// setting a large data object to test, especially continueAsNew | ||
// because there is a 4MB limit for GRPC in temporal | ||
setReq := apiClient.DefaultApi.ApiV1WorkflowDataobjectsSetPost(context.Background()) | ||
for i := 0; i < 5; i++ { | ||
|
||
httpResp2, err := setReq.WorkflowSetDataObjectsRequest(iwfidl.WorkflowSetDataObjectsRequest{ | ||
WorkflowId: wfId, | ||
Objects: []iwfidl.KeyValue{ | ||
{ | ||
Key: iwfidl.PtrString("large-data-object-" + strconv.Itoa(i)), | ||
Value: &OneMbDataObject, | ||
}, | ||
}, | ||
}).Execute() | ||
|
||
panicAtHttpError(err, httpResp2) | ||
} | ||
|
||
// signal the workflow to complete | ||
for i := 0; i < 4; i++ { | ||
signalVal := iwfidl.EncodedObject{ | ||
Encoding: iwfidl.PtrString("json"), | ||
Data: iwfidl.PtrString(fmt.Sprintf("test-data-%v", i)), | ||
} | ||
|
||
req2 := apiClient.DefaultApi.ApiV1WorkflowSignalPost(context.Background()) | ||
httpResp2, err := req2.WorkflowSignalRequest(iwfidl.WorkflowSignalRequest{ | ||
WorkflowId: wfId, | ||
SignalChannelName: signal.SignalName, | ||
SignalValue: &signalVal, | ||
}).Execute() | ||
|
||
panicAtHttpError(err, httpResp2) | ||
} | ||
|
||
// wait for the workflow | ||
reqWait := apiClient.DefaultApi.ApiV1WorkflowGetWithWaitPost(context.Background()) | ||
_, httpResp, err = reqWait.WorkflowGetRequest(iwfidl.WorkflowGetRequest{ | ||
WorkflowId: wfId, | ||
}).Execute() | ||
panicAtHttpError(err, httpResp) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Nit: Wouldn't it be better to create a handler class for this specific test?
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.
I feel like using the existing is better. The test only need a workflow to do nothing, so that we can set some large DAs. The existing signal workflow is exactly like that. I would just copy the code if so.