Tests: fix NPE in UpgradeTest

This commit is contained in:
Igor Motov 2015-05-28 07:13:32 -10:00
parent f732900111
commit d955461f58
1 changed files with 5 additions and 5 deletions

View File

@ -134,7 +134,7 @@ public class UpgradeTest extends ElasticsearchBackwardsCompatIntegrationTest {
logger.info("--> Nodes upgrade complete"); logger.info("--> Nodes upgrade complete");
logSegmentsState(); logSegmentsState();
assertNotUpgraded(client(), null); assertNotUpgraded(client());
final String indexToUpgrade = "test" + randomInt(numIndexes - 1); final String indexToUpgrade = "test" + randomInt(numIndexes - 1);
// This test fires up another node running an older version of ES, but because wire protocol changes across major ES versions, it // This test fires up another node running an older version of ES, but because wire protocol changes across major ES versions, it
@ -159,10 +159,10 @@ public class UpgradeTest extends ElasticsearchBackwardsCompatIntegrationTest {
assertNoFailures(client().admin().indices().prepareUpgrade().get()); assertNoFailures(client().admin().indices().prepareUpgrade().get());
logSegmentsState(); logSegmentsState();
logger.info("--> Full upgrade complete"); logger.info("--> Full upgrade complete");
assertUpgraded(client(), null); assertUpgraded(client());
} }
public static void assertNotUpgraded(Client client, String index) throws Exception { public static void assertNotUpgraded(Client client, String... index) throws Exception {
for (IndexUpgradeStatus status : getUpgradeStatus(client, index)) { for (IndexUpgradeStatus status : getUpgradeStatus(client, index)) {
assertTrue("index " + status.getIndex() + " should not be zero sized", status.getTotalBytes() != 0); assertTrue("index " + status.getIndex() + " should not be zero sized", status.getTotalBytes() != 0);
// TODO: it would be better for this to be strictly greater, but sometimes an extra flush // TODO: it would be better for this to be strictly greater, but sometimes an extra flush
@ -173,7 +173,7 @@ public class UpgradeTest extends ElasticsearchBackwardsCompatIntegrationTest {
} }
} }
public static void assertNoAncientSegments(Client client, String index) throws Exception { public static void assertNoAncientSegments(Client client, String... index) throws Exception {
for (IndexUpgradeStatus status : getUpgradeStatus(client, index)) { for (IndexUpgradeStatus status : getUpgradeStatus(client, index)) {
assertTrue("index " + status.getIndex() + " should not be zero sized", status.getTotalBytes() != 0); assertTrue("index " + status.getIndex() + " should not be zero sized", status.getTotalBytes() != 0);
// TODO: it would be better for this to be strictly greater, but sometimes an extra flush // TODO: it would be better for this to be strictly greater, but sometimes an extra flush
@ -206,7 +206,7 @@ public class UpgradeTest extends ElasticsearchBackwardsCompatIntegrationTest {
return false; return false;
} }
public static void assertUpgraded(Client client, String index) throws Exception { public static void assertUpgraded(Client client, String... index) throws Exception {
for (IndexUpgradeStatus status : getUpgradeStatus(client, index)) { for (IndexUpgradeStatus status : getUpgradeStatus(client, index)) {
assertTrue("index " + status.getIndex() + " should not be zero sized", status.getTotalBytes() != 0); assertTrue("index " + status.getIndex() + " should not be zero sized", status.getTotalBytes() != 0);
assertEquals("index " + status.getIndex() + " should be upgraded", assertEquals("index " + status.getIndex() + " should be upgraded",