Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Google auth interop test #2512

Merged
merged 4 commits into from
Aug 20, 2024
Merged

Conversation

JamesNK
Copy link
Member

@JamesNK JamesNK commented Aug 19, 2024

No description provided.

@JamesNK
Copy link
Member Author

JamesNK commented Aug 20, 2024

@apolcyn @jskeet Interop tests pass after downgrading Google.Apis.Auth.

Does that mean the change in Google.Apis.Auth that causes the interop error is intentional or a regression?

Problematic line:

Assert.IsFalse(googleCredential.IsCreateScopedRequired);

@JamesNK JamesNK requested a review from apolcyn August 20, 2024 00:17
@jskeet
Copy link

jskeet commented Aug 20, 2024

cc @amanda-tarafa who is on holiday at the moment, but will want to look at this later.

I strongly suspect this is basically just a test issue, due to the change in googleapis/google-api-dotnet-client@bd80f0a which introduced the feature of Compute Credentials accepting scopes. (The name of IsCreateScopedRequired is unfortunate - it's more "permitted" than "required" IMO, but Amanda can give more details.)

If I'm right, then we should be able to narrow down the version range: I'd expect the current test to pass with 1.57.0 and fail with 1.58.0.

I suspect you could invert the assertion, or just remove it.

@apolcyn
Copy link
Contributor

apolcyn commented Aug 20, 2024

I think I see what happened here.

The "compute_engine_creds" test creates credentials via GoogleCredential.GetApplicationDefaultAsync();. This walks through an ordered list of credential mechanisms and picks the first one that works (depends on what's available). The way the "compute_engine_creds" test is run, we expect it to create a ComputeCredential (fetches a token from the GCE metadata server). I'm guessing the now-failing check was trying to do a sanity check that we did in fact resolve a ComputeCredential - because prior to https://github.com/googleapis/google-api-dotnet-client/pull/2103/files#diff-4ac910358ab8f456aef208d4ce8d2dc532d341bdc145c238683b3cb1bdee1af8, that type of credential did not support explicit scoping and so would have always been false.

googleapis/google-api-dotnet-client#2103 added support for explicit scoping (in some environments). That type of credential now always has SupportsExplicitScopes == true, so the check will of course fail.

Assuming this is all intentional, perhaps all we need for this test is a different, safer way to sanity check that we did resolve a ComputeCredential (if possible). We could perhaps remove it, the only downside is the test would be slightly fragile since it might not be using the credential we think it's using.

cc @jskeet

@jskeet
Copy link

jskeet commented Aug 20, 2024

I'm guessing the now-failing check was trying to do a sanity check that we did in fact resolve a ComputeCredential

If that's the case, there's a much simpler alternative, at least now - fetch googleCredential.UnderlyingCredential and check that it's a ComputeCredential.

@JamesNK JamesNK changed the title Downgrade Google auth Fix Google auth interop test Aug 20, 2024
@JamesNK JamesNK marked this pull request as ready for review August 20, 2024 06:44
@JamesNK
Copy link
Member Author

JamesNK commented Aug 20, 2024

Test is fixed. @apolcyn feel free to approve and merge.

@apolcyn apolcyn merged commit dd4adce into grpc:master Aug 20, 2024
5 checks passed
@amanda-tarafa
Copy link

I'm back now, just catching up.

The name IsCreateScopeRequired is indeed very unfortunate but legacy and we cannot remove it without a significant breaking change. For reference, we internally call this SupportsExplicitScopes which is a way better name.

Although I cannot comment on the original intention of testing for "IsCreateScopeRequired" to be false, I can confirm the rest of @apolcyn's comment. ComputeCredential.IsCreateScopeRequired will always be true now because some (but we cannot tell which) ComputeCredentials support explicit scoping. The best way to check the credential to be a ComputeCredential is Jon's suggestion that's been implemented, so all good here.

oguzhand95 referenced this pull request in cerbos/cerbos-sdk-net Sep 23, 2024
This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
|
[Google.Protobuf](https://github.com/protocolbuffers/protobuf)
| `3.28.1` -> `3.28.2` |
[![age](https://developer.mend.io/api/mc/badges/age/nuget/Google.Protobuf/3.28.2?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/nuget/Google.Protobuf/3.28.2?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/nuget/Google.Protobuf/3.28.1/3.28.2?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/nuget/Google.Protobuf/3.28.1/3.28.2?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
| [Grpc.Net.Client](https://github.com/grpc/grpc-dotnet) |
`2.65.0` -> `2.66.0` |
[![age](https://developer.mend.io/api/mc/badges/age/nuget/Grpc.Net.Client/2.66.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/nuget/Grpc.Net.Client/2.66.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/nuget/Grpc.Net.Client/2.65.0/2.66.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/nuget/Grpc.Net.Client/2.65.0/2.66.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>grpc/grpc-dotnet (Grpc.Net.Client)</summary>

###
[`v2.66.0`](https://github.com/grpc/grpc-dotnet/releases/tag/v2.66.0)

#### What's Changed

- Bump version on master to 2.66.0-dev by
[@&#8203;stanley-cheung](https://github.com/stanley-cheung) in
[https://github.com/grpc/grpc-dotnet/pull/2491](https://github.com/grpc/grpc-dotnet/pull/2491)
- Fix failure to create GrpcChannel under Wine compatibility layer
(including Steam Proton and Apple Game Porting Toolkit) by
[@&#8203;mayuki](https://github.com/mayuki) in
[https://github.com/grpc/grpc-dotnet/pull/2496](https://github.com/grpc/grpc-dotnet/pull/2496)
- Update .NET 9 SDK and resolve warnings by
[@&#8203;sebastienros](https://github.com/sebastienros) in
[https://github.com/grpc/grpc-dotnet/pull/2502](https://github.com/grpc/grpc-dotnet/pull/2502)
- Bump braces from 3.0.2 to 3.0.3 in
/testassets/InteropTestsGrpcWebWebsite/Tests by
[@&#8203;dependabot](https://github.com/dependabot) in
[https://github.com/grpc/grpc-dotnet/pull/2504](https://github.com/grpc/grpc-dotnet/pull/2504)
- Bump axios from 1.6.2 to 1.7.4 in
/testassets/InteropTestsGrpcWebWebsite/Tests by
[@&#8203;dependabot](https://github.com/dependabot) in
[https://github.com/grpc/grpc-dotnet/pull/2505](https://github.com/grpc/grpc-dotnet/pull/2505)
- Update puppeteer by
[@&#8203;JamesNK](https://github.com/JamesNK) in
[https://github.com/grpc/grpc-dotnet/pull/2507](https://github.com/grpc/grpc-dotnet/pull/2507)
- Remove internal_ci flag from interop test script by
[@&#8203;JamesNK](https://github.com/JamesNK) in
[https://github.com/grpc/grpc-dotnet/pull/2509](https://github.com/grpc/grpc-dotnet/pull/2509)
- Fix Google auth interop test by
[@&#8203;JamesNK](https://github.com/JamesNK) in
[https://github.com/grpc/grpc-dotnet/pull/2512](https://github.com/grpc/grpc-dotnet/pull/2512)
- \[testing] improve sanity check in jwt_token_creds interop test by
[@&#8203;apolcyn](https://github.com/apolcyn) in
[https://github.com/grpc/grpc-dotnet/pull/2513](https://github.com/grpc/grpc-dotnet/pull/2513)
- Add HTTP version configuration to GrpcChannelOptions by
[@&#8203;JamesNK](https://github.com/JamesNK) in
[https://github.com/grpc/grpc-dotnet/pull/2514](https://github.com/grpc/grpc-dotnet/pull/2514)
- Bump grpc.tools version to 2.66 by
[@&#8203;apolcyn](https://github.com/apolcyn) in
[https://github.com/grpc/grpc-dotnet/pull/2523](https://github.com/grpc/grpc-dotnet/pull/2523)
- Bump webpack from 5.76.0 to 5.94.0 in /examples/Browser/Server/wwwroot
by [@&#8203;dependabot](https://github.com/dependabot) in
[https://github.com/grpc/grpc-dotnet/pull/2522](https://github.com/grpc/grpc-dotnet/pull/2522)
- Bump elliptic from 6.5.4 to 6.5.7 in /examples/Spar/Server/ClientApp
by [@&#8203;dependabot](https://github.com/dependabot) in
[https://github.com/grpc/grpc-dotnet/pull/2525](https://github.com/grpc/grpc-dotnet/pull/2525)
- Bump micromatch from 4.0.7 to 4.0.8 in
/testassets/InteropTestsGrpcWebWebsite/Tests by
[@&#8203;dependabot](https://github.com/dependabot) in
[https://github.com/grpc/grpc-dotnet/pull/2524](https://github.com/grpc/grpc-dotnet/pull/2524)
- Bump v2.66.x branch to 2.66.0.pre1 by
[@&#8203;apolcyn](https://github.com/apolcyn) in
[https://github.com/grpc/grpc-dotnet/pull/2526](https://github.com/grpc/grpc-dotnet/pull/2526)
- Bump v2.66.x to v2.66.0 by
[@&#8203;apolcyn](https://github.com/apolcyn) in
[https://github.com/grpc/grpc-dotnet/pull/2539](https://github.com/grpc/grpc-dotnet/pull/2539)

**Full Changelog**:
grpc/grpc-dotnet@v2.65.0...v2.66.0

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "before 4am on Monday" (UTC),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

👻 **Immortal**: This PR will be recreated if closed unmerged. Get
[config
help](https://github.com/renovatebot/renovate/discussions) if
that's undesired.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR was generated by [Mend Renovate](https://mend.io/renovate/).
View the [repository job
log](https://developer.mend.io/github/cerbos/cerbos-sdk-net).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOC44MC4wIiwidXBkYXRlZEluVmVyIjoiMzguODAuMCIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiYXJlYS9jaSIsImJvdHMiLCJraW5kL2Nob3JlIl19-->

---------

Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Signed-off-by: Oğuzhan Durgun <oguzhandurgun95@gmail.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Oğuzhan Durgun <oguzhandurgun95@gmail.com>
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.

4 participants