-
Notifications
You must be signed in to change notification settings - Fork 386
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: adds byoid metrics logging * add tests * addressing PR comments
- Loading branch information
Showing
9 changed files
with
480 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -56,6 +56,9 @@ export const saEmail = '[email protected]'; | |
const saBaseUrl = 'https://iamcredentials.googleapis.com'; | ||
const saPath = `/v1/projects/-/serviceAccounts/${saEmail}:generateAccessToken`; | ||
|
||
// eslint-disable-next-line @typescript-eslint/no-var-requires | ||
const pkg = require('../../package.json'); | ||
|
||
export function mockStsTokenExchange( | ||
nockParams: NockMockStsToken[], | ||
additionalHeaders?: {[key: string]: string} | ||
|
@@ -132,3 +135,12 @@ export function mockCloudResourceManager( | |
.get(`/v1/projects/${projectNumber}`) | ||
.reply(statusCode, response); | ||
} | ||
|
||
export function getExpectedExternalAccountMetricsHeaderValue( | ||
expectedSource: string, | ||
expectedSaImpersonation: boolean, | ||
expectedConfigLifetime: boolean | ||
): string { | ||
const languageVersion = process.version.replace(/^v/, ''); | ||
return `gl-node/${languageVersion} auth/${pkg.version} google-byoid-sdk source/${expectedSource} sa-impersonation/${expectedSaImpersonation} config-lifetime/${expectedConfigLifetime}`; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.