forked from elastic/elasticsearch
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Run REST tests against a cluster running on docker
Closes elastic#38053
- Loading branch information
Showing
5 changed files
with
196 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,103 @@ | ||
# Only used for testing the docker images | ||
version: '3' | ||
services: | ||
elasticsearch-default: | ||
elasticsearch-default-1: | ||
build: | ||
context: ./build/docker | ||
dockerfile: Dockerfile | ||
environment: | ||
- node.name=elasticsearch-default-1 | ||
- cluster.initial_master_nodes=elasticsearch-default-1,elasticsearch-default-2 | ||
- discovery.seed_hosts=elasticsearch-default-2:9300 | ||
- cluster.name=elasticsearch-default | ||
- discovery.type=single-node | ||
- bootstrap.memory_lock=true | ||
- "ES_JAVA_OPTS=-Xms512m -Xmx512m" | ||
- path.repo=/tmp/es-repo | ||
- node.attr.testattr=test | ||
- cluster.routing.allocation.disk.watermark.low=1b | ||
- cluster.routing.allocation.disk.watermark.high=1b | ||
- cluster.routing.allocation.disk.watermark.flood_stage=1b | ||
- script.max_compilations_rate=2048/1m | ||
- node.store.allow_mmap=false | ||
volumes: | ||
- ./build/repo:/tmp/es-repo | ||
ports: | ||
- "9200" | ||
elasticsearch-oss: | ||
ulimits: | ||
memlock: | ||
soft: -1 | ||
hard: -1 | ||
elasticsearch-default-2: | ||
build: | ||
context: ./build/docker | ||
environment: | ||
- node.name=elasticsearch-default-2 | ||
- cluster.initial_master_nodes=elasticsearch-default-1,elasticsearch-default-2 | ||
- discovery.seed_hosts=elasticsearch-default-1:9300 | ||
- cluster.name=elasticsearch-default | ||
- bootstrap.memory_lock=true | ||
- "ES_JAVA_OPTS=-Xms512m -Xmx512m" | ||
- path.repo=/tmp/es-repo | ||
- node.attr.testattr=test | ||
- cluster.routing.allocation.disk.watermark.low=1b | ||
- cluster.routing.allocation.disk.watermark.high=1b | ||
- cluster.routing.allocation.disk.watermark.flood_stage=1b | ||
- script.max_compilations_rate=2048/1m | ||
- node.store.allow_mmap=false | ||
volumes: | ||
- ./build/repo:/tmp/es-repo | ||
ports: | ||
- "9200" | ||
ulimits: | ||
memlock: | ||
soft: -1 | ||
hard: -1 | ||
elasticsearch-oss-1: | ||
build: | ||
context: ./build/oss-docker | ||
environment: | ||
- node.name=elasticsearch-oss-1 | ||
- cluster.initial_master_nodes=elasticsearch-oss-1,elasticsearch-oss-2 | ||
- discovery.seed_hosts=elasticsearch-oss-2:9300 | ||
- cluster.name=elasticsearch-oss | ||
- bootstrap.memory_lock=true | ||
- "ES_JAVA_OPTS=-Xms512m -Xmx512m" | ||
- path.repo=/tmp/es-repo | ||
- node.attr.testattr=test | ||
- cluster.routing.allocation.disk.watermark.low=1b | ||
- cluster.routing.allocation.disk.watermark.high=1b | ||
- cluster.routing.allocation.disk.watermark.flood_stage=1b | ||
- script.max_compilations_rate=2048/1m | ||
- node.store.allow_mmap=false | ||
volumes: | ||
- ./build/oss-repo:/tmp/es-repo | ||
ports: | ||
- "9200" | ||
ulimits: | ||
memlock: | ||
soft: -1 | ||
hard: -1 | ||
elasticsearch-oss-2: | ||
build: | ||
context: ./build/oss-docker | ||
dockerfile: Dockerfile | ||
environment: | ||
- node.name=elasticsearch-oss-2 | ||
- cluster.initial_master_nodes=elasticsearch-oss-1,elasticsearch-oss-2 | ||
- discovery.seed_hosts=elasticsearch-oss-1:9300 | ||
- cluster.name=elasticsearch-oss | ||
- discovery.type=single-node | ||
- bootstrap.memory_lock=true | ||
- "ES_JAVA_OPTS=-Xms512m -Xmx512m" | ||
- path.repo=/tmp/es-repo | ||
- node.attr.testattr=test | ||
- cluster.routing.allocation.disk.watermark.low=1b | ||
- cluster.routing.allocation.disk.watermark.high=1b | ||
- cluster.routing.allocation.disk.watermark.flood_stage=1b | ||
- script.max_compilations_rate=2048/1m | ||
- node.store.allow_mmap=false | ||
volumes: | ||
- ./build/oss-repo:/tmp/es-repo | ||
ports: | ||
- "9200" | ||
ulimits: | ||
memlock: | ||
soft: -1 | ||
hard: -1 |
59 changes: 59 additions & 0 deletions
59
distribution/docker/src/test/java/org/elasticsearch/docker/test/DockerYmlTestSuiteIT.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/* | ||
* Licensed to Elasticsearch under one or more contributor | ||
* license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright | ||
* ownership. Elasticsearch 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. | ||
*/ | ||
package org.elasticsearch.docker.test; | ||
|
||
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory; | ||
import org.elasticsearch.test.rest.yaml.ClientYamlTestCandidate; | ||
import org.elasticsearch.test.rest.yaml.ESClientYamlSuiteTestCase; | ||
|
||
public class DockerYmlTestSuiteIT extends ESClientYamlSuiteTestCase { | ||
|
||
public DockerYmlTestSuiteIT(ClientYamlTestCandidate testCandidate) { | ||
super(testCandidate); | ||
} | ||
|
||
@ParametersFactory | ||
public static Iterable<Object[]> parameters() throws Exception { | ||
return createParameters(); | ||
} | ||
|
||
@Override | ||
protected String getTestRestCluster() { | ||
String distribution = System.getProperty("tests.distribution", "default"); | ||
if (distribution.equals("oss") == false && distribution.equals("default") == false) { | ||
throw new IllegalArgumentException("supported values for tests.distribution are oss or default but it was " + distribution); | ||
} | ||
return new StringBuilder() | ||
.append("localhost:") | ||
.append(getProperty("test.fixtures.elasticsearch-" + distribution + "-1.tcp.9200")) | ||
.append(",") | ||
.append("localhost:") | ||
.append(getProperty("test.fixtures.elasticsearch-" + distribution + "-2.tcp.9200")) | ||
.toString(); | ||
} | ||
|
||
private String getProperty(String key) { | ||
String port = System.getProperty(key); | ||
if (port == null) { | ||
throw new IllegalStateException("Could not find system properties from test.fixtures. " + | ||
"This test expects to run with the elasticsearch.test.fixtures Gradle plugin"); | ||
} | ||
return port; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters