Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

toxiproxy test #2626

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions tests/environment/docker-compose-cmis-elastic-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ services:
-Dalfresco.host=localhost
-Dalfresco.port=8082
-Daos.baseUrlOverwrite=http://localhost:8080/alfresco/aos
-Dmessaging.broker.url="failover:(nio://activemq:61616)?timeout=3000&jms.useCompression=true"
-Dmessaging.broker.url="failover:(nio://toxiproxy:30000)?timeout=3000&jms.useCompression=true"
-Ddeployment.method=DOCKER_COMPOSE
-Dtransform.service.enabled=true
-Dtransform.service.url=http://transform-router:8095
Expand Down Expand Up @@ -57,6 +57,16 @@ services:
ports:
- 5432:5432

toxiproxy:
depends_on:
- activemq
image: ghcr.io/shopify/toxiproxy:2.7.0
volumes:
- ./tests/toxiproxy-config.json:/opt/toxiproxy/config.json
command: ["-config", "/opt/toxiproxy/config.json", "-host=0.0.0.0"]
ports:
- "8474:8474"

transform-router:
mem_limit: 512m
image: quay.io/alfresco/alfresco-transform-router:${TRANSFORM_ROUTER_TAG}
Expand Down Expand Up @@ -177,7 +187,7 @@ services:
environment:
ELASTICSEARCH_INDEXNAME: alfresco
SPRING_ELASTICSEARCH_REST_URIS: http://elasticsearch:9200
SPRING_ACTIVEMQ_BROKERURL: nio://activemq:61616
SPRING_ACTIVEMQ_BROKERURL: nio://toxiproxy:30001
ALFRESCO_SHAREDFILESTORE_BASEURL: http://shared-file-store:8099/alfresco/api/-default-/private/sfs/versions/1/file/
ALFRESCO_ACCEPTEDCONTENTMEDIATYPESCACHE_BASEURL: http://transform-core-aio:8090/transform/config

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import org.testcontainers.containers.GenericContainer;
import org.testcontainers.containers.Network;
import org.testcontainers.containers.PostgreSQLContainer;
import org.testcontainers.images.builder.Transferable;

class ACSEnv extends BaseACSEnv
{
Expand All @@ -20,6 +21,7 @@ public ACSEnv(Config cfg, final Network network, final String indexSubsystemName
postgres = createPostgresContainer(network);

createActiveMqContainer(network);
createToxiproxyContainer(network);
createSharedFileStoreContainer(network);
createTransformCoreAIOContainer(network);
createTransformRouterContainer(network);
Expand All @@ -36,6 +38,7 @@ public ACSEnv(GenericContainer<?> postgres, Config cfg, String indexSubsystemNam
registerCreatedContainer(postgres);

createActiveMqContainer(network);
createToxiproxyContainer(network);
createSharedFileStoreContainer(network);
createTransformCoreAIOContainer(network);
createTransformRouterContainer(network);
Expand Down Expand Up @@ -70,6 +73,14 @@ public void startLiveIndexing()
liveIndexing.start();
}

private void createToxiproxyContainer(Network network)
{
newContainer(GenericContainer.class, "ghcr.io/shopify/toxiproxy:2.7.0")
.withCommand("-config", "/opt/toxiproxy/config.json", "-host=0.0.0.0")
.withCopyToContainer(Transferable.of("tests/toxiproxy-config.json"),"./toxiproxy-config.json")
.withNetwork(network);
}

private GenericContainer<?> createRepositoryContainer(Network network, String indexSubsystemName)
{
return newContainer(GenericContainer.class, cfg.getRepositoryImage())
Expand All @@ -96,7 +107,7 @@ private GenericContainer<?> createRepositoryContainer(Network network, String in
"-Dindex.subsystem.name=" + indexSubsystemName + " " +
"-Dalfresco.host=localhost " +
"-Dalfresco.port=8080 " +
"-Dmessaging.broker.url=\"failover:(nio://activemq:61616)?timeout=3000&jms.useCompression=true\" " +
"-Dmessaging.broker.url=\"failover:(nio://toxiproxy:30000)?timeout=3000&jms.useCompression=true\" " +
"-Ddeployment.method=DOCKER_COMPOSE " +
"-Dtransform.service.enabled=true " +
"-Dtransform.service.url=http://transform-router:8095 " +
Expand Down Expand Up @@ -161,7 +172,7 @@ private GenericContainer<?> createReIndexingContainer(long fromId, long toId)
return newContainer(GenericContainer.class, cfg.getReIndexingImage())
.withEnv("ELASTICSEARCH_INDEXNAME", cfg.getIndexName())
.withEnv("SPRING_ELASTICSEARCH_REST_URIS", "http://" + cfg.getElasticsearchHostname() + ":9200")
.withEnv("SPRING_ACTIVEMQ_BROKERURL", "nio://activemq:61616")
.withEnv("SPRING_ACTIVEMQ_BROKERURL", "nio://toxiproxy:30002")
.withEnv("ALFRESCO_SHAREDFILESTORE_BASEURL", "http://shared-file-store:8099/alfresco/api/-default-/private/sfs/versions/1/file/")
.withEnv("ALFRESCO_ACCEPTEDCONTENTMEDIATYPESCACHE_BASEURL", "http://transform-core-aio:8090/transform/config")
.withEnv("SPRING_DATASOURCE_URL", "jdbc:postgresql://postgres:5432/alfresco")
Expand All @@ -177,7 +188,7 @@ private GenericContainer<?> createLiveIndexingContainer()
return newContainer(GenericContainer.class, cfg.getLiveIndexingImage())
.withEnv("ELASTICSEARCH_INDEXNAME", cfg.getIndexName())
.withEnv("SPRING_ELASTICSEARCH_REST_URIS", "http://" + cfg.getElasticsearchHostname() + ":9200")
.withEnv("SPRING_ACTIVEMQ_BROKERURL", "nio://activemq:61616")
.withEnv("SPRING_ACTIVEMQ_BROKERURL", "nnio://toxiproxy:30001")
.withEnv("ALFRESCO_SHAREDFILESTORE_BASEURL", "http://shared-file-store:8099/alfresco/api/-default-/private/sfs/versions/1/file/")
.withEnv("ALFRESCO_ACCEPTEDCONTENTMEDIATYPESCACHE_BASEURL", "http://transform-core-aio:8090/transform/config")
.withNetwork(alfresco.getNetwork());
Expand Down
21 changes: 21 additions & 0 deletions tests/toxiproxy-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[
{
"name": "alfresco-activemq",
"listen": "[::]:30000",
"upstream": "activemq:61616",
"enabled": true
},
{
"name": "indexing-activemq",
"listen": "[::]:30001",
"upstream": "activemq:61616",
"enabled": true,
"latency": 1000
},
{
"name": "reindexing-activemq",
"listen": "[::]:30002",
"upstream": "activemq:61616",
"enabled": true
}
]
Loading