5151import org .junit .jupiter .api .Test ;
5252import org .springframework .boot .test .context .SpringBootTest ;
5353import org .springframework .boot .web .server .LocalServerPort ;
54+ import org .springframework .test .annotation .DirtiesContext ;
5455import org .springframework .test .context .ActiveProfiles ;
5556import org .springframework .test .context .DynamicPropertyRegistry ;
5657import org .springframework .test .context .DynamicPropertySource ;
6566 properties = {
6667 "feast.core-cache-refresh-interval=1" ,
6768 })
69+ @ DirtiesContext (classMode = DirtiesContext .ClassMode .BEFORE_CLASS )
6870@ Testcontainers
6971public class ServingServiceIT extends BaseAuthIT {
7072
@@ -204,6 +206,7 @@ static void tearDown() {
204206
205207 /** Test that Feast Serving metrics endpoint can be accessed with authentication enabled */
206208 @ Test
209+ @ DirtiesContext (methodMode = DirtiesContext .MethodMode .AFTER_METHOD )
207210 public void shouldAllowUnauthenticatedAccessToMetricsEndpoint () throws IOException {
208211 Request request =
209212 new Request .Builder ()
@@ -216,6 +219,7 @@ public void shouldAllowUnauthenticatedAccessToMetricsEndpoint() throws IOExcepti
216219 }
217220
218221 @ Test
222+ @ DirtiesContext (methodMode = DirtiesContext .MethodMode .AFTER_METHOD )
219223 public void shouldRegisterAndGetOnlineFeatures () {
220224 // getOnlineFeatures Information
221225 String projectName = "default" ;
@@ -265,6 +269,7 @@ public void shouldRegisterAndGetOnlineFeatures() {
265269 }
266270
267271 @ Test
272+ @ DirtiesContext (methodMode = DirtiesContext .MethodMode .AFTER_METHOD )
268273 public void shouldRegisterAndGetOnlineFeaturesWithNotFound () {
269274 // getOnlineFeatures Information
270275 String projectName = "default" ;
@@ -327,6 +332,7 @@ public void shouldRegisterAndGetOnlineFeaturesWithNotFound() {
327332 }
328333
329334 @ Test
335+ @ DirtiesContext (methodMode = DirtiesContext .MethodMode .AFTER_METHOD )
330336 public void shouldGetOnlineFeaturesOutsideMaxAge () {
331337 String projectName = "default" ;
332338 String entityName = "driver_id" ;
@@ -376,6 +382,7 @@ public void shouldGetOnlineFeaturesOutsideMaxAge() {
376382 }
377383
378384 @ Test
385+ @ DirtiesContext (methodMode = DirtiesContext .MethodMode .AFTER_METHOD )
379386 public void shouldReturnNotFoundForDiffType () {
380387 String projectName = "default" ;
381388 String entityName = "driver_id" ;
@@ -425,6 +432,7 @@ public void shouldReturnNotFoundForDiffType() {
425432 }
426433
427434 @ Test
435+ @ DirtiesContext (methodMode = DirtiesContext .MethodMode .AFTER_METHOD )
428436 public void shouldReturnNotFoundForUpdatedType () {
429437 String projectName = "default" ;
430438 String entityName = "driver_id" ;
0 commit comments