mirror of
https://github.com/floci-io/floci.git
synced 2026-12-01 01:12:48 -05:00
test(elbv2): share one real-data-plane test profile instead of four identical ones (#4162)
Four ELBv2 test classes declared an identical real-data-plane profile. Quarkus restarts the application once per distinct profile class, so the four copies meant four starts for one configuration. Share a single profile class; the four classes then run against one application.
This commit is contained in:
1 parent
5aed2e8432
commit
4d8af159f6
5 files changed
+26
-41
No files matched your search
+2
-10
@@ -1,8 +1,8 @@
|
||||
package io.github.hectorvent.floci.services.apigatewayv2;
|
||||
|
||||
import com.sun.net.httpserver.HttpServer;
|
||||
import io.github.hectorvent.floci.testing.RealElbV2DataPlaneProfile;
|
||||
import io.quarkus.test.junit.QuarkusTest;
|
||||
import io.quarkus.test.junit.QuarkusTestProfile;
|
||||
import io.quarkus.test.junit.TestProfile;
|
||||
import io.restassured.http.ContentType;
|
||||
import io.restassured.response.Response;
|
||||
@@ -21,25 +21,17 @@ import java.io.OutputStream;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.net.Socket;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Map;
|
||||
|
||||
import static io.restassured.RestAssured.given;
|
||||
import static org.hamcrest.Matchers.*;
|
||||
|
||||
/** End-to-end: HTTP API → ALB listener ARN → ELBv2 data plane → registered stub target. */
|
||||
@QuarkusTest
|
||||
@TestProfile(ApiGatewayV2AlbIntegrationTest.RealElbV2Profile.class)
|
||||
@TestProfile(RealElbV2DataPlaneProfile.class)
|
||||
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
|
||||
class ApiGatewayV2AlbIntegrationTest {
|
||||
|
||||
/** Overrides the default {@code elbv2.mock=true} so the listener actually binds. */
|
||||
public static class RealElbV2Profile implements QuarkusTestProfile {
|
||||
@Override
|
||||
public Map<String, String> getConfigOverrides() {
|
||||
return Map.of("floci.services.elbv2.mock", "false");
|
||||
}
|
||||
}
|
||||
|
||||
private static final String AUTH =
|
||||
"AWS4-HMAC-SHA256 Credential=test/20260520/us-east-1/elasticloadbalancing/aws4_request";
|
||||
|
||||
|
||||
+2
-10
@@ -1,7 +1,7 @@
|
||||
package io.github.hectorvent.floci.services.elbv2;
|
||||
|
||||
import io.github.hectorvent.floci.testing.RealElbV2DataPlaneProfile;
|
||||
import io.quarkus.test.junit.QuarkusTest;
|
||||
import io.quarkus.test.junit.QuarkusTestProfile;
|
||||
import io.quarkus.test.junit.TestProfile;
|
||||
import io.restassured.response.Response;
|
||||
import org.junit.jupiter.api.MethodOrderer;
|
||||
@@ -12,7 +12,6 @@ import org.junit.jupiter.api.TestMethodOrder;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Base64;
|
||||
import java.util.Map;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipOutputStream;
|
||||
|
||||
@@ -34,17 +33,10 @@ import static org.hamcrest.Matchers.equalTo;
|
||||
* disables that override to exercise the real listener.
|
||||
*/
|
||||
@QuarkusTest
|
||||
@TestProfile(ElbV2LambdaTargetDataPlaneIntegrationTest.RealElbV2DataPlaneProfile.class)
|
||||
@TestProfile(RealElbV2DataPlaneProfile.class)
|
||||
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
|
||||
class ElbV2LambdaTargetDataPlaneIntegrationTest {
|
||||
|
||||
public static final class RealElbV2DataPlaneProfile implements QuarkusTestProfile {
|
||||
@Override
|
||||
public Map<String, String> getConfigOverrides() {
|
||||
return Map.of("floci.services.elbv2.mock", "false");
|
||||
}
|
||||
}
|
||||
|
||||
private static final String AUTH =
|
||||
"AWS4-HMAC-SHA256 Credential=test/20260427/us-east-1/elasticloadbalancing/aws4_request";
|
||||
private static final String FN = "alb-target-dataplane-fn";
|
||||
|
||||
+2
-10
@@ -1,7 +1,7 @@
|
||||
package io.github.hectorvent.floci.services.elbv2;
|
||||
|
||||
import io.github.hectorvent.floci.testing.RealElbV2DataPlaneProfile;
|
||||
import io.quarkus.test.junit.QuarkusTest;
|
||||
import io.quarkus.test.junit.QuarkusTestProfile;
|
||||
import io.quarkus.test.junit.TestProfile;
|
||||
import io.vertx.core.buffer.Buffer;
|
||||
import io.vertx.core.Vertx;
|
||||
@@ -20,7 +20,6 @@ import java.net.ServerSocket;
|
||||
import java.net.Socket;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.time.Duration;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@@ -31,16 +30,9 @@ import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
@QuarkusTest
|
||||
@TestProfile(ElbV2PreserveHostHeaderIntegrationTest.RealElbV2DataPlaneProfile.class)
|
||||
@TestProfile(RealElbV2DataPlaneProfile.class)
|
||||
class ElbV2PreserveHostHeaderIntegrationTest {
|
||||
|
||||
public static final class RealElbV2DataPlaneProfile implements QuarkusTestProfile {
|
||||
@Override
|
||||
public Map<String, String> getConfigOverrides() {
|
||||
return Map.of("floci.services.elbv2.mock", "false");
|
||||
}
|
||||
}
|
||||
|
||||
private static final String AUTH =
|
||||
"AWS4-HMAC-SHA256 Credential=test/20260803/us-east-1/elasticloadbalancing/aws4_request";
|
||||
private static final int LISTENER_PORT = 7794;
|
||||
|
||||
+2
-11
@@ -1,31 +1,22 @@
|
||||
package io.github.hectorvent.floci.services.elbv2;
|
||||
|
||||
import io.github.hectorvent.floci.testing.RealElbV2DataPlaneProfile;
|
||||
import io.quarkus.test.junit.QuarkusTest;
|
||||
import io.quarkus.test.junit.QuarkusTestProfile;
|
||||
import io.quarkus.test.junit.TestProfile;
|
||||
import org.junit.jupiter.api.MethodOrderer;
|
||||
import org.junit.jupiter.api.Order;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.TestMethodOrder;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import static io.restassured.RestAssured.given;
|
||||
import static org.hamcrest.Matchers.anyOf;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
|
||||
@QuarkusTest
|
||||
@TestProfile(ElbV2SamePortHostDispatchIntegrationTest.RealElbV2DataPlaneProfile.class)
|
||||
@TestProfile(RealElbV2DataPlaneProfile.class)
|
||||
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
|
||||
class ElbV2SamePortHostDispatchIntegrationTest {
|
||||
|
||||
public static final class RealElbV2DataPlaneProfile implements QuarkusTestProfile {
|
||||
@Override
|
||||
public Map<String, String> getConfigOverrides() {
|
||||
return Map.of("floci.services.elbv2.mock", "false");
|
||||
}
|
||||
}
|
||||
|
||||
private static final String AUTH =
|
||||
"AWS4-HMAC-SHA256 Credential=test/20260629/us-east-1/elasticloadbalancing/aws4_request";
|
||||
private static final int LISTENER_PORT = 7793;
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
package io.github.hectorvent.floci.testing;
|
||||
|
||||
import io.quarkus.test.junit.QuarkusTestProfile;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Runs the real ELBv2 data plane instead of the mock, and nothing else. Quarkus restarts and
|
||||
* re-augments the application once per distinct profile class, so the classes that need only this
|
||||
* override share this one rather than each declaring an identical nested profile.
|
||||
*/
|
||||
public class RealElbV2DataPlaneProfile implements QuarkusTestProfile {
|
||||
|
||||
@Override
|
||||
public Map<String, String> getConfigOverrides() {
|
||||
return Map.of("floci.services.elbv2.mock", "false");
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user