-
Notifications
You must be signed in to change notification settings - Fork 483
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: fix unit and integ tests hanging #1954
Conversation
@@ -21,7 +21,7 @@ public async Task RouteNotFound(ApiGatewayEmulatorMode mode, HttpStatusCode stat | |||
// Arrange | |||
var cancellationSource = new CancellationTokenSource(); | |||
cancellationSource.CancelAfter(5000); | |||
var settings = new RunCommandSettings { ApiGatewayEmulatorPort = 9003, ApiGatewayEmulatorMode = mode, NoLaunchWindow = true}; | |||
var settings = new RunCommandSettings { ApiGatewayEmulatorPort = 9004, ApiGatewayEmulatorMode = mode, NoLaunchWindow = true}; |
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.
one other idea for the ports is that we can automatically find any open ports and use those. not sure if thats related to your issue or not though
6643b4e
to
bffb72a
Compare
Tools/LambdaTestTool-v2/tests/Amazon.Lambda.TestTool.UnitTests/PackagingTests.cs
Show resolved
Hide resolved
@@ -44,8 +44,10 @@ private string GetRuntimeSupportTargetFrameworks() | |||
process.Start(); | |||
var output = process.StandardOutput.ReadToEnd(); | |||
var error = process.StandardError.ReadToEnd(); | |||
process.WaitForExit(); | |||
process.WaitForExit(int.MaxValue); |
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.
same here
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.
The int.MaxValue is used to workaround a microsoft bug. We don't actually intend to wait that long. We use it in other repos. Sometimes the process hangs, and when we pass int.MaxValue
the process stops hanging.
private static int _maxLambdaRuntimePort = 6000; | ||
private static int _maxApiGatewayPort = 9000; | ||
|
||
public static int GetNextLambdaRuntimePort() |
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.
can we update this to something like https://github.com/aws/aws-lambda-dotnet/pull/1955/files#diff-16dac3e7db3ba4a144e7ac3063ba31b74a53037cb85cc1a5e35410efb0d6393dR311? the reason being is depending on the developers machine/codebuild machine, the above ports may not actually be free. I think we should use TcpListener
for the OS to give us free ports
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.
The point of the change I'm making is so we can atomically check what the next port is that other tests are not using. I believe the TcpListener is a bit overkill as these port ranges are always free in the CI. Even on our machines, these ports are usually not used.
bffb72a
to
a7b9cc0
Compare
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.
Approve but I recommend when add the skips for tests for now still allow the test to run in debug mode.
#if !DEBUG
[Fact(Skip = "Skipping this test as it is not working properly.")]
#endif
03d9a1e
to
d4203ee
Compare
Fixed |
Issue #, if available:
DOTNET-7945
Description of changes:
Note: The unit tests are now passing in the GitHub CI and Release Pipeline. However, the integration tests are still failing. Will work on that as a follow up.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.