Skip to content

Commit

Permalink
TEST BUG: MergeSchedulerSettingsTests fails always on small machines (o…
Browse files Browse the repository at this point in the history
…pensearch-project#559)

MergeSchedulerSettingsTests tweaks the `node.processors` setting: sets it
explicitly to values of `2` and `8`. On a machine with only `4` threads
(e.g. my 2-core thinkpad), the test fails, because it creates unexpected
warnings about `node.processors` being set higher than the number of
cpus.

The problem can be reproduced always, by pretending to be single core:
```
./gradlew ':server:test' --tests "org.opensearch.index.MergeSchedulerSettingsTests.testMaxThreadAndMergeCount" -Dtests.jvm.argline="-XX:ActiveProcessorCount=1"
```

Instead, allow the test to provoke these specific warnings.

Signed-off-by: Robert Muir <rmuir@apache.org>
  • Loading branch information
rmuir authored Apr 15, 2021
1 parent 6aa3675 commit bdb7aad
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -192,5 +192,14 @@ public void testMaxThreadAndMergeCount() {
exc = expectThrows(IllegalArgumentException.class,
() -> finalSettings.updateIndexMetadata(createMetadata(-1, 3, 8)));
assertThat(exc.getMessage(), containsString("maxThreadCount (= 4) should be <= maxMergeCount (= 3)"));

// assertions above may provoke warnings if node.processors exceeds numCpus
// we explicitly test with values of 2 and 8
int numCpus = Runtime.getRuntime().availableProcessors();
String[] warnings = new String[] {
"setting [node.processors] to value [2] which is more than available processors [" + numCpus + "] is deprecated",
"setting [node.processors] to value [8] which is more than available processors [" + numCpus + "] is deprecated"
};
allowedWarnings(warnings);
}
}

0 comments on commit bdb7aad

Please sign in to comment.