Skip to content

Add Spector test coverage for CommonPropertiesErrorClient methods#822

Open
Copilot wants to merge 9 commits intomainfrom
copilot/add-spector-test-coverage
Open

Add Spector test coverage for CommonPropertiesErrorClient methods#822
Copilot wants to merge 9 commits intomainfrom
copilot/add-spector-test-coverage

Conversation

Copy link
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
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).

.get_for_predefined_error("test-rg", "resource", None)
.await;

assert_eq!(rsp.unwrap_err().http_status(), Some(StatusCode::NotFound));
Copy link
Member

Choose a reason for hiding this comment

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

Can we extract and verify the code ResourceNotFound that's returned by the server?

.create_for_user_defined_error("test-rg", "resource", resource.try_into().unwrap(), None)
.await;

assert_eq!(rsp.unwrap_err().http_status(), Some(StatusCode::BadRequest));
Copy link
Member

@jhendrixMSFT jhendrixMSFT Feb 12, 2026

Choose a reason for hiding this comment

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

This operation returns a custom CloudError type. We should update the test to define this error type and ensure that we can convert from an azure_core::Error into this custom error type and verify its contents.

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

3 participants