diff --git a/tests/environment/docker-compose-cmis-elastic-tests.yml b/tests/environment/docker-compose-cmis-elastic-tests.yml index 04cae1d8e1..199c4256fa 100755 --- a/tests/environment/docker-compose-cmis-elastic-tests.yml +++ b/tests/environment/docker-compose-cmis-elastic-tests.yml @@ -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 @@ -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} @@ -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 diff --git a/tests/tas-elasticsearch/src/test/java/org/alfresco/elasticsearch/upgrade/ACSEnv.java b/tests/tas-elasticsearch/src/test/java/org/alfresco/elasticsearch/upgrade/ACSEnv.java index e0e9d3abec..bac523ef16 100644 --- a/tests/tas-elasticsearch/src/test/java/org/alfresco/elasticsearch/upgrade/ACSEnv.java +++ b/tests/tas-elasticsearch/src/test/java/org/alfresco/elasticsearch/upgrade/ACSEnv.java @@ -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 { @@ -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); @@ -36,6 +38,7 @@ public ACSEnv(GenericContainer postgres, Config cfg, String indexSubsystemNam registerCreatedContainer(postgres); createActiveMqContainer(network); + createToxiproxyContainer(network); createSharedFileStoreContainer(network); createTransformCoreAIOContainer(network); createTransformRouterContainer(network); @@ -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()) @@ -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 " + @@ -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") @@ -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()); diff --git a/tests/toxiproxy-config.json b/tests/toxiproxy-config.json new file mode 100644 index 0000000000..a836d3b538 --- /dev/null +++ b/tests/toxiproxy-config.json @@ -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 + } +]