完成单机TEST统一入口与可靠投递回归收尾
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
<parent><groupId>com.baiyue.firstleg</groupId><artifactId>baiyue-firstleg-platform</artifactId><version>1.0.0-SNAPSHOT</version><relativePath>../pom.xml</relativePath></parent>
|
||||
<artifactId>firstleg-service</artifactId>
|
||||
<dependencies>
|
||||
<dependency><groupId>com.h2database</groupId><artifactId>h2</artifactId><scope>test</scope></dependency>
|
||||
<dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-mail</artifactId></dependency>
|
||||
<dependency><groupId>com.baiyue.shared</groupId><artifactId>baiyue-common-core</artifactId><version>${project.version}</version></dependency>
|
||||
<dependency><groupId>com.baiyue.shared</groupId><artifactId>common-event-contract</artifactId><version>${project.version}</version></dependency>
|
||||
|
||||
+11
-10
@@ -12,21 +12,22 @@ class EventBridgeClientDeploymentContractTest {
|
||||
private static final Path REPOSITORY_ROOT = Path.of("..").toAbsolutePath().normalize();
|
||||
|
||||
@Test
|
||||
void firstlegBridgeTargetComesFromEnvironmentWithoutLoopbackFallback() throws Exception {
|
||||
void firstlegDirectTargetUsesServiceDiscoveryOrExplicitServiceUrl() throws Exception {
|
||||
String application = Files.readString(REPOSITORY_ROOT.resolve("firstleg/src/main/resources/application.yml"));
|
||||
String nacos = Files.readString(REPOSITORY_ROOT.resolve("config/nacos/cn/firstleg-service.yml"));
|
||||
|
||||
assertTrue(application.contains("event-bridge-url: ${LASTLEG_EVENT_BRIDGE_URL:}"));
|
||||
assertFalse(application.contains("LASTLEG_EVENT_BRIDGE_URL:http://127.0.0.1"));
|
||||
assertTrue(nacos.contains("event-bridge-url: ${LASTLEG_EVENT_BRIDGE_URL}"));
|
||||
String nacos = Files.readString(REPOSITORY_ROOT.resolve("config/nacos/test/firstleg-service.yml"));
|
||||
var feign = LastlegEventClient.class.getAnnotation(org.springframework.cloud.openfeign.FeignClient.class);
|
||||
assertTrue(feign.name().equals("lastleg-service"));
|
||||
assertTrue(feign.url().equals("${LASTLEG_SERVICE_URL:${baiyue.clients.lastleg.url:}}"));
|
||||
assertFalse((application + nacos).contains("EVENT_BRIDGE_URL"));
|
||||
assertFalse(feign.url().contains("127.0.0.1"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void cnComposeForwardsTargetAndPublishesStableNetworkAlias() throws Exception {
|
||||
void testComposeUsesDirectBusinessServiceDns() throws Exception {
|
||||
String compose = Files.readString(REPOSITORY_ROOT.resolve("deploy/docker-compose.yml"));
|
||||
|
||||
assertTrue(compose.contains("LASTLEG_EVENT_BRIDGE_URL: ${LASTLEG_EVENT_BRIDGE_URL}"));
|
||||
assertTrue(compose.contains("SERVER_PORT: 9312"));
|
||||
assertTrue(compose.contains("aliases: [event-bridge-cn]"));
|
||||
assertTrue(compose.contains("LASTLEG_SERVICE_URL: http://lastleg-service:9303"));
|
||||
assertTrue(compose.contains("firstleg-test-network"));
|
||||
assertFalse(compose.contains("event-bridge"));
|
||||
}
|
||||
}
|
||||
|
||||
+1
-2
@@ -14,8 +14,7 @@ class ContainerCustomsMultipartConfigurationContractTest {
|
||||
|
||||
@Test void applicationAndEnvironmentConfigsPermitFiftyMegabyteCustomsFiles() throws Exception {
|
||||
assertLimits(read("firstleg/src/main/resources/application.yml"));
|
||||
assertLimits(read("config/nacos/cn/firstleg-service.yml"));
|
||||
assertLimits(read("config/nacos/local/firstleg-service.yml"));
|
||||
assertLimits(read("config/nacos/test/firstleg-service.yml"));
|
||||
}
|
||||
|
||||
@Test void customsOpenApiPublishesFileAndMultipartRequestLimits() throws Exception {
|
||||
|
||||
@@ -29,7 +29,7 @@ class OutboxLeaseDatabaseTest {
|
||||
var repository = new LoadingCompletedOutboxRepository();
|
||||
ReflectionTestUtils.setField(repository, "mapper", mapper);
|
||||
var journal = new EventDeliveryJournal(jdbc, new DataSourceTransactionManager(dataSource));
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
LocalDateTime now = LocalDateTime.of(2026, 9, 29, 12, 0);
|
||||
jdbc.update("INSERT INTO fl_inbound_outbox(id,event_type,publish_status,retry_count,next_retry_at,created_at) VALUES(1,?,'PENDING',0,?,?)", "FirstLegLoadingPlanCompleted", now.minusSeconds(1), now.minusMinutes(3));
|
||||
assertThat(journal.begin("old", "firstleg", "FirstLegLoadingPlanCompleted", "1", null, "consumer", now.minusMinutes(2), () -> repository.claim(1L, "old", now.minusMinutes(2)))).isFalse();
|
||||
assertThat(journal.begin("old", "firstleg", "FirstLegLoadingPlanCompleted", "1", null, "consumer", now, () -> repository.claim(1L, "old", now))).isTrue();
|
||||
|
||||
Reference in New Issue
Block a user