From e6608bd0a2813f4fb54b3bd8937aabc2b5f69c5a Mon Sep 17 00:00:00 2001 From: Marcos Barbero Date: Mon, 26 Oct 2020 11:51:11 +0100 Subject: [PATCH] Add dirty context --- .../main/resources/override-deny-request.properties | 1 + .../tests/it/SpringDataApplicationTestIT.java | 11 +++++------ 2 files changed, 6 insertions(+), 6 deletions(-) create mode 100644 spring-cloud-zuul-ratelimit-tests/springdata/src/main/resources/override-deny-request.properties diff --git a/spring-cloud-zuul-ratelimit-tests/springdata/src/main/resources/override-deny-request.properties b/spring-cloud-zuul-ratelimit-tests/springdata/src/main/resources/override-deny-request.properties new file mode 100644 index 00000000..4c117247 --- /dev/null +++ b/spring-cloud-zuul-ratelimit-tests/springdata/src/main/resources/override-deny-request.properties @@ -0,0 +1 @@ +zuul.ratelimit.deny-request.origins[0]= \ No newline at end of file diff --git a/spring-cloud-zuul-ratelimit-tests/springdata/src/test/java/com/marcosbarbero/tests/it/SpringDataApplicationTestIT.java b/spring-cloud-zuul-ratelimit-tests/springdata/src/test/java/com/marcosbarbero/tests/it/SpringDataApplicationTestIT.java index 321f11d0..34b99ffc 100644 --- a/spring-cloud-zuul-ratelimit-tests/springdata/src/test/java/com/marcosbarbero/tests/it/SpringDataApplicationTestIT.java +++ b/spring-cloud-zuul-ratelimit-tests/springdata/src/test/java/com/marcosbarbero/tests/it/SpringDataApplicationTestIT.java @@ -10,6 +10,8 @@ import org.springframework.boot.test.web.client.TestRestTemplate; import org.springframework.http.HttpHeaders; import org.springframework.http.ResponseEntity; +import org.springframework.test.annotation.DirtiesContext; +import org.springframework.test.context.TestPropertySource; import java.util.UUID; import java.util.concurrent.TimeUnit; @@ -24,12 +26,9 @@ * @author Marcos Barbero * @since 2017-06-27 */ -@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT -// properties = { - // just making sure the test on SpringDataDenyOriginTestIT does not mess with the tests on this class -// "zuul.ratelimit.deny-request.origins[0]=10.0.0.1" -// }) -) +@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) +@TestPropertySource(locations = "classpath:/override-deny-request.properties") +@DirtiesContext(classMode = DirtiesContext.ClassMode.BEFORE_EACH_TEST_METHOD) public class SpringDataApplicationTestIT { @Autowired