Skip to content

Commit

Permalink
Make ConfigurationTests.test20HostnameSubstitution more resilient (el…
Browse files Browse the repository at this point in the history
…astic#111216) (elastic#111219)

This is an attempt to fix occasional test failures where asserting on a
request response fails because the cluster has not finished
initialization and cannot yet serve requests.

Closes elastic#109660
  • Loading branch information
mark-vieira authored Jul 24, 2024
1 parent ba48e33 commit 29e25db
Showing 1 changed file with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

import static java.nio.file.attribute.PosixFilePermissions.fromString;
import static org.elasticsearch.packaging.util.FileUtils.append;
import static org.hamcrest.Matchers.equalTo;
import static org.junit.Assume.assumeFalse;

public class ConfigurationTests extends PackagingTestCase {
Expand Down Expand Up @@ -50,13 +49,15 @@ public void test20HostnameSubstitution() throws Exception {
// security auto-config requires that the archive owner and the node process user be the same
Platforms.onWindows(() -> sh.chown(confPath, installation.getOwner()));
assertWhileRunning(() -> {
final String nameResponse = ServerUtils.makeRequest(
Request.Get("https://localhost:9200/_cat/nodes?h=name"),
"test_superuser",
"test_superuser_password",
ServerUtils.getCaCert(confPath)
).strip();
assertThat(nameResponse, equalTo("mytesthost"));
assertBusy(() -> {
final String nameResponse = ServerUtils.makeRequest(
Request.Get("https://localhost:9200/_cat/nodes?h=name"),
"test_superuser",
"test_superuser_password",
ServerUtils.getCaCert(confPath)
).strip();
assertEquals("mytesthost", nameResponse);
});
});
Platforms.onWindows(() -> sh.chown(confPath));
});
Expand Down

0 comments on commit 29e25db

Please sign in to comment.