Browse Source

Polishing.

Clean up residual observations after tests.

See #5082
Original pull request #5083
issue/aot-doc
Mark Paluch 2 months ago committed by Jens Schauder
parent
commit
03e79077fa
No known key found for this signature in database
GPG Key ID: 2BE5D185CD2A1CE6
  1. 10
      spring-data-mongodb/src/test/java/org/springframework/data/mongodb/observability/MongoObservationCommandListenerTests.java

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

@ -31,6 +31,7 @@ import reactor.core.publisher.BaseSubscriber; @@ -31,6 +31,7 @@ import reactor.core.publisher.BaseSubscriber;
import org.assertj.core.api.Assertions;
import org.bson.BsonDocument;
import org.bson.BsonString;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@ -72,6 +73,15 @@ class MongoObservationCommandListenerTests { @@ -72,6 +73,15 @@ class MongoObservationCommandListenerTests {
this.listener = new MongoObservationCommandListener(observationRegistry);
}
@AfterEach
void tearDown() {
Observation currentObservation = observationRegistry.getCurrentObservation();
if (currentObservation != null) {
currentObservation.stop();
observationRegistry.setCurrentObservationScope(null);
}
}
@Test
void commandStartedShouldNotInstrumentWhenAdminDatabase() {

Loading…
Cancel
Save