Skip to content

Conversation

sebsto
Copy link
Collaborator

@sebsto sebsto commented Jul 7, 2025

  • Add a test on LambdaRuntime for cancellable.
  • Move the service life cycle test to its own file

@sebsto sebsto requested a review from adam-fowler July 7, 2025 10:11
@sebsto sebsto self-assigned this Jul 7, 2025
@sebsto sebsto added the semver/none No version bump required. label Jul 7, 2025
@sebsto sebsto changed the title Add a test for cancellable [test] Add a test for cancellable Jul 7, 2025
}

// wait a small amount to ensure runtime1 task is started
try await Task.sleep(for: .seconds(0.5))
Copy link
Contributor

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?

Copy link
Collaborator Author

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.

@sebsto sebsto merged commit db7e789 into awslabs:main Jul 21, 2025
@sebsto sebsto deleted the sebsto/test-cancellable branch July 21, 2025 18:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

semver/none No version bump required.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants