Skip to content
Merged
Show file tree
Hide file tree
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 @@ -34,12 +34,13 @@ public void apply(Project project) {
|| buildParams.getBwcVersions().unreleasedInfo(version) == null
);

if (shouldConfigureTestClustersWithOneProcessor()) {
NamedDomainObjectContainer<ElasticsearchCluster> testClusters = (NamedDomainObjectContainer<ElasticsearchCluster>) project
.getExtensions()
.getByName(TestClustersPlugin.EXTENSION_NAME);
testClusters.configureEach(elasticsearchCluster -> elasticsearchCluster.setting("node.processors", "1"));
}
NamedDomainObjectContainer<ElasticsearchCluster> testClusters = (NamedDomainObjectContainer<ElasticsearchCluster>) project
.getExtensions()
.getByName(TestClustersPlugin.EXTENSION_NAME);
// Limit the number of allocated processors for all nodes to 2 in the cluster by default.
// This is to ensure that the tests run consistently across different environments.
String processorCount = shouldConfigureTestClustersWithOneProcessor() ? "1" : "2";
testClusters.configureEach(elasticsearchCluster -> elasticsearchCluster.setting("node.processors", processorCount));
}

private boolean shouldConfigureTestClustersWithOneProcessor() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ public Map<String, String> get(LocalNodeSpec nodeSpec) {
}
}

// Limit the number of allocated processors for all nodes in the cluster by default.
// This is to ensure that the tests run consistently across different environments.
settings.put("node.processors", "2");

// Default the watermarks to absurdly low to prevent the tests from failing on nodes without enough disk space
settings.put("cluster.routing.allocation.disk.watermark.low", "1b");
settings.put("cluster.routing.allocation.disk.watermark.high", "1b");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public void testAttachToDeployment() throws IOException {
var results = infer(inferenceId, List.of("washing machine"));
assertNotNull(results.get("sparse_embedding"));

var updatedNumAllocations = randomIntBetween(1, 10);
var updatedNumAllocations = randomIntBetween(1, 2);
var updatedEndpointConfig = updateEndpoint(inferenceId, updatedEndpointConfig(updatedNumAllocations), TaskType.SPARSE_EMBEDDING);
assertThat(
updatedEndpointConfig.get("service_settings"),
Expand Down Expand Up @@ -128,7 +128,7 @@ public void testAttachWithModelId() throws IOException {
var results = infer(inferenceId, List.of("washing machine"));
assertNotNull(results.get("sparse_embedding"));

var updatedNumAllocations = randomIntBetween(1, 10);
var updatedNumAllocations = randomIntBetween(1, 2);
var updatedEndpointConfig = updateEndpoint(inferenceId, updatedEndpointConfig(updatedNumAllocations), TaskType.SPARSE_EMBEDDING);
assertThat(
updatedEndpointConfig.get("service_settings"),
Expand Down