Skip to content

Commit

Permalink
Test: Guard deprecation check when 0 nodes created
Browse files Browse the repository at this point in the history
The internal test cluster can sometimes have 0 nodes. In this situation,
the http.enabled flag will never be read, and thus no deprecation
warning will be emitted. This commit guards the deprecation warning
check in this case.
  • Loading branch information
rjernst committed Apr 19, 2018
1 parent eee0b34 commit 7804135
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertFileExists;
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertFileNotExists;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.greaterThan;
import static org.hamcrest.Matchers.hasEntry;
import static org.hamcrest.Matchers.not;

Expand Down Expand Up @@ -229,21 +230,22 @@ public Settings transportClientSettings() {
cluster1.beforeTest(random, random.nextDouble());
}
assertArrayEquals(cluster0.getNodeNames(), cluster1.getNodeNames());
if (cluster0.getNodeNames().length > 0) {
assertSettingDeprecationsAndWarnings(new Setting<?>[]{NetworkModule.HTTP_ENABLED});
}
Iterator<Client> iterator1 = cluster1.getClients().iterator();
for (Client client : cluster0.getClients()) {
assertTrue(iterator1.hasNext());
Client other = iterator1.next();
assertSettings(client.settings(), other.settings(), false);
}
assertArrayEquals(cluster0.getNodeNames(), cluster1.getNodeNames());
assertMMNinNodeSetting(cluster0, cluster0.numMasterNodes());
assertMMNinNodeSetting(cluster1, cluster0.numMasterNodes());
cluster0.afterTest();
cluster1.afterTest();
} finally {
IOUtils.close(cluster0, cluster1);
}
assertSettingDeprecationsAndWarnings(new Setting<?>[] { NetworkModule.HTTP_ENABLED });
}

public void testDataFolderAssignmentAndCleaning() throws IOException, InterruptedException {
Expand Down

0 comments on commit 7804135

Please sign in to comment.