Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 28, 2025

Description

Sets up spector tests infrastructure for http-client-csharp-mgmt, mirroring the existing setup in http-client-csharp. This enables testing the management SDK generator against azure-http-specs resource-manager scenarios.

Changes

Scripts (eng/packages/http-client-csharp-mgmt/eng/scripts/)

  • Spector-Helper.psm1 - Helper module to enumerate resource-manager specs from @azure-tools/azure-http-specs
  • Test-Spector.ps1 - Test runner that regenerates, tests, and restores each spec
  • Generate.ps1 - Updated to generate Spector test projects alongside existing Mgmt-TypeSpec
  • Generation.psm1 - Removed deprecated plugin-name option

Test Infrastructure (generator/TestProjects/Spector.Tests/)

  • TestProjects.Spector.Tests.csproj - Test project with Azure.ResourceManager dependencies
  • SpectorTestBase.cs - Base class with test helpers
  • Infrastructure/ - Server management, test attributes, model serialization tests

Dependencies (package.json)

  • Added @typespec/spector and @typespec/spec-api devDependencies

Resource Manager Specs Covered

  • common-properties, large-header, method-subscription-id, non-resource, operation-templates, resources

Usage

# Generate all spector test projects
pwsh ./eng/scripts/Generate.ps1

# Run tests for a specific spec
pwsh ./eng/scripts/Test-Spector.ps1 -filter "common-properties"

This checklist is used to make sure that common guidelines for a pull request are followed.

General Guidelines

  • Title of the pull request is clear and informative.
  • There are a small number of commits, each of which have an informative message. This means that previously merged commits do not appear in the history of the PR. For more information on cleaning up the commits in your PR, see this page.

Testing Guidelines

  • Pull request includes test coverage for the included changes.

SDK Generation Guidelines

  • If an SDK is being regenerated based on a new swagger spec, a link to the pull request containing these swagger spec changes has been included above.
  • The generate.cmd file for the SDK has been updated with the version of AutoRest, as well as the commitid of your swagger spec or link to the swagger spec, used to generate the code.
  • The *.csproj and AssemblyInfo.cs files have been updated with the new version of the SDK.
Original prompt

This section details on the original issue you should resolve

<issue_title>set up spector tests generation for http-client-csharp-mgmt</issue_title>
<issue_description>In http-client-csharp, there are spector tests in https://github.com/Azure/azure-sdk-for-net/tree/main/eng/packages/http-client-csharp/generator/TestProjects/Spector.
And the generation script is https://github.com/Azure/azure-sdk-for-net/blob/main/eng/packages/http-client-csharp/eng/scripts/Test-Spector.ps1

We need to set up similar spector tests in http-client-csharp-mgmt.
The corresponding spector tests will be for resource manager, like the ones in

Join-Path 'http' 'azure' 'resource-manager' 'common-properties'
Join-Path 'http' 'azure' 'resource-manager' 'non-resource'
Join-Path 'http' 'azure' 'resource-manager' 'operation-templates'
Join-Path 'http' 'azure' 'resource-manager' 'resources'
Join-Path 'http' 'azure' 'resource-manager' 'large-header'
Join-Path 'http' 'azure' 'resource-manager' 'method-subscription-id'
</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI changed the title [WIP] Set up spector tests generation for http-client-csharp-mgmt Set up spector tests generation for http-client-csharp-mgmt Nov 28, 2025
Copilot AI requested a review from live1206 November 28, 2025 08:44
Copilot finished work on behalf of live1206 November 28, 2025 08:44
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.

set up spector tests generation for http-client-csharp-mgmt

2 participants