Closed rajakumare1 closed 2 months ago
@rajakumare1 .. hmm.. spring should handle this case.. but i will have a look into that.. maybe something is missing. Maybe this is this @testinstance(TestInstance.Lifecycle.PER_CLASS) and beforeEach .. but this is just a wild guess.
Should be solved with newer versions of this library..
If there is any exception in the data setup in @BeforeEach, we are seeing the mongd is still running in the background If this populateMockTestCollection() method has an exception, the mongod is running without gracefully shutdown
`@ExtendWith(SpringExtension.class) @ActiveProfiles("test") @SpringBootTest( properties = "de.flapdoodle.mongodb.embedded.version=5.0.12" ) @Import({TestMongoConfiguration.class}) @AutoConfigureDataMongo() @TestInstance(TestInstance.Lifecycle.PER_CLASS) @DirtiesContext class ServiceIntegrationTest {
TestCollection testcollection = populateMockTestCollection(); // If this populateMockTestCollection has an exception, the mongod is running without shutdown testCollectionRepository.insert(testcollection); }
......
} @TestConfiguration
public class TestMongoConfiguration {
} `