From a674a81b86b20263cf0c55e5c38703e6a663bff1 Mon Sep 17 00:00:00 2001 From: anawrotsoldevelo Date: Wed, 13 Dec 2023 14:34:32 +0100 Subject: [PATCH 1/2] CQI-14: Disable demo data loading for integration tests Demo data was previously being loaded before the tests were run, so they were affected by records fetched from a csv. --- .../org/openlmis/auth/ExposedMessageSourceIntegrationTest.java | 2 +- .../auth/repository/BaseCrudRepositoryIntegrationTest.java | 2 +- .../java/org/openlmis/auth/web/BaseWebIntegrationTest.java | 2 +- src/main/java/org/openlmis/auth/TestDataInitializer.java | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/integration-test/java/org/openlmis/auth/ExposedMessageSourceIntegrationTest.java b/src/integration-test/java/org/openlmis/auth/ExposedMessageSourceIntegrationTest.java index 5ea2d1a..ab86eb9 100644 --- a/src/integration-test/java/org/openlmis/auth/ExposedMessageSourceIntegrationTest.java +++ b/src/integration-test/java/org/openlmis/auth/ExposedMessageSourceIntegrationTest.java @@ -35,7 +35,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; @RunWith(SpringJUnit4ClassRunner.class) -@ActiveProfiles("test") +@ActiveProfiles("test", "test-run") @SpringBootTest(properties = "spring.main.allow-bean-definition-overriding=true") public class ExposedMessageSourceIntegrationTest { diff --git a/src/integration-test/java/org/openlmis/auth/repository/BaseCrudRepositoryIntegrationTest.java b/src/integration-test/java/org/openlmis/auth/repository/BaseCrudRepositoryIntegrationTest.java index ab7d2b7..0631c52 100644 --- a/src/integration-test/java/org/openlmis/auth/repository/BaseCrudRepositoryIntegrationTest.java +++ b/src/integration-test/java/org/openlmis/auth/repository/BaseCrudRepositoryIntegrationTest.java @@ -30,7 +30,7 @@ @RunWith(SpringRunner.class) @SpringBootTest(properties = "spring.main.allow-bean-definition-overriding=true") -@ActiveProfiles("test") +@ActiveProfiles("test", "test-run") @Transactional public abstract class BaseCrudRepositoryIntegrationTest { diff --git a/src/integration-test/java/org/openlmis/auth/web/BaseWebIntegrationTest.java b/src/integration-test/java/org/openlmis/auth/web/BaseWebIntegrationTest.java index 6cefbbf..a7377f0 100644 --- a/src/integration-test/java/org/openlmis/auth/web/BaseWebIntegrationTest.java +++ b/src/integration-test/java/org/openlmis/auth/web/BaseWebIntegrationTest.java @@ -68,7 +68,7 @@ @RunWith(SpringRunner.class) @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, properties = "spring.main.allow-bean-definition-overriding=true") -@ActiveProfiles("test") +@ActiveProfiles("test", "test-run") @DirtiesContext public abstract class BaseWebIntegrationTest { private static final String BASE_URL = System.getenv("BASE_URL"); diff --git a/src/main/java/org/openlmis/auth/TestDataInitializer.java b/src/main/java/org/openlmis/auth/TestDataInitializer.java index 74c1cd9..8d0e0bf 100644 --- a/src/main/java/org/openlmis/auth/TestDataInitializer.java +++ b/src/main/java/org/openlmis/auth/TestDataInitializer.java @@ -28,7 +28,7 @@ import org.springframework.stereotype.Component; @Component -@Profile("demo-data") +@Profile("demo-data & !test-run") @Order(5) public class TestDataInitializer implements CommandLineRunner { From a840df5b4405f4b644d7e82f7966cdeeae1a0034 Mon Sep 17 00:00:00 2001 From: anawrotsoldevelo Date: Wed, 13 Dec 2023 16:51:46 +0100 Subject: [PATCH 2/2] CQI-14: Added missing curly brace --- .../org/openlmis/auth/ExposedMessageSourceIntegrationTest.java | 2 +- .../auth/repository/BaseCrudRepositoryIntegrationTest.java | 2 +- .../java/org/openlmis/auth/web/BaseWebIntegrationTest.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/integration-test/java/org/openlmis/auth/ExposedMessageSourceIntegrationTest.java b/src/integration-test/java/org/openlmis/auth/ExposedMessageSourceIntegrationTest.java index ab86eb9..c53665b 100644 --- a/src/integration-test/java/org/openlmis/auth/ExposedMessageSourceIntegrationTest.java +++ b/src/integration-test/java/org/openlmis/auth/ExposedMessageSourceIntegrationTest.java @@ -35,7 +35,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; @RunWith(SpringJUnit4ClassRunner.class) -@ActiveProfiles("test", "test-run") +@ActiveProfiles({"test", "test-run"}) @SpringBootTest(properties = "spring.main.allow-bean-definition-overriding=true") public class ExposedMessageSourceIntegrationTest { diff --git a/src/integration-test/java/org/openlmis/auth/repository/BaseCrudRepositoryIntegrationTest.java b/src/integration-test/java/org/openlmis/auth/repository/BaseCrudRepositoryIntegrationTest.java index 0631c52..0f7ad29 100644 --- a/src/integration-test/java/org/openlmis/auth/repository/BaseCrudRepositoryIntegrationTest.java +++ b/src/integration-test/java/org/openlmis/auth/repository/BaseCrudRepositoryIntegrationTest.java @@ -30,7 +30,7 @@ @RunWith(SpringRunner.class) @SpringBootTest(properties = "spring.main.allow-bean-definition-overriding=true") -@ActiveProfiles("test", "test-run") +@ActiveProfiles({"test", "test-run"}) @Transactional public abstract class BaseCrudRepositoryIntegrationTest { diff --git a/src/integration-test/java/org/openlmis/auth/web/BaseWebIntegrationTest.java b/src/integration-test/java/org/openlmis/auth/web/BaseWebIntegrationTest.java index a7377f0..7de91db 100644 --- a/src/integration-test/java/org/openlmis/auth/web/BaseWebIntegrationTest.java +++ b/src/integration-test/java/org/openlmis/auth/web/BaseWebIntegrationTest.java @@ -68,7 +68,7 @@ @RunWith(SpringRunner.class) @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, properties = "spring.main.allow-bean-definition-overriding=true") -@ActiveProfiles("test", "test-run") +@ActiveProfiles({"test", "test-run"}) @DirtiesContext public abstract class BaseWebIntegrationTest { private static final String BASE_URL = System.getenv("BASE_URL");