This repository was archived by the owner on Mar 6, 2026. It is now read-only.
Commit e5a28b5
tests: system tests for expired User Credentials (#1937)
This PR fixes flaky system tests that fail when `google.auth.default()`
picks up expired User Credentials.
The previous logic only exempted failures if the
`GOOGLE_APPLICATION_CREDENTIALS` environment variable pointed to a file
ending in "authorized_user.json". However, User Credentials can be
loaded from other locations (e.g., gcloud config), causing the test to
fail with `RefreshError` instead of ignoring it as intended.
Changes:
- Added `isinstance` check for `google.oauth2.credentials.Credentials`
to robustly identify User Credentials.
- Added `invalid_client` to the list of ignored error messages, as this
error can also occur with invalid tokens.
- Applied these fixes to both sync and async system tests.
---
*PR created automatically by Jules for task
[13051961428180802207](https://jules.google.com/task/13051961428180802207)
started by @chalmerlowe*
Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
Co-authored-by: Chalmer Lowe <chalmerlowe@google.com>1 parent 4292ab0 commit e5a28b5
2 files changed
Lines changed: 12 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
| |||
34 | 35 | | |
35 | 36 | | |
36 | 37 | | |
37 | | - | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
38 | 42 | | |
39 | 43 | | |
40 | 44 | | |
41 | 45 | | |
42 | 46 | | |
43 | 47 | | |
| 48 | + | |
44 | 49 | | |
45 | 50 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
| |||
32 | 33 | | |
33 | 34 | | |
34 | 35 | | |
35 | | - | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
36 | 40 | | |
37 | 41 | | |
38 | 42 | | |
39 | 43 | | |
40 | 44 | | |
41 | 45 | | |
| 46 | + | |
42 | 47 | | |
43 | 48 | | |
0 commit comments