Fixed test bug, lastFollowTime is null if there are no follower indices.

This commit is contained in:
Martijn van Groningen 2019-01-30 19:33:00 +01:00
parent cac6b8e06f
commit 5433af28e3
No known key found for this signature in database
GPG Key ID: AB236F4FCF2AF12A
1 changed files with 7 additions and 2 deletions

View File

@ -27,6 +27,7 @@ import java.util.Map;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.greaterThanOrEqualTo;
import static org.hamcrest.Matchers.nullValue;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
@ -36,7 +37,7 @@ public class CCRFeatureSetTests extends ESTestCase {
private ClusterService clusterService;
@Before
public void init() throws Exception {
public void init() {
licenseState = mock(XPackLicenseState.class);
clusterService = mock(ClusterService.class);
}
@ -116,7 +117,11 @@ public class CCRFeatureSetTests extends ESTestCase {
assertThat(ccrUsage.available(), equalTo(ccrFeatureSet.available()));
assertThat(ccrUsage.getNumberOfFollowerIndices(), equalTo(numFollowerIndices));
assertThat(ccrUsage.getLastFollowTimeInMillis(), greaterThanOrEqualTo(0L));
if (numFollowerIndices != 0) {
assertThat(ccrUsage.getLastFollowTimeInMillis(), greaterThanOrEqualTo(0L));
} else {
assertThat(ccrUsage.getLastFollowTimeInMillis(), nullValue());
}
assertThat(ccrUsage.getNumberOfAutoFollowPatterns(), equalTo(numAutoFollowPatterns));
}