Skip to content

Commit

Permalink
Minor fixes to build the rfs_source image and to get the FullTest to …
Browse files Browse the repository at this point in the history
…pull the right image for the slowTest target.

buildDockerImage_elasticsearchRFSSource is run completely every time.  The DockerBuildImage stuff for dockerSolution makes good use of inputs/outputs to do more minimal, dependency-driven builds.
This pattern uses multiple containers, so inputs and outputs will need to be managed externally.

Signed-off-by: Greg Schohn <greg.schohn@gmail.com>
  • Loading branch information
gregschohn committed Jun 21, 2024
1 parent 7905f4c commit 9f075c7
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ def createNetworkTask = task createNetwork(type: Exec) {
println 'Network created'
}
}

task createInitialElasticsearchContainer(type: DockerCreateContainer) {
dependsOn createNetwork, buildDockerImage_emptyElasticsearchSource_7_10
targetImageId 'migrations/empty_elasticsearch_source_7_10:latest'
Expand Down Expand Up @@ -70,7 +71,7 @@ def sourceContainerCommitTask = task commitSourceContainer() {
}

task removeClientContainer(type: DockerRemoveContainer) {
dependsOn commitSourceContainer
dependsOn waitClientContainer
targetContainerId createClientContainer.getContainerId()
}
startClientTask.finalizedBy(removeClientContainer)
Expand Down
1 change: 1 addition & 0 deletions DocumentsFromSnapshotMigration/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ test {

task slowTest(type: Test) {
useJUnitPlatform()
dependsOn buildDockerImage_elasticsearchRFSSource
jacoco {
enabled = true
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.UUID;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
Expand All @@ -75,7 +76,7 @@ public class FullTest {
Pattern.compile("(?:\\S+\\s+){2}(\\S+)\\s+(?:\\S+\\s+){3}(\\S+)");

public static Stream<Arguments> makeArgs() {
var sourceImageNames = List.of("elasticsearch_rfs_source");
var sourceImageNames = List.of("migrations/elasticsearch_rfs_source");
var targetImageNames = List.of("opensearchproject/opensearch:2.13.0", "opensearchproject/opensearch:1.3.0");
var numWorkers = List.of(1, 3, 40);
return sourceImageNames.stream()
Expand Down Expand Up @@ -155,7 +156,10 @@ private void checkClusterMigrationOnFinished(ElasticsearchContainer esSourceCont
}

private Map<String,Integer> getIndexToCountMap(RestClient client) {;
var lines = client.get("_cat/indices").body.split("\n");
var lines = Optional.ofNullable(client.get("_cat/indices"))
.flatMap(r->Optional.ofNullable(r.body))
.map(b->b.split("\n"))
.orElse(new String[0]);
return Arrays.stream(lines)
.map(line -> {
var matcher = CAT_INDICES_INDEX_COUNT_PATTERN.matcher(line);
Expand Down

0 comments on commit 9f075c7

Please sign in to comment.