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

[rest-core-client] Add testserver coverage #15416

Closed
wants to merge 8 commits into from
Closed

[rest-core-client] Add testserver coverage #15416

wants to merge 8 commits into from

Conversation

joheredi
Copy link
Member

Adding some test server coverage to verify common REST scenarios

@check-enforcer
Copy link

This pull request is protected by Check Enforcer.

What is Check Enforcer?

Check Enforcer helps ensure all pull requests are covered by at least one check-run (typically an Azure Pipeline). When all check-runs associated with this pull request pass then Check Enforcer itself will pass.

Why am I getting this message?

You are getting this message because Check Enforcer did not detect any check-runs being associated with this pull request within five minutes. This may indicate that your pull request is not covered by any pipelines and so Check Enforcer is correctly blocking the pull request being merged.

What should I do now?

If the check-enforcer check-run is not passing and all other check-runs associated with this PR are passing (excluding license-cla) then you could try telling Check Enforcer to evaluate your pull request again. You can do this by adding a comment to this pull request as follows:
/check-enforcer evaluate
Typically evaulation only takes a few seconds. If you know that your pull request is not covered by a pipeline and this is expected you can override Check Enforcer using the following command:
/check-enforcer override
Note that using the override command triggers alerts so that follow-up investigations can occur (PRs still need to be approved as normal).

What if I am onboarding a new service?

Often, new services do not have validation pipelines associated with them, in order to bootstrap pipelines for a new service, you can issue the following command as a pull request comment:
/azp run prepare-pipelines
This will run a pipeline that analyzes the source tree and creates the pipelines necessary to build and validate your pull request. Once the pipeline has been created you can trigger the pipeline using the following comment:
/azp run js - [service] - ci

@@ -34,7 +34,7 @@
"test": "npm run clean && npm run build:test && npm run unit-test",
"unit-test:browser": "karma start --single-run",
"unit-test:node": "mocha -r esm --require ts-node/register --reporter ../../../common/tools/mocha-multi-reporter.js --timeout 1200000 --full-trace \"test/{,!(browser)/**/}*.spec.ts\"",
"unit-test": "npm run unit-test:node && npm run unit-test:browser",
"unit-test": "autorest-testserver & npm run unit-test:node && npm run unit-test:browser && autorest-testserver stop",
Copy link
Member

Choose a reason for hiding this comment

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

I'm a little curious about the overhead this adds to the core test runs, since this will end up running on many PRs. How long does it take on your local machine to do this?

Copy link
Member Author

Choose a reason for hiding this comment

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

Doesn't take too long.

Starting the test server: 0.8972s
Test execution: 75 passing (329ms)

Copy link
Member Author

Choose a reason for hiding this comment

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

We could record them as well, and just spawn the test server when running in live mode

@@ -79,7 +79,7 @@ export type RequestParameters = {
};

// @public
export type RouteParams<TRoute extends string> = TRoute extends `{${infer _Param}}/${infer Tail}` ? [pathParam: string, ...pathParams: RouteParams<Tail>] : TRoute extends `{${infer _Param}}` ? [pathParam: string] : TRoute extends `${infer _Prefix}:${infer Tail}` ? RouteParams<`{${Tail}}`> : [];
export type RouteParams<TRoute extends string> = TRoute extends `${infer _Head}/{${infer _Param}}${infer Tail}` ? [pathParam: string, ...pathParams: RouteParams<Tail>] : [];
Copy link
Member

Choose a reason for hiding this comment

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

@willmtemple do you have enough TS wisdom to review this part of the magic?

Copy link
Member Author

Choose a reason for hiding this comment

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

Added some comments on what this type is doing

@joheredi joheredi requested a review from mitchdenny as a code owner May 28, 2021 01:45
@ramya-rao-a
Copy link
Contributor

@joheredi Can you revive this PR? Especially now that we have moved away from having the core-rest folder?

@joheredi
Copy link
Member Author

I'm closing this PR for now as I have not found a reliable way to start/stop the test server and causes our tests in windows to timeout. I'll resume this work once we have a reliable way to start/stop the test server

@joheredi joheredi closed this Jun 23, 2021
openapi-sdkautomation bot pushed a commit to AzureSDKAutomation/azure-sdk-for-js that referenced this pull request Aug 31, 2021
[QuotaRP] Split QuotaLimits API to - Usages and Quotas API (Azure#15416)

* 1.Breaking Change - Removing duplicate autoQuotaIncreaseState from supportTicketAction.
2. Removing state=enabledForPreview.
3. Updating Example.

* Updating Provider name in example.

* Capacity RP Quota APIs for GA

* Adding preview version to stable dir as base files.

* Files from preview version, which will be removed.

* Updating to GA Version.

* 1. Updated reservation version tag to - Microsoft.Capacity/preview/2020-10-01-preview/reservations.json, which matches the previous SDK release.
2. Documentation changes.

* Documentation updates for put and patch request, which includes only ONE quota request, so changing quotas to quota.

* Update documenation for put.

* Doc update.

* Adding -preview tag for GO sdk.

* Updating Go settings for output folder to be -preview.

* Adding preview subdir for GO package.

* Adding preview subdir to Go sdk path.

* Removing tag - tag: package-2020-10-25-preview

* introduce a new tag to keep the go sdk package unchanged

* Revert "introduce a new tag to keep the go sdk package unchanged"

This reverts commit 8f58d3451e9ae5a4746d2a5883911f14ca261f1b.

* Adding Azure CLI readme configuration.

* Updating the ReadMe configurations.

* Updating readme.md

* Removing duplicate cli: tag.

* Fixing build issues.

* Removing Parameter alias.

* cli config changes.

* Updating the package name to reservation.

* Updates - removin .az.md.

* Updating Example names to be unique for Get PUT

* Adding operations and python-sdk-output-folder.

* Updates.

* Removing unused file.

* Revert "Removing unused file."

This reverts commit 4f763bdb14240a3f1ba8e1dce6c7f0b643ee6a9e.

* Revert "Revert "Removing unused file.""

This reverts commit 60c520e5b50bc13c42d8227624f32031c7ca7694.

* Add reference to python readme.md file.

* Adding python readme file.

* Adding Operations for test-scenario

* Adding split

* Disabling few operation, which is not needed.

* Removing split for Operation

* Disabling the reservation Operations.

* Disable reservation operations.

* Revert "Disable reservation operations."

This reverts commit d98cbcbafeb855395f9de45292dfc9db2f5aea9d.

* Adding client-subscription-bound: false

* Adding Network RP examples and references.

* Updating Network Put and Patch requests.

* Updating GetQuotaRequests example.

* Fixing formatting.

* Updating examples.

* Adding error details for the quota request status.

* Updating examples

* Fixing formatting

* Fixing model definition.

* Revert "Fixing model definition."

This reverts commit cef9f52f142cf6c420a5f89bd0e2d806e29530c1.

* Updating example.

* Making ResoureType as String, as it will change with different RPs and all possible values cannot be added in advance.

* Adding Location header to Put and Path calls 200 response.

* Adding example for Network StandardSkuPublicIpAddresses

* Fixing spelling

* Adding error code to Failed requests and updating examples.

* Updating error message and code.

* Updating example for Network - StandardSkuPublicIpAddresses

* Adding oneOf construct. If supported, then I will update the examples.

* Adding discriminator for Limit.

* Adding discriminator to limit.

* Updating network UsagesValue example for discriminator

* Adding limitType definition.

* Adding type to the Limit objects.

* Updating type and example for discriminator

* Updating type for discriminator

* fixinf type definition for discriminator

* Updating schema for discriminator and example.

* Update network example.

* Fixing network example.

* Fixing schema.

* Fixing network example.

* Fix example.

* Updating schema.

* Updating schema and example.

* Update example.

* Examples update.

* Update

* Updated schema for discriminator

* Adding value as required.

* Schema Update.

* Replace Limt with LimitObject to fix reference.

* Updates.

* Updates.

* Updating Put/Ptach examples.

* Updating erxamples.

* Schema updated for requestStatus.

* Schema Update.

* Updates to QuotaRequestStatus example.
Change api to quota. Add usages API and update examples reference.

* 1. Split quotas and usages apis.
2. Add and update examples for quotas and usages.

* Updating example filename references

* Update Put example and operations id.

* Updating limiType field to limitObjectType

* Updating "limitType" to "limitObjectType"

* Updating Get Examples.
Adding extra property to quotas/limit object.

* 1. Updating tags for usages.
2. Rename LimitObjectType to LimitObjectTypes.

* Adding  "limitType": "Independent"

* Updating Operations Tag.

* Updating subscription ids.

* Updating Operations Name.

* Updating the documentations and examples.

* Updates.

* Updates.

* Updating Quota reference to base object type.

* Updating examples and restoring the api name to quotaLimitsProviders.

* Updating usages model and examples.

* Update quotaLimitProviders to remove resourceQuery.

* Revert "Update quotaLimitProviders to remove resourceQuery."

This reverts commit 301092d496b2834d2e5110aa7b7f32c6f9802951.

* Updating Operation API example for quotaLimitProviders rename.

* Removing quotaLimitProviders API, as it's not needed by the azure portal.
There wasn't a use case for the end user, that's why our team decided to remove it from public API.

* 1. Removing unused models for quotaLimitProviders.
2. Update operations example.

* Remove allof from usages.

* 1. Updating 202 response schema.
2. Adding location header as per - https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/async-api-reference.md#updating-using-patch

* Updating Patch 202 response model type.

* Updating description of put and API api to check location header for detailed status.

* Updates to description.

* Update quota.json

* Update quota.json

Text scrub up to line 256

* Update quota.json

Scrubbed all text strings.

* Running prettier.

* Updating Network examples to include resourceType.

* Updating Networking Examples.

* Remove 202 response body for Put and Patch.

* preRemove example - putMachineLearningServicesQuotaRequestDedicated.json

* Remove example - putMachineLearningServicesQuotaRequestDedicated.json

Co-authored-by: Arcturus Zhang <dapzhang@microsoft.com>
Co-authored-by: Pilar Ackerman <v-piacke@microsoft.com>
openapi-sdkautomation bot pushed a commit to AzureSDKAutomation/azure-sdk-for-js that referenced this pull request Sep 6, 2021
[QuotaRP] Split QuotaLimits API to - Usages and Quotas API (Azure#15416)

* 1.Breaking Change - Removing duplicate autoQuotaIncreaseState from supportTicketAction.
2. Removing state=enabledForPreview.
3. Updating Example.

* Updating Provider name in example.

* Capacity RP Quota APIs for GA

* Adding preview version to stable dir as base files.

* Files from preview version, which will be removed.

* Updating to GA Version.

* 1. Updated reservation version tag to - Microsoft.Capacity/preview/2020-10-01-preview/reservations.json, which matches the previous SDK release.
2. Documentation changes.

* Documentation updates for put and patch request, which includes only ONE quota request, so changing quotas to quota.

* Update documenation for put.

* Doc update.

* Adding -preview tag for GO sdk.

* Updating Go settings for output folder to be -preview.

* Adding preview subdir for GO package.

* Adding preview subdir to Go sdk path.

* Removing tag - tag: package-2020-10-25-preview

* introduce a new tag to keep the go sdk package unchanged

* Revert "introduce a new tag to keep the go sdk package unchanged"

This reverts commit 8f58d3451e9ae5a4746d2a5883911f14ca261f1b.

* Adding Azure CLI readme configuration.

* Updating the ReadMe configurations.

* Updating readme.md

* Removing duplicate cli: tag.

* Fixing build issues.

* Removing Parameter alias.

* cli config changes.

* Updating the package name to reservation.

* Updates - removin .az.md.

* Updating Example names to be unique for Get PUT

* Adding operations and python-sdk-output-folder.

* Updates.

* Removing unused file.

* Revert "Removing unused file."

This reverts commit 4f763bdb14240a3f1ba8e1dce6c7f0b643ee6a9e.

* Revert "Revert "Removing unused file.""

This reverts commit 60c520e5b50bc13c42d8227624f32031c7ca7694.

* Add reference to python readme.md file.

* Adding python readme file.

* Adding Operations for test-scenario

* Adding split

* Disabling few operation, which is not needed.

* Removing split for Operation

* Disabling the reservation Operations.

* Disable reservation operations.

* Revert "Disable reservation operations."

This reverts commit d98cbcbafeb855395f9de45292dfc9db2f5aea9d.

* Adding client-subscription-bound: false

* Adding Network RP examples and references.

* Updating Network Put and Patch requests.

* Updating GetQuotaRequests example.

* Fixing formatting.

* Updating examples.

* Adding error details for the quota request status.

* Updating examples

* Fixing formatting

* Fixing model definition.

* Revert "Fixing model definition."

This reverts commit cef9f52f142cf6c420a5f89bd0e2d806e29530c1.

* Updating example.

* Making ResoureType as String, as it will change with different RPs and all possible values cannot be added in advance.

* Adding Location header to Put and Path calls 200 response.

* Adding example for Network StandardSkuPublicIpAddresses

* Fixing spelling

* Adding error code to Failed requests and updating examples.

* Updating error message and code.

* Updating example for Network - StandardSkuPublicIpAddresses

* Adding oneOf construct. If supported, then I will update the examples.

* Adding discriminator for Limit.

* Adding discriminator to limit.

* Updating network UsagesValue example for discriminator

* Adding limitType definition.

* Adding type to the Limit objects.

* Updating type and example for discriminator

* Updating type for discriminator

* fixinf type definition for discriminator

* Updating schema for discriminator and example.

* Update network example.

* Fixing network example.

* Fixing schema.

* Fixing network example.

* Fix example.

* Updating schema.

* Updating schema and example.

* Update example.

* Examples update.

* Update

* Updated schema for discriminator

* Adding value as required.

* Schema Update.

* Replace Limt with LimitObject to fix reference.

* Updates.

* Updates.

* Updating Put/Ptach examples.

* Updating erxamples.

* Schema updated for requestStatus.

* Schema Update.

* Updates to QuotaRequestStatus example.
Change api to quota. Add usages API and update examples reference.

* 1. Split quotas and usages apis.
2. Add and update examples for quotas and usages.

* Updating example filename references

* Update Put example and operations id.

* Updating limiType field to limitObjectType

* Updating "limitType" to "limitObjectType"

* Updating Get Examples.
Adding extra property to quotas/limit object.

* 1. Updating tags for usages.
2. Rename LimitObjectType to LimitObjectTypes.

* Adding  "limitType": "Independent"

* Updating Operations Tag.

* Updating subscription ids.

* Updating Operations Name.

* Updating the documentations and examples.

* Updates.

* Updates.

* Updating Quota reference to base object type.

* Updating examples and restoring the api name to quotaLimitsProviders.

* Updating usages model and examples.

* Update quotaLimitProviders to remove resourceQuery.

* Revert "Update quotaLimitProviders to remove resourceQuery."

This reverts commit 301092d496b2834d2e5110aa7b7f32c6f9802951.

* Updating Operation API example for quotaLimitProviders rename.

* Removing quotaLimitProviders API, as it's not needed by the azure portal.
There wasn't a use case for the end user, that's why our team decided to remove it from public API.

* 1. Removing unused models for quotaLimitProviders.
2. Update operations example.

* Remove allof from usages.

* 1. Updating 202 response schema.
2. Adding location header as per - https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/async-api-reference.md#updating-using-patch

* Updating Patch 202 response model type.

* Updating description of put and API api to check location header for detailed status.

* Updates to description.

* Update quota.json

* Update quota.json

Text scrub up to line 256

* Update quota.json

Scrubbed all text strings.

* Running prettier.

* Updating Network examples to include resourceType.

* Updating Networking Examples.

* Remove 202 response body for Put and Patch.

* preRemove example - putMachineLearningServicesQuotaRequestDedicated.json

* Remove example - putMachineLearningServicesQuotaRequestDedicated.json

Co-authored-by: Arcturus Zhang <dapzhang@microsoft.com>
Co-authored-by: Pilar Ackerman <v-piacke@microsoft.com>
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.

3 participants