Skip to content

Commit

Permalink
Fixed test bug, lastFollowTime is null if there are no follower indices.
Browse files Browse the repository at this point in the history
  • Loading branch information
martijnvg committed Jan 30, 2019
1 parent cac6b8e commit 5433af2
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

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;

Expand All @@ -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);
}
Expand Down Expand Up @@ -116,7 +117,11 @@ public void testUsageStats() throws Exception {
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));
}

Expand Down

0 comments on commit 5433af2

Please sign in to comment.