RUST-2356 add appName to OIDC test failpoints#1611
RUST-2356 add appName to OIDC test failpoints#1611kevinAlbs wants to merge 4 commits intomongodb:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Adds an appName to OIDC-related failpoint configurations to scope failpoints to the test client and reduce transient cross-client interference (e.g., Atlas-triggered commands).
Changes:
- Set
appNameon the unified test client entity in the OIDC “no-retry” spec. - Add
appNamefilters to relevantfailCommandfailpoints in both YAML and JSON unified test specs. - Update Rust OIDC spec tests to set client
app_nameand scopeFailPointbuilders via.app_name(...).
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| spec/auth/unified/mongodb-oidc-no-retry.yml | Defines a shared YAML anchor for appName and applies it to failpoints to scope them to the test client. |
| spec/auth/unified/mongodb-oidc-no-retry.json | Mirrors the YAML changes by adding the same appName value throughout the JSON spec. |
| driver/src/test/spec/oidc.rs | Sets ClientOptions.app_name and adds .app_name("rust-oidc") to failpoints to prevent unintentional triggering by other clients. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| test::spec::unified_runner::{TestFile, TestFileEntity}, | ||
| }; | ||
|
|
||
| const OIDC_APP_NAME: &str = "rust-oidc"; |
There was a problem hiding this comment.
There are two different OIDC_APP_NAME constants in scope: one defined in this file (\"rust-oidc\") and one imported (spec::oidc_skip_ci::OIDC_APP_NAME). Inside mod basic, the imported name shadows the file-level constant, which can cause ClientOptions.app_name and failpoint .app_name(...) to use an unintended value (or make the file-level const unused). Prefer a single source of truth: remove the import and reference super::OIDC_APP_NAME, or delete the file-level const and consistently use the imported one.
| const OIDC_APP_NAME: &str = "rust-oidc"; |
| test::{ | ||
| spec::unified_runner::run_unified_tests, | ||
| Client, bson::{Document, doc}, client::auth::{AuthMechanism, Credential, oidc}, options::ClientOptions, test::{ | ||
| spec::{oidc_skip_ci::OIDC_APP_NAME, unified_runner::run_unified_tests}, |
There was a problem hiding this comment.
There are two different OIDC_APP_NAME constants in scope: one defined in this file (\"rust-oidc\") and one imported (spec::oidc_skip_ci::OIDC_APP_NAME). Inside mod basic, the imported name shadows the file-level constant, which can cause ClientOptions.app_name and failpoint .app_name(...) to use an unintended value (or make the file-level const unused). Prefer a single source of truth: remove the import and reference super::OIDC_APP_NAME, or delete the file-level const and consistently use the imported one.
| spec::{oidc_skip_ci::OIDC_APP_NAME, unified_runner::run_unified_tests}, | |
| spec::{unified_runner::run_unified_tests}, |
| Client, bson::{Document, doc}, client::auth::{AuthMechanism, Credential, oidc}, options::ClientOptions, test::{ | ||
| spec::{oidc_skip_ci::OIDC_APP_NAME, unified_runner::run_unified_tests}, | ||
| util::fail_point::{FailPoint, FailPointMode}, | ||
| }, | ||
| Client, | ||
| } |
There was a problem hiding this comment.
This use crate::{ ... } block was reformatted into a very dense single line, which makes it harder to review and maintain. Consider reverting to a multi-line grouped import (or just run rustfmt) to restore readability.
| })) | ||
| .build() | ||
| .into(); | ||
| opts.app_name = Some(OIDC_APP_NAME.into()); |
There was a problem hiding this comment.
Setting opts.app_name = Some(OIDC_APP_NAME.into()) is repeated in many test cases in this file. To reduce duplication and prevent future inconsistencies, consider introducing a small helper (e.g., fn set_oidc_app_name(opts: &mut ClientOptions)) and calling it wherever the OIDC test client is constructed.
|
Closing for #1611 |
Summary
Evergreen patch: https://spruce.mongodb.com/version/698b617d6baf4b00079d9304/
Background & Motivation
Intended to address transient test failures observed on GCP OIDC tasks (example). See mongodb/specifications#1891 for details. In short: Atlas processes appeared to sometimes trigger failpoints. The
appNameis intended to isolate failpoints to the test client.