mirror of
https://github.com/hanzoai/azure-sdk-for-js.git
synced 2026-10-30 19:51:51 +00:00
9d0b6db6b3
### Packages impacted by this PR - @azure-rest/load-testing ### Issues associated with this PR Fixes broken documentation links that were causing link verification failures. ### Describe the problem that is addressed by this PR Microsoft Learn reorganized the Load Testing API documentation from `/rest/api/loadtesting/` to `/rest/api/apptesting/loadtest/`. This caused link verification failures across the README and sample files. ### What are the possible designs available to address the problem? If there are more than one possible design, why was the one in this PR chosen? Direct URL replacement is the only approach. Updated all references from: - `https://learn.microsoft.com/rest/api/loadtesting/` → `https://learn.microsoft.com/rest/api/apptesting/loadtest/` - `https://learn.microsoft.com/rest/api/loadtesting/data-plane-uri` → `https://learn.microsoft.com/rest/api/apptesting/loadtest/data-plane-uri` ### Are there test cases added in this PR? _(If not, why?)_ No. Documentation link updates only. Link verification will be performed by existing CI. ### Provide a list of related PRs _(if any)_ N/A ### Command used to generate this PR:**_(Applicable only to SDK release request PRs)_ N/A ### Checklists - [x] Added impacted package name to the issue description - [x] Does this PR needs any fixes in the SDK Generator?** _(If so, create an Issue in the [Autorest/typescript](https://github.com/Azure/autorest.typescript) repository and link it here)_ - [ ] Added a changelog (if necessary) > [!WARNING] > > <details> > <summary>Firewall rules blocked me from connecting to one or more addresses (expand for details)</summary> > > #### I tried to connect to the following addresses, but was blocked by firewall rules: > > - `learn.microsoft.com` > - Triggering command: `curl -s -o /dev/null -w %{http_code} REDACTED` (dns block) > > If you need me to access, download, or install something from one of these locations, you can either: > > - Configure [Actions setup steps](https://gh.io/copilot/actions-setup-steps) to set up my environment, which run before the firewall is enabled > - Add the appropriate URLs or hosts to the custom allowlist in this repository's [Copilot coding agent settings](https://github.com/Azure/azure-sdk-for-js/settings/copilot/coding_agent) (admins only) > > </details> <!-- START COPILOT CODING AGENT SUFFIX --> <details> <summary>Original prompt</summary> > > ---- > > *This section details on the original issue you should resolve* > > <issue_title>[doc] loadtesting readme broken links</issue_title> > <issue_description>We got this failure in link verification: > > >Summary of broken links: > 'file:///mnt/vss/_work/1/s/sdk/loadtesting/load-testing-rest/README.md' has 2 broken link(s): > https://learn.microsoft.com/rest/api/loadtesting/ > https://learn.microsoft.com/rest/api/loadtesting/data-plane-uri > Checked 98 links with 1 broken link(s) found. > > Looks that the url has been changed to > > https://learn.microsoft.com/rest/api/apptesting/loadtest/</issue_description> > > <agent_instructions>Fix the issue by updating the broken links</agent_instructions> > > ## Comments on the Issue (you are @copilot in this section) > > <comments> > </comments> > </details> - Fixes Azure/azure-sdk-for-js#36499 <!-- START COPILOT CODING AGENT TIPS --> --- 💬 We'd love your input! Share your thoughts on Copilot coding agent in our [2 minute survey](https://gh.io/copilot-coding-agent-survey). --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: jeremymeng <[email protected]>
48 lines
1.5 KiB
TypeScript
48 lines
1.5 KiB
TypeScript
// Copyright (c) Microsoft Corporation.
|
|
// Licensed under the MIT License.
|
|
|
|
/**
|
|
* This sample demonstrates how to create a load test
|
|
*
|
|
* @summary Demonstrates how to create a load test
|
|
*/
|
|
|
|
import AzureLoadTesting /* , { isUnexpected }*/ from "@azure-rest/load-testing";
|
|
import { DefaultAzureCredential } from "@azure/identity";
|
|
import { randomUUID } from "node:crypto";
|
|
|
|
async function main(): Promise<void> {
|
|
/**
|
|
* The dataplane endpoint for the Azure Load Testing resource.
|
|
* Refer to https://learn.microsoft.com/rest/api/apptesting/loadtest/data-plane-uri to understand how to obtain the data-plane endpoint.
|
|
*/
|
|
const endpoint = process.env["LOADTESTSERVICE_ENDPOINT"] || "";
|
|
|
|
/** Microsoft Entra ID authentication */
|
|
/**
|
|
* In this sample you can populate the three AZURE_CLIENT_ID, AZURE_CLIENT_SECRET & AZURE_TENANT_ID variables for Microsoft Entra ID auth
|
|
*/
|
|
const credential = new DefaultAzureCredential();
|
|
|
|
const testId = randomUUID(); // ID to be assigned to a test
|
|
const displayName = "Sample Load Test";
|
|
const description = "Sample Test Description";
|
|
|
|
// Build a client through AAD
|
|
const client = AzureLoadTesting(endpoint, credential);
|
|
|
|
// Creating the Load test
|
|
await client.path("/tests/{testId}", testId).patch({
|
|
contentType: "application/merge-patch+json",
|
|
body: {
|
|
displayName: displayName,
|
|
description: description,
|
|
loadTestConfiguration: {
|
|
engineInstances: 1, // number of engine instances to run test
|
|
},
|
|
},
|
|
});
|
|
}
|
|
|
|
main().catch(console.error);
|