提交
This commit is contained in:
+28
@@ -0,0 +1,28 @@
|
||||
package com.baiyue.gateway.config;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
class OverseasLastlegRouteContractTest {
|
||||
@Test
|
||||
void platformDispatchPathIsForwardedToLastlegWithoutPrefixRewrite() throws IOException {
|
||||
try (InputStream input = getClass().getResourceAsStream("/application-overseas.yml")) {
|
||||
assertThat(input).isNotNull();
|
||||
String yaml = new String(input.readAllBytes(), StandardCharsets.UTF_8);
|
||||
int routeStart = yaml.indexOf("- id: lastleg-service");
|
||||
int routeEnd = yaml.indexOf("- id: warehouse-overseas-service", routeStart);
|
||||
assertThat(routeStart).isGreaterThanOrEqualTo(0);
|
||||
assertThat(routeEnd).isGreaterThan(routeStart);
|
||||
String route = yaml.substring(routeStart, routeEnd);
|
||||
|
||||
assertThat(route).contains("uri: lb://lastleg-service")
|
||||
.contains("/api/platform/v1/last-leg/**")
|
||||
.doesNotContain("StripPrefix", "RewritePath");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user