mirror of
https://github.com/floci-io/floci.git
synced 2026-12-01 01:12:48 -05:00
test: fold two Quarkus test profiles into PerServicePersistentStorageProfile (#8827)
Quarkus builds one application per distinct test profile at discovery and keeps each for the rest of the surefire JVM, so every profile a shard holds costs heap. The profiles nested in CloudFormationEcsLinuxParametersIntegrationTest (/dev/fuse as an ECS host volume root) and IamStsSharedEnablementIntegrationTest (IAM off) now share PerServicePersistentStorageProfile. No other class here registers an ECS task definition or calls IAM or STS, and the persistent classes call neither.
This commit is contained in:
1 parent
84933a9b90
commit
240ab6b381
3 files changed
+28
-30
No files matched your search
@@ -1,17 +1,16 @@
|
||||
package io.floci.aws.core.common;
|
||||
|
||||
import io.floci.aws.testing.PerServicePersistentStorageProfile;
|
||||
import io.quarkus.test.junit.QuarkusTest;
|
||||
import io.quarkus.test.junit.QuarkusTestProfile;
|
||||
import io.quarkus.test.junit.TestProfile;
|
||||
import jakarta.inject.Inject;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
|
||||
/** Turning IAM off turns STS off too. {@link PerServicePersistentStorageProfile} turns IAM off. */
|
||||
@QuarkusTest
|
||||
@TestProfile(IamStsSharedEnablementIntegrationTest.IamDisabledProfile.class)
|
||||
@TestProfile(PerServicePersistentStorageProfile.class)
|
||||
class IamStsSharedEnablementIntegrationTest {
|
||||
|
||||
@Inject
|
||||
@@ -22,11 +21,4 @@ class IamStsSharedEnablementIntegrationTest {
|
||||
assertFalse(serviceRegistry.isServiceEnabled("iam"));
|
||||
assertFalse(serviceRegistry.isServiceEnabled("sts"));
|
||||
}
|
||||
|
||||
public static final class IamDisabledProfile implements QuarkusTestProfile {
|
||||
@Override
|
||||
public Map<String, String> getConfigOverrides() {
|
||||
return Map.of("floci.services.iam.enabled", "false");
|
||||
}
|
||||
}
|
||||
}
|
||||
+5
-13
@@ -1,9 +1,9 @@
|
||||
package io.floci.aws.services.cloudformation;
|
||||
|
||||
import io.floci.aws.testing.CfnStackWaits;
|
||||
import io.floci.aws.testing.PerServicePersistentStorageProfile;
|
||||
import io.floci.aws.testing.RestAssuredJsonUtils;
|
||||
import io.quarkus.test.junit.QuarkusTest;
|
||||
import io.quarkus.test.junit.QuarkusTestProfile;
|
||||
import io.quarkus.test.junit.TestProfile;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
@@ -24,22 +24,14 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
* An {@code AWS::ECS::TaskDefinition} container's {@code LinuxParameters} reach the task
|
||||
* definition as RegisterTaskDefinition keeps them: DescribeTaskDefinition shows them in the API's
|
||||
* shape, and the Fargate rules RegisterTaskDefinition applies to them apply to a template too.
|
||||
*
|
||||
* <p>Floci refuses a host path outside {@code floci.services.ecs.host-volume-roots} by default; the
|
||||
* template's device, {@code /dev/fuse}, is let through by {@link PerServicePersistentStorageProfile}.
|
||||
*/
|
||||
@QuarkusTest
|
||||
@TestProfile(CloudFormationEcsLinuxParametersIntegrationTest.DeviceProfile.class)
|
||||
@TestProfile(PerServicePersistentStorageProfile.class)
|
||||
class CloudFormationEcsLinuxParametersIntegrationTest {
|
||||
|
||||
/**
|
||||
* Floci refuses a host path outside {@code floci.services.ecs.host-volume-roots} by default; the
|
||||
* template's device, {@code /dev/fuse}, is let through.
|
||||
*/
|
||||
public static final class DeviceProfile implements QuarkusTestProfile {
|
||||
@Override
|
||||
public Map<String, String> getConfigOverrides() {
|
||||
return Map.of("floci.services.ecs.host-volume-roots", "/dev/fuse");
|
||||
}
|
||||
}
|
||||
|
||||
private static final String ECS_CT = "application/x-amz-json-1.1";
|
||||
private static final String ECS_TARGET = "AmazonEC2ContainerServiceV20141113.";
|
||||
|
||||
|
||||
@@ -6,8 +6,10 @@ import java.util.Map;
|
||||
|
||||
/**
|
||||
* DynamoDB, ACM and S3 on persistent storage while every other service stays on the test default,
|
||||
* memory, for the classes that test a per-service storage mode. Quarkus builds the application
|
||||
* once per distinct profile class, so they share this one rather than each declaring their own.
|
||||
* memory, for the classes that test a per-service storage mode, and the settings of two other
|
||||
* classes that share the application. Quarkus builds the application once per distinct profile
|
||||
* class, and keeps every one it built for the rest of the test JVM, so they share this one rather
|
||||
* than each declaring their own.
|
||||
*
|
||||
* <p>The overrides, and who relies on them:
|
||||
* <ul>
|
||||
@@ -22,17 +24,27 @@ import java.util.Map;
|
||||
* checks that its object is a file before fetching it through a distribution.</li>
|
||||
* <li>{@code floci.storage.persistent-path=}{@value #STORAGE_DIR} is the directory those files go
|
||||
* in, where each class looks for its own. All three rely on it.</li>
|
||||
* <li>{@code floci.services.ecs.host-volume-roots=/dev/fuse} lets a task definition name the host
|
||||
* path {@code /dev/fuse}, which Floci otherwise refuses.
|
||||
* {@code CloudFormationEcsLinuxParametersIntegrationTest} relies on it.</li>
|
||||
* <li>{@code floci.services.iam.enabled=false} turns IAM off, and STS with it.
|
||||
* {@code IamStsSharedEnablementIntegrationTest} relies on it.</li>
|
||||
* </ul>
|
||||
*
|
||||
* <p>Each override is inert for the other classes, since each reaches a single service and each
|
||||
* class is the only one here that calls its service. {@code StorageFactoryDuplicateBackendTest}
|
||||
* class is the only one here that calls its service. No class here calls IAM or STS or registers
|
||||
* an ECS task definition apart from the two that rely on those settings, and the persistent path
|
||||
* moves where this application writes what services keep on disk whatever their storage mode,
|
||||
* Timestream backups and Lambda code-volume markers among them, each under its own directory. {@code StorageFactoryDuplicateBackendTest}
|
||||
* clears every store before and after it runs, and writes placeholder strings into DynamoDB's
|
||||
* table store in between, so no other class here may call DynamoDB, and none may count on state
|
||||
* outliving its own class.
|
||||
*
|
||||
* <p>Each class also deletes what it creates, so a class that joins later finds nothing left
|
||||
* behind. A class joins only if no other class here calls its service, and it deletes what it
|
||||
* creates.
|
||||
* behind.
|
||||
*
|
||||
* <p>A class joins if every setting here is either one it relies on or one that never reaches its
|
||||
* requests, and if any setting it adds never reaches the requests of a class already here. It must also delete what it creates and must not call DynamoDB.
|
||||
*/
|
||||
public class PerServicePersistentStorageProfile implements QuarkusTestProfile {
|
||||
|
||||
@@ -44,6 +56,8 @@ public class PerServicePersistentStorageProfile implements QuarkusTestProfile {
|
||||
"floci.storage.services.dynamodb.mode", "persistent",
|
||||
"floci.storage.services.acm.mode", "persistent",
|
||||
"floci.storage.services.s3.mode", "persistent",
|
||||
"floci.storage.persistent-path", STORAGE_DIR);
|
||||
"floci.storage.persistent-path", STORAGE_DIR,
|
||||
"floci.services.ecs.host-volume-roots", "/dev/fuse",
|
||||
"floci.services.iam.enabled", "false");
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user