-
Notifications
You must be signed in to change notification settings - Fork 526
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
Improve flaky integration tests #3836
Improve flaky integration tests #3836
Conversation
aa94c59
to
ccc4014
Compare
29d8a66
to
d223900
Compare
...Microsoft.Health.Fhir.Shared.Tests.Integration/Persistence/SqlServerFhirStorageTestHelper.cs
Fixed
Show fixed
Hide fixed
93a145f
to
d1acae9
Compare
...Microsoft.Health.Fhir.Shared.Tests.Integration/Persistence/SqlServerFhirStorageTestHelper.cs
Fixed
Show fixed
Hide fixed
...Microsoft.Health.Fhir.Shared.Tests.Integration/Persistence/SqlServerFhirStorageTestHelper.cs
Fixed
Show fixed
Hide fixed
d1acae9
to
b05053d
Compare
9c6191a
to
b4c4873
Compare
cc5a59f
to
d50bd7d
Compare
...Microsoft.Health.Fhir.Shared.Tests.Integration/Persistence/SqlServerFhirStorageTestHelper.cs
Dismissed
Show dismissed
Hide dismissed
8192399
to
208f71d
Compare
...Microsoft.Health.Fhir.Shared.Tests.Integration/Persistence/SqlServerFhirStorageTestHelper.cs
Dismissed
Show dismissed
Hide dismissed
@@ -206,18 +217,32 @@ public async Task DeleteDatabase(string databaseName, CancellationToken cancella | |||
return; | |||
} | |||
|
|||
SqlConnection.ClearAllPools(); | |||
|
|||
await _dbSetupRetryPolicy.ExecuteAsync(async () => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we not want to retry the cleanup?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was mainly trying to find where all the time is spent for integration tests. I think we wait the max amount of time on retries to delete the database at the end of every fixture.
Strangely enough, when watching the resource group the databases all seemed to eventually drop, perhaps there's something async going on under the covers on the sql side.
On top of this, we delete the resource group at the end of the test which should cover anything that failed, and CI has a task to remove orphaned test databases.
208f71d
to
7e8a563
Compare
Description
This pull request primarily focuses on improving the test suite for integration tests. The changes include modifications to the Azure DevOps pipeline YAML file to separate integration tests into different jobs, changes to the test suite to improve database setup and teardown, and enhancements to the test suite to better handle cancellation and disposal of resources.
Changes to the CI/CD pipeline:
build/jobs/run-tests.yml
: The integration test job was split into two separate jobs,CosmosIntegrationTests
andSqlIntegrationTests
, to allow for more granular control over the execution of different types of integration tests. This change also involves the addition of new tasks to each job to execute the respective tests. [1] [2]Improvements to test suite:
test/Microsoft.Health.Fhir.Shared.Tests.Integration/Persistence/SqlServerFhirStorageTestHelper.cs
: The database setup and teardown process was improved by adding a semaphore to limit the number of concurrent operations and increasing the number of retries for certain operations. This should make the test suite more robust in the face of intermittent database connectivity issues. [1] [2] [3] [4] [5] [6]FhirStorageTestsFixtureArgumentSets
attribute to several test classes to specify that they should be run with theSqlServer
data store. This change makes the test suite more flexible and easier to configure. [1] [2] [3] [4] [5] [6] [7]Enhancements to cancellation and disposal:
src/Microsoft.Health.Fhir.SqlServer/Features/Watchdogs/FhirTimer.cs
: Improved the handling of cancellation in theRunInternalAsync
method to immediately return if cancellation is requested.test/Microsoft.Health.Fhir.Shared.Tests.Integration/Features/ChangeFeed/SqlServerFhirResourceChangeCaptureDisabledTests.cs
andtest/Microsoft.Health.Fhir.Shared.Tests.Integration/Features/ChangeFeed/SqlServerFhirResourceChangeCaptureFixture.cs
: Modified the disposal of resources in test classes to check if the resource is null before attempting to dispose of it. This change makes the test suite more robust in the face of unexpected errors during setup. [1] [2]Related issues
Addresses AB#120046
Testing
Describe how this change was tested.
FHIR Team Checklist
Semver Change (docs)
Patch|Skip|Feature|Breaking (reason)