Skip to content
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

Add PollingRequestQueueTimeout and PollingRequestMaximumMessageProcessingTimeout tests #564

Merged
merged 2 commits into from
Nov 30, 2023

Conversation

nathanwoctopusdeploy
Copy link
Contributor

Background

Add PollingRequestQueueTimeout and PollingRequestMaximumMessageProcessingTimeout tests

Cherry-picked from this reverted PR #558

How to review this PR

Quality ✔️

Pre-requisites

  • I have read How we use GitHub Issues for help deciding when and where it's appropriate to make an issue.
  • I have considered informing or consulting the right people, according to the ownership map.
  • I have considered appropriate testing for my change.


stopwatch.Elapsed.Should()
.BeGreaterThan(halibutTimeoutsAndLimits.PollingRequestQueueTimeout, "Should have waited longer than the PollingRequestQueueTimeout").And
.BeLessThan(responseDelay + TimeSpan.FromSeconds(5), "Should have received the response after the 10 second delay + 5 second buffer");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Is this last assertion necessary? If it took 15.1s on a busy build server would that still be ok since the call completed successfully and it exceeds the PollingRequestQueueTimeout

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No it's redundant isn't it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed


stopwatch.Elapsed.Should().BeLessThan(TimeSpan.FromSeconds(15), "Should have timed out quickly");

connectionsObserver.ConnectionAcceptedCount.Should().Be(1, "A single TCP connection should have been created");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: What is this assertion trying to show? is it that the request was picked up?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's more relevant to cooperative cancellation, slightly redundant in the tests current form - see the Wait below. The aim was to try to ensure the request was cancelled to the socket causing reconnects.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ooh

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've left the test as it is so it's "ready" for cooperative cancellation

// Leaving these asserts as when cooperative cancellation is supported it should cause them to fail at which point they can be fixed to assert cancellation to the socket works as expected.
connectionsObserver.ConnectionClosedCount.Should().Be(0, "Cancelling the PendingRequest does not cause the TCP Connection to be cancelled to stop the in-flight request");
connectionsObserver.ConnectionAcceptedCount.Should().Be(1, "The Service won't have reconnected after the request was cancelled");
}, TimeSpan.FromSeconds(30), Logger, CancellationToken);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Can this be reduced?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: is 30s special for some reason?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, I think it was lifted from some other test that decided to use 30 seconds. Enough time to not be flakey but not too much time to fail to slowly!!

What would you suggest this timeout should be @LukeButters

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have no better suggestion, just checking if it is special :)

Copy link
Contributor

@LukeButters LukeButters left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some worthwhile tests!

@nathanwoctopusdeploy nathanwoctopusdeploy enabled auto-merge (squash) November 30, 2023 03:45
@nathanwoctopusdeploy nathanwoctopusdeploy merged commit ac71605 into main Nov 30, 2023
1 check passed
@nathanwoctopusdeploy nathanwoctopusdeploy deleted the sast/add-polling-timeout-tests branch November 30, 2023 05:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants