Skip to content

[load-testing-rest] pass PolledOperationOptions to getLongRunningPoller #35164

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
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

jeremymeng
Copy link
Member

This PR passes PolledOperationOptions to getLongRunningPoller, allowing customers to change the interval between polls.

This PR passes PolledOperationOptions to getLongRunningPoller, allowing customers to change the interval between polls.
@Copilot Copilot AI review requested due to automatic review settings July 9, 2025 20:26
@jeremymeng jeremymeng requested review from bterlson and a team as code owners July 9, 2025 20:26
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR enhances the load testing REST client by adding support for PolledOperationOptions to the getLongRunningPoller function, enabling customers to customize polling intervals for long-running operations.

  • Updated getLongRunningPoller function signatures to accept optional PolledOperationOptions parameter
  • Modified test files to use optimized polling intervals (0ms in playback mode, default otherwise)
  • Updated API surface documentation to reflect the new optional parameter

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
src/pollingHelper.ts Added PolledOperationOptions parameter to all getLongRunningPoller overloads and passes it to underlying poller functions
test/public/node/testRun.spec.ts Added test polling configuration and updated calls to use the new parameter
test/public/node/testAdministration.spec.ts Added test polling configuration and updated calls to use the new parameter
review/load-testing.api.md Updated public API documentation to reflect the new optional parameter

Comment on lines +39 to +46
polledOperationOptions: PolledOperationOptions = {},
): Promise<TestRunCompletionPoller | FileUploadAndValidatePoller | TestProfileRunCompletionPoller> {
if (isFileUpload(initialResponse)) {
return getFileValidationPoller(client, initialResponse);
return getFileValidationPoller(client, initialResponse, polledOperationOptions);
} else if (isTestRunCreation(initialResponse)) {
return getTestRunCompletionPoller(client, initialResponse);
return getTestRunCompletionPoller(client, initialResponse, polledOperationOptions);
} else if (isTestProfileRunCreation(initialResponse)) {
return getTestProfileRunCompletionPoller(client, initialResponse);
return getTestProfileRunCompletionPoller(client, initialResponse, polledOperationOptions);
Copy link
Preview

Copilot AI Jul 9, 2025

Choose a reason for hiding this comment

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

The implementation overload should use the same optional parameter pattern as the public overloads. Change polledOperationOptions: PolledOperationOptions = {} to polledOperationOptions?: PolledOperationOptions for consistency.

Copilot uses AI. Check for mistakes.

Copy link
Member Author

@jeremymeng jeremymeng Jul 9, 2025

Choose a reason for hiding this comment

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

We want a default value of {}

): Promise<TestRunCompletionPoller | FileUploadAndValidatePoller | TestProfileRunCompletionPoller> {
if (isFileUpload(initialResponse)) {
return getFileValidationPoller(client, initialResponse);
return getFileValidationPoller(client, initialResponse, polledOperationOptions);
Copy link
Preview

Copilot AI Jul 9, 2025

Choose a reason for hiding this comment

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

When polledOperationOptions is undefined (due to the suggested change above), this will pass undefined to getFileValidationPoller. Use polledOperationOptions || {} or similar to ensure a valid options object is passed.

Copilot uses AI. Check for mistakes.

Copy link
Member Author

Choose a reason for hiding this comment

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

it has a default value of {}

Comment on lines +42 to +46
return getFileValidationPoller(client, initialResponse, polledOperationOptions);
} else if (isTestRunCreation(initialResponse)) {
return getTestRunCompletionPoller(client, initialResponse);
return getTestRunCompletionPoller(client, initialResponse, polledOperationOptions);
} else if (isTestProfileRunCreation(initialResponse)) {
return getTestProfileRunCompletionPoller(client, initialResponse);
return getTestProfileRunCompletionPoller(client, initialResponse, polledOperationOptions);
Copy link
Preview

Copilot AI Jul 9, 2025

Choose a reason for hiding this comment

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

When polledOperationOptions is undefined, this will pass undefined to getTestRunCompletionPoller. Use polledOperationOptions || {} or similar to ensure a valid options object is passed.

Copilot uses AI. Check for mistakes.

Copy link
Member Author

Choose a reason for hiding this comment

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

it has a default value of {}

} else if (isTestProfileRunCreation(initialResponse)) {
return getTestProfileRunCompletionPoller(client, initialResponse);
return getTestProfileRunCompletionPoller(client, initialResponse, polledOperationOptions);
Copy link
Preview

Copilot AI Jul 9, 2025

Choose a reason for hiding this comment

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

When polledOperationOptions is undefined, this will pass undefined to getTestProfileRunCompletionPoller. Use polledOperationOptions || {} or similar to ensure a valid options object is passed.

Copilot uses AI. Check for mistakes.

Copy link
Member Author

Choose a reason for hiding this comment

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

it has a default value of {}

Copy link

github-actions bot commented Jul 9, 2025

API Change Check

APIView identified API level changes in this PR and created the following API reviews

@azure-rest/load-testing

@jeremymeng jeremymeng closed this Jul 10, 2025
@jeremymeng jeremymeng reopened this Jul 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant