Skip to content

Add Spector test coverage for CommonPropertiesErrorClient methods#822

Merged
antkmsft merged 20 commits intomainfrom
copilot/add-spector-test-coverage
Feb 27, 2026
Merged

Add Spector test coverage for CommonPropertiesErrorClient methods#822
antkmsft merged 20 commits intomainfrom
copilot/add-spector-test-coverage

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Feb 3, 2026

Adds missing test coverage for create_for_user_defined_error() and get_for_predefined_error() methods in CommonPropertiesErrorClient.

Changes

  • New test file: common_properties_error_client_test.rs under packages/typespec-rust/test/spector/azure/resource-manager/common-properties/tests/
    • Tests use ConfidentialResource model and validate error response http code
    • Follows existing test patterns from common_properties_managed_identity_client_test.rs (FakeTokenCredential, helper functions, assertion structure)
    • Designed to run with Spector mock server on localhost:3000

No modifications to generated source code or emitter.

Original prompt

This section details on the original issue you should resolve

<issue_title>Add Spector test coverage for the CommonPropertiesErrorClient's methods</issue_title>
<issue_description>1. Do not modify the generated rust source code (in src/generated), only modify the emitter code (in /packages/typespec-rust/src/) if necessary
2. The test for the common-properties does already exist (under packages/typespec-rust/test/spector/azure/resource-manager/common-properties/tests/). Add a file called common_properties_error_client_test.rs there, and add tests for two methods - create_for_user_defined_error() and get_for_predefined_error().</issue_description>

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


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits February 3, 2026 11:00
…user_defined_error and get_for_predefined_error

Co-authored-by: antkmsft <41349689+antkmsft@users.noreply.github.com>
Co-authored-by: antkmsft <41349689+antkmsft@users.noreply.github.com>
Copilot AI changed the title [WIP] Add Spector test coverage for CommonPropertiesErrorClient methods Add Spector test coverage for CommonPropertiesErrorClient methods Feb 3, 2026
Copilot AI requested a review from antkmsft February 3, 2026 11:12
@antkmsft antkmsft marked this pull request as ready for review February 12, 2026 00:35
Copilot AI review requested due to automatic review settings February 12, 2026 00:35
Copy link
Copy Markdown
Contributor

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

Adds Spector integration tests for the CommonPropertiesErrorClient operations in the common-properties ARM test crate, exercising the error paths for two previously untested client methods.

Changes:

  • Adds a new integration test file covering create_for_user_defined_error() and get_for_predefined_error().
  • Verifies the returned azure_core::Error has the expected HTTP status codes (400/404).

Comment thread packages/typespec-rust/.scripts/tspcompile.js Outdated
Comment thread packages/typespec-rust/src/codegen/context.ts Outdated
Comment thread packages/typespec-rust/src/lib.ts Outdated
Comment thread packages/typespec-rust/test/Cargo.lock Outdated
Comment thread packages/typespec-rust/src/tcgcadapter/adapter.ts Outdated
Copy link
Copy Markdown
Member

@heaths heaths left a comment

Choose a reason for hiding this comment

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

I like that it's generating error models; but, in what cases should we expect it to generate a TryFrom now? I don't see that in here. I thought we want to if they actually may return a custom error instead.

Comment thread packages/typespec-rust/src/tcgcadapter/adapter.ts Outdated
@antkmsft antkmsft merged commit 44a8825 into main Feb 27, 2026
5 checks passed
@antkmsft antkmsft deleted the copilot/add-spector-test-coverage branch February 27, 2026 00:59
}

// Skip the default Azure core error models.
if (model.namespace === 'Azure.Core.Foundations') {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This should be tcgc.isAzureCoreModel(model) (will post a fix shortly).

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.

Add Spector test coverage for the CommonPropertiesErrorClient's methods

5 participants