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

Fixup 5cf60953 SolrTest failure when using CloundContainer #3046

Merged
merged 1 commit into from
Aug 27, 2021
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@
package org.apache.camel.quarkus.component.solr.it;

import java.io.File;
import java.net.URI;
import java.io.IOException;
import java.io.InputStream;
import java.nio.file.Files;
import java.nio.file.StandardCopyOption;
import java.util.Map;

import io.quarkus.test.common.QuarkusTestResourceLifecycleManager;
Expand Down Expand Up @@ -113,19 +116,21 @@ private void createSslContainer() {
* creates a cloud container with zookeeper
*/
private void createCloudContainer() {
URI uri = null;
final String resource = SystemUtils.IS_OS_LINUX ? "cloud-docker-compose.yml" : "cloud-docker-compose_nonlinux.yml";
try {
if (SystemUtils.IS_OS_LINUX) {
uri = this.getClass().getClassLoader().getResource("cloud-docker-compose.yml").toURI();
} else {
uri = this.getClass().getClassLoader().getResource("cloud-docker-compose_nonlinux.yml").toURI();
final File file = File.createTempFile(SolrTestResource.class.getSimpleName() + "-", resource);
file.deleteOnExit();
try (InputStream in = this.getClass().getClassLoader().getResourceAsStream(resource)) {
Files.copy(in, file.toPath(), StandardCopyOption.REPLACE_EXISTING);
} catch (IOException e) {
throw new RuntimeException("Could not copy class path resource " + resource + " to " + file, e);
}
cloudContainer = new DockerComposeContainer(new File(uri))
cloudContainer = new DockerComposeContainer(file)
.withExposedService("solr1", SOLR_PORT)
.withExposedService("zoo1", ZOOKEEPER_PORT)
.waitingFor("create-collection", Wait.forLogMessage(".*Created collection 'collection1'.*", 1));
} catch (Exception e) {
LOGGER.warn("can't create Cloud Container", e);
} catch (IOException e) {
throw new RuntimeException("Could not create temporary file", e);
}

}
Expand Down