-
Notifications
You must be signed in to change notification settings - Fork 114
[test] Add a test for cancellable #529
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
base: main
Are you sure you want to change the base?
Conversation
@@ -50,17 +50,24 @@ struct LambdaRuntimeTests { | |||
} | |||
|
|||
// wait a small amount to ensure runtime1 task is started | |||
try await Task.sleep(for: .seconds(0.5)) |
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.
When I run all the tests in parallel this test fails quite regularly as the second task gets run before the first. I don't think you can rely on a sleep to ensure the two tasks are run in order. Maybe you should care which order they run in, just that one throws a LambdaRuntimeError
. Do the error check before the taskGroup.next()
await #expect(throws: LambdaRuntimeError.self) {
try await taskGroup.next()
}
I'm pretty sure you can get rid of the test that you can run the second runtime after the failure. Is it really valid to have two separate runtimes, run in the the same lambda?
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.
Thank you for the suggestion. Fixed now.
LambdaRuntime
for cancellable.