-
Notifications
You must be signed in to change notification settings - Fork 11
test: add replay identity conformance case #676
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
Open
zhongkechen
wants to merge
4
commits into
main
Choose a base branch
from
test/conformance-general-11-1
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+101
−0
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
896a580
test: add replay identity conformance case
1a38e7e
Merge branch 'main' into test/conformance-general-11-1
zhongkechen df58d9e
Update conformance-tests/template_general.yaml
zhongkechen 9a13398
Merge branch 'main' into test/conformance-general-11-1
zhongkechen 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
34 changes: 34 additions & 0 deletions
34
conformance-tests/src/main/java/general/ReplayOperationIdentity.java
This file contains hidden or 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,34 @@ | ||
| // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
| package general; | ||
|
|
||
| import java.time.Duration; | ||
| import software.amazon.lambda.durable.DurableConfig; | ||
| import software.amazon.lambda.durable.DurableContext; | ||
| import software.amazon.lambda.durable.DurableHandler; | ||
| import software.amazon.lambda.durable.logging.LoggerConfig; | ||
|
|
||
| /** 11-1: Replay rejects an operation-type mismatch. */ | ||
| public class ReplayOperationIdentity extends DurableHandler<Object, String> { | ||
|
|
||
| @Override | ||
| protected DurableConfig createConfiguration() { | ||
| return DurableConfig.builder() | ||
| .withLoggerConfig(LoggerConfig.withReplayLogging()) | ||
| .build(); | ||
| } | ||
|
|
||
| @Override | ||
| public String handleRequest(Object input, DurableContext context) { | ||
| if (context.isReplaying()) { | ||
| context.getLogger().info("DETERMINISM_REPLAY_CANARY"); | ||
| return context.step("identity-slot", String.class, stepContext -> { | ||
| stepContext.getLogger().info("DETERMINISM_STEP_BODY_EXECUTED"); | ||
| return "unexpected"; | ||
| }); | ||
| } | ||
|
|
||
| context.wait("identity-slot", Duration.ofSeconds(1)); | ||
| return null; | ||
| } | ||
| } |
This file contains hidden or 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,67 @@ | ||
| AWSTemplateFormatVersion: '2010-09-09' | ||
| Transform: AWS::Serverless-2016-10-31 | ||
| Description: Durable Execution Conformance Test Examples - Java (General) | ||
|
|
||
| Parameters: | ||
| Architecture: | ||
| Type: String | ||
| Default: arm64 | ||
| Description: Lambda Function Architecture | ||
| AllowedValues: | ||
| - x86_64 | ||
| - arm64 | ||
| JavaVersion: | ||
| Type: String | ||
| Default: 'java21' | ||
| Description: Java runtime version | ||
|
|
||
| Globals: | ||
| Function: | ||
| Timeout: 60 | ||
| MemorySize: 512 | ||
| Runtime: | ||
| Ref: JavaVersion | ||
| Architectures: | ||
| - Ref: Architecture | ||
| LoggingConfig: | ||
| LogFormat: JSON | ||
|
|
||
| Resources: | ||
| DurableFunctionRole: | ||
| Type: AWS::IAM::Role | ||
| Properties: | ||
| AssumeRolePolicyDocument: | ||
| Version: '2012-10-17' | ||
| Statement: | ||
| - Effect: Allow | ||
| Principal: | ||
| Service: lambda.amazonaws.com | ||
| Action: sts:AssumeRole | ||
| ManagedPolicyArns: | ||
| - arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole | ||
| Policies: | ||
| - PolicyName: DurableExecutionPolicy | ||
| PolicyDocument: | ||
| Version: '2012-10-17' | ||
| Statement: | ||
| - Effect: Allow | ||
| Action: | ||
| - lambda:CheckpointDurableExecution | ||
| - lambda:GetDurableExecutionState | ||
| Resource: '*' | ||
|
|
||
| ReplayOperationIdentity: | ||
| Type: AWS::Serverless::Function | ||
| TestingMetadata: | ||
| TestDescription: ["11-1"] | ||
| Properties: | ||
| CodeUri: . | ||
| Handler: general.ReplayOperationIdentity | ||
| Description: Replay rejects an operation-type mismatch | ||
| Role: | ||
| Fn::GetAtt: | ||
| - DurableFunctionRole | ||
| - Arn | ||
| DurableConfig: | ||
| RetentionPeriodInDays: 7 | ||
| ExecutionTimeout: 300 | ||
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.
Uh oh!
There was an error while loading. Please reload this page.