From 755c16152745e5c7c65a63f857b55ead735e41d9 Mon Sep 17 00:00:00 2001 From: kmagdziarz Date: Tue, 31 Oct 2023 11:09:43 +0100 Subject: [PATCH 1/6] toxiproxy test --- .../docker-compose-cmis-elastic-tests.yml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/tests/environment/docker-compose-cmis-elastic-tests.yml b/tests/environment/docker-compose-cmis-elastic-tests.yml index 04cae1d8e1..8bd021a130 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: + - ./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} From 5086b0abd6ba678ca62aeaccbd64b1bb752bbf04 Mon Sep 17 00:00:00 2001 From: kmagdziarz Date: Tue, 31 Oct 2023 11:32:04 +0100 Subject: [PATCH 2/6] Add cofing --- tests/toxiproxy-config.json | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 tests/toxiproxy-config.json diff --git a/tests/toxiproxy-config.json b/tests/toxiproxy-config.json new file mode 100644 index 0000000000..1d8ea45d8f --- /dev/null +++ b/tests/toxiproxy-config.json @@ -0,0 +1,20 @@ +[ + { + "name": "alfresco-activemq", + "listen": "[::]:30000", + "upstream": "activemq:61616", + "enabled": true + }, + { + "name": "indexing-activemq", + "listen": "[::]:30001", + "upstream": "activemq:61616", + "enabled": true + }, + { + "name": "reindexing-activemq", + "listen": "[::]:30002", + "upstream": "activemq:61616", + "enabled": true + } +] From 02133fd9a31da1c0b623eb444eeceb988cdbbb37 Mon Sep 17 00:00:00 2001 From: kmagdziarz Date: Tue, 31 Oct 2023 11:46:52 +0100 Subject: [PATCH 3/6] Add cofing --- tests/environment/docker-compose-cmis-elastic-tests.yml | 2 +- tests/toxiproxy-config.json | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/environment/docker-compose-cmis-elastic-tests.yml b/tests/environment/docker-compose-cmis-elastic-tests.yml index 8bd021a130..fde1072b66 100755 --- a/tests/environment/docker-compose-cmis-elastic-tests.yml +++ b/tests/environment/docker-compose-cmis-elastic-tests.yml @@ -187,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/toxiproxy-config.json b/tests/toxiproxy-config.json index 1d8ea45d8f..a836d3b538 100644 --- a/tests/toxiproxy-config.json +++ b/tests/toxiproxy-config.json @@ -9,7 +9,8 @@ "name": "indexing-activemq", "listen": "[::]:30001", "upstream": "activemq:61616", - "enabled": true + "enabled": true, + "latency": 1000 }, { "name": "reindexing-activemq", From 1fb81a328e5aa33436d564ef846f774b6aac63e9 Mon Sep 17 00:00:00 2001 From: kmagdziarz Date: Tue, 31 Oct 2023 12:58:08 +0100 Subject: [PATCH 4/6] Add toxiproxy to test containers --- .../org/alfresco/elasticsearch/upgrade/ACSEnv.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) 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..f59d3eb846 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 @@ -20,6 +20,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 +37,7 @@ public ACSEnv(GenericContainer postgres, Config cfg, String indexSubsystemNam registerCreatedContainer(postgres); createActiveMqContainer(network); + createToxiproxyContainer(network); createSharedFileStoreContainer(network); createTransformCoreAIOContainer(network); createTransformRouterContainer(network); @@ -70,6 +72,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("./toxiproxy-config.json","/opt/toxiproxy/config.json") + .withNetwork(network) + } + private GenericContainer createRepositoryContainer(Network network, String indexSubsystemName) { return newContainer(GenericContainer.class, cfg.getRepositoryImage()) @@ -96,7 +106,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 " + From 1996f931bae7eaf931b4cc97234adf8d7275d6a3 Mon Sep 17 00:00:00 2001 From: kmagdziarz Date: Tue, 31 Oct 2023 14:39:29 +0100 Subject: [PATCH 5/6] fix toxiproxy config --- tests/environment/docker-compose-cmis-elastic-tests.yml | 2 +- .../test/java/org/alfresco/elasticsearch/upgrade/ACSEnv.java | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/environment/docker-compose-cmis-elastic-tests.yml b/tests/environment/docker-compose-cmis-elastic-tests.yml index fde1072b66..199c4256fa 100755 --- a/tests/environment/docker-compose-cmis-elastic-tests.yml +++ b/tests/environment/docker-compose-cmis-elastic-tests.yml @@ -62,7 +62,7 @@ services: - activemq image: ghcr.io/shopify/toxiproxy:2.7.0 volumes: - - ./toxiproxy-config.json:/opt/toxiproxy/config.json + - ./tests/toxiproxy-config.json:/opt/toxiproxy/config.json command: ["-config", "/opt/toxiproxy/config.json", "-host=0.0.0.0"] ports: - "8474:8474" 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 f59d3eb846..3e2f356788 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 { @@ -76,8 +77,8 @@ 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("./toxiproxy-config.json","/opt/toxiproxy/config.json") - .withNetwork(network) + .withCopyToContainer(Transferable.of("tests/toxiproxy-config.json"),"./toxiproxy-config.json") + .withNetwork(network); } private GenericContainer createRepositoryContainer(Network network, String indexSubsystemName) From ed138832c50e03e26f459695ea3bc8cc4c39ad12 Mon Sep 17 00:00:00 2001 From: kmagdziarz Date: Tue, 31 Oct 2023 14:50:27 +0100 Subject: [PATCH 6/6] fix toxiproxy config --- .../test/java/org/alfresco/elasticsearch/upgrade/ACSEnv.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 3e2f356788..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 @@ -172,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") @@ -188,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());