Skip to content

Conversation

@SriramGuduri
Copy link
Contributor

@SriramGuduri SriramGuduri commented Dec 3, 2025

Summary

GCP IAM Admin API Conformance Testing Strategy

Specific challenges encountered with the GCP IAM Admin Java Client that necessitated a different testing approach compared to the standard REST-based conformance tests.

1. Client Transport Limitations (gRPC vs. REST)

Unlike other GCP client libraries we use, the google-iam-admin library does not natively expose an HTTP/JSON (REST) transport option in its StubSettings. It forces the use of gRPC, which requires HTTP/2. This prevented us from using our standard HTTP-based WireMock recording setup.

2. WireMock gRPC Extension Limitations

While we utilized the wiremock-grpc-extension to handle the HTTP/2 connection and protocol framing, it currently lacks full parity with the standard WireMock HTTP recorder:

  • No Auto-Recording: The extension cannot transparently proxy binary gRPC streams and serialize the Protobuf responses into readable JSON files automatically.
  • Strict Matching: The extension requires precise endpoint matching (e.g., strict leading slashes), which caused UNIMPLEMENTED errors when using standard auto-loaded mappings.

3. Implementation of Custom Record/Replay Pattern

To bridge this gap, we implemented a manual Record/Replay workflow:

  • Record Mode:
    • Bypassed WireMock to connect directly to GCP.
    • Intercepted the response objects.
    • Manually serialized the Protobuf messages to JSON using JsonFormat and saved them to a dedicated recorded_responses directory (avoiding conflicts with WireMock's auto-scanner).
  • Replay Mode:
    • Configured the client with SSL/ALPN to negotiate HTTP/2 with WireMock.
    • Programmatically loaded the JSON files, parsed them back into Protobuf objects, and registered them as stubs using the gRPC Extension DSL.

@codecov-commenter
Copy link

codecov-commenter commented Dec 3, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.67%. Comparing base (b5d5ab5) to head (741577f).

Additional details and impacted files
@@             Coverage Diff              @@
##               main     #186      +/-   ##
============================================
+ Coverage     83.64%   83.67%   +0.02%     
- Complexity       90       91       +1     
============================================
  Files           150      150              
  Lines          8073     8073              
  Branches        941      941              
============================================
+ Hits           6753     6755       +2     
+ Misses          876      875       -1     
+ Partials        444      443       -1     
Flag Coverage Δ
unittests 83.67% <ø> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@SriramGuduri SriramGuduri force-pushed the W-20347771/iam_gcp_conformance branch 3 times, most recently from 255c608 to 7693624 Compare December 5, 2025 08:22
@SriramGuduri SriramGuduri force-pushed the W-20347771/iam_gcp_conformance branch from 7693624 to 741577f Compare December 5, 2025 08:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants