Skip to content

Commit c8d672b

Browse files
committed
Add @DirtiesContext to fix integration tests
Signed-off-by: Felix Wang <wangfelix98@gmail.com>
1 parent a277f60 commit c8d672b

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

serving/src/test/java/feast/serving/it/ServingServiceIT.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
import org.junit.jupiter.api.Test;
5252
import org.springframework.boot.test.context.SpringBootTest;
5353
import org.springframework.boot.web.server.LocalServerPort;
54+
import org.springframework.test.annotation.DirtiesContext;
5455
import org.springframework.test.context.ActiveProfiles;
5556
import org.springframework.test.context.DynamicPropertyRegistry;
5657
import org.springframework.test.context.DynamicPropertySource;
@@ -65,6 +66,7 @@
6566
properties = {
6667
"feast.core-cache-refresh-interval=1",
6768
})
69+
@DirtiesContext(classMode = DirtiesContext.ClassMode.BEFORE_CLASS)
6870
@Testcontainers
6971
public 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

Comments
 (0)