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

Integration tests use DevOps MI for Cosmos #4369

Merged
merged 3 commits into from
Sep 24, 2024

Conversation

brendankowitz
Copy link
Member

@brendankowitz brendankowitz commented Aug 22, 2024

Description

PR and CI pipelines should use MI for Integration Tests

Related issues

Addresses AB#126615

Testing

Existing tests should pass, using new MI credentials for Cosmos

FHIR Team Checklist

  • Update the title of the PR to be succinct and less than 65 characters
  • Add a milestone to the PR for the sprint that it is merged (i.e. add S47)
  • Tag the PR with the type of update: Bug, Build, Dependencies, Enhancement, New-Feature or Documentation
  • Tag the PR with Open source, Azure API for FHIR (CosmosDB or common code) or Azure Healthcare APIs (SQL or common code) to specify where this change is intended to be released.
  • Tag the PR with Schema Version backward compatible or Schema Version backward incompatible or Schema Version unchanged if this adds or updates Sql script which is/is not backward compatible with the code.
  • CI is green before merge Build Status
  • Review squash-merge requirements

Semver Change (docs)

Patch|Skip|Feature|Breaking (reason)

@brendankowitz brendankowitz changed the title Integration tests use DevOps MI for Cosmos [Draft] Integration tests use DevOps MI for Cosmos Aug 22, 2024
@brendankowitz brendankowitz force-pushed the personal/bkowitz/cosmos-mi-arm branch 2 times, most recently from dec47bc to db42bec Compare September 5, 2024 16:49
Base automatically changed from personal/bkowitz/cosmos-mi-arm to main September 6, 2024 04:10
@brendankowitz brendankowitz force-pushed the personal/bkowitz/cosmos-mi-int-tests branch from cf84ece to 925dbc4 Compare September 17, 2024 23:57
@brendankowitz brendankowitz force-pushed the personal/bkowitz/cosmos-mi-int-tests branch 2 times, most recently from 06bb04e to 9743303 Compare September 20, 2024 18:25
@brendankowitz brendankowitz force-pushed the personal/bkowitz/cosmos-mi-int-tests branch from 9743303 to f24ee36 Compare September 20, 2024 23:33
@brendankowitz brendankowitz marked this pull request as ready for review September 21, 2024 01:10
@brendankowitz brendankowitz requested a review from a team as a code owner September 21, 2024 01:10
@brendankowitz brendankowitz added this to the S150 milestone Sep 21, 2024
@brendankowitz brendankowitz added Enhancement-Test Enhancement on tests. Open source This change is only relevant to the OSS code or release. labels Sep 21, 2024
@brendankowitz brendankowitz changed the title [Draft] Integration tests use DevOps MI for Cosmos Integration tests use DevOps MI for Cosmos Sep 21, 2024
Copy link
Contributor

@mikaelweave mikaelweave left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some small comments but approved. Nice work. 🦾

@@ -692,20 +693,6 @@
"[resourceId('Microsoft.DocumentDb/databaseAccounts', variables('serviceName'))]"
]
},
{
"condition": "[equals(parameters('solutionType'),'FhirServerCosmosDB')]",
"type": "Microsoft.KeyVault/vaults/secrets",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NIT: Do we even need the keyvault anymore? Could be a new story.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SQL is still using the keyvault too, it is at least consisntent. Might merge this first so I can mitigate having localauth enabled

@@ -39,16 +40,19 @@ public FhirCosmosClientInitializer(
ICosmosClientTestProvider testProvider,
Func<IEnumerable<RequestHandler>> requestHandlerFactory,
RetryExceptionPolicyFactory retryExceptionPolicyFactory,
Lazy<TokenCredential> tokenCredential,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this need to be Lazy? I think the implementations of TokenCredential already are lazy and the wait is when the token is requested.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

...good point, I was thinking to not resolve it at all if the key is still being used. Not sure I have a strong opinion on this

Key = Environment.GetEnvironmentVariable("CosmosDb:Key") ?? CosmosDbLocalEmulator.Key,
DatabaseId = Environment.GetEnvironmentVariable("CosmosDb:DatabaseId") ?? "FhirTests",
Host = Environment.GetEnvironmentVariable("CosmosDb__Host") ?? CosmosDbLocalEmulator.Host,
Key = Environment.GetEnvironmentVariable("CosmosDb__Key") ?? CosmosDbLocalEmulator.Key,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NIT: Should key be null if we are using MI?

@brendankowitz brendankowitz merged commit b046235 into main Sep 24, 2024
45 of 51 checks passed
@brendankowitz brendankowitz deleted the personal/bkowitz/cosmos-mi-int-tests branch September 24, 2024 16:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement-Test Enhancement on tests. Open source This change is only relevant to the OSS code or release.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants