Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 03e7907

Browse files
mp911deschauder
authored andcommitted
Polishing.
Clean up residual observations after tests. See #5082 Original pull request #5083
1 parent 791d64f commit 03e7907

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

‎spring-data-mongodb/src/test/java/org/springframework/data/mongodb/observability/MongoObservationCommandListenerTests.java‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
import org.assertj.core.api.Assertions;
3232
import org.bson.BsonDocument;
3333
import org.bson.BsonString;
34+
import org.junit.jupiter.api.AfterEach;
3435
import org.junit.jupiter.api.BeforeEach;
3536
import org.junit.jupiter.api.Test;
3637

@@ -72,6 +73,15 @@ void setup() {
7273
this.listener = new MongoObservationCommandListener(observationRegistry);
7374
}
7475

76+
@AfterEach
77+
void tearDown() {
78+
Observation currentObservation = observationRegistry.getCurrentObservation();
79+
if (currentObservation != null) {
80+
currentObservation.stop();
81+
observationRegistry.setCurrentObservationScope(null);
82+
}
83+
}
84+
7585
@Test
7686
void commandStartedShouldNotInstrumentWhenAdminDatabase() {
7787

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /