This is an automated email from the ASF dual-hosted git repository.

ppalaga pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git

commit 5cf60953c6c8df1b9ca83cddd5bf3fbd95652396
Author: Freeman Fang <freeman.f...@gmail.com>
AuthorDate: Fri Aug 20 14:13:36 2021 -0400

    fix SolrTest failure when using CloundContainer #2967
---
 .../component/solr/it/SolrTestResource.java        | 16 ++++--
 .../resources/cloud-docker-compose_nonlinux.yml    | 58 ++++++++++++++++++++++
 2 files changed, 70 insertions(+), 4 deletions(-)

diff --git 
a/integration-tests/solr/src/test/java/org/apache/camel/quarkus/component/solr/it/SolrTestResource.java
 
b/integration-tests/solr/src/test/java/org/apache/camel/quarkus/component/solr/it/SolrTestResource.java
index e7e6ee1..58123c9 100644
--- 
a/integration-tests/solr/src/test/java/org/apache/camel/quarkus/component/solr/it/SolrTestResource.java
+++ 
b/integration-tests/solr/src/test/java/org/apache/camel/quarkus/component/solr/it/SolrTestResource.java
@@ -21,6 +21,7 @@ import java.util.Map;
 
 import io.quarkus.test.common.QuarkusTestResourceLifecycleManager;
 import org.apache.camel.util.CollectionHelper;
+import org.apache.commons.lang3.SystemUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.testcontainers.containers.BindMode;
@@ -111,10 +112,17 @@ public class SolrTestResource implements 
QuarkusTestResourceLifecycleManager {
      * creates a cloud container with zookeeper
      */
     private void createCloudContainer() {
-        cloudContainer = new DockerComposeContainer(new 
File("src/test/resources/cloud-docker-compose.yml"))
-                .withExposedService("solr1", SOLR_PORT)
-                .withExposedService("zoo1", ZOOKEEPER_PORT)
-                .waitingFor("create-collection", Wait.forLogMessage(".*Created 
collection 'collection1'.*", 1));
+        if (SystemUtils.IS_OS_LINUX) {
+            cloudContainer = new DockerComposeContainer(new 
File("src/test/resources/cloud-docker-compose.yml"))
+                    .withExposedService("solr1", SOLR_PORT)
+                    .withExposedService("zoo1", ZOOKEEPER_PORT)
+                    .waitingFor("create-collection", 
Wait.forLogMessage(".*Created collection 'collection1'.*", 1));
+        } else {
+            cloudContainer = new DockerComposeContainer(new 
File("src/test/resources/cloud-docker-compose_nonlinux.yml"))
+                    .withExposedService("solr1", SOLR_PORT)
+                    .withExposedService("zoo1", ZOOKEEPER_PORT)
+                    .waitingFor("create-collection", 
Wait.forLogMessage(".*Created collection 'collection1'.*", 1));
+        }
     }
 
     @Override
diff --git 
a/integration-tests/solr/src/test/resources/cloud-docker-compose_nonlinux.yml 
b/integration-tests/solr/src/test/resources/cloud-docker-compose_nonlinux.yml
new file mode 100644
index 0000000..7fa239a
--- /dev/null
+++ 
b/integration-tests/solr/src/test/resources/cloud-docker-compose_nonlinux.yml
@@ -0,0 +1,58 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# based on 
https://raw.githubusercontent.com/docker-solr/docker-solr-examples/master/docker-compose/docker-compose.yml
+version: '3.7'
+services:
+  solr1:
+    image: solr:8.7.0
+    ports:
+     - "8983:8983"
+    environment:
+      - ZK_HOST=zoo1:2181
+      - SOLR_PORT=8983
+      - SOLR_HOST=localhost
+    networks:
+      - solr
+    depends_on:
+      - zoo1
+
+  zoo1:
+    image: zookeeper:3.6.2
+    restart: always
+    hostname: zoo1
+    environment:
+      ZOO_MY_ID: 1
+      ZOO_SERVERS: server.1=zoo1:2888:3888;2181
+    networks:
+      - solr
+      
+  create-collection:
+    image: solr:8.7.0
+    environment:
+      - SOLR_HOST=solr1
+    networks:
+      - solr
+    command:
+      - bash
+      - "-e"
+      - "-x"
+      - "-c"
+      - "wait-for-solr.sh --max-attempts 10 --wait-seconds 5 --solr-url 
http://$$SOLR_HOST:8983/; solr create_collection -c collection1 -p 8983"
+
+networks:
+  solr:

Reply via email to