Skip to content

Commit 5433af2

Browse files
committed
Fixed test bug, lastFollowTime is null if there are no follower indices.
1 parent cac6b8e commit 5433af2

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/ccr/CCRFeatureSetTests.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727

2828
import static org.hamcrest.Matchers.equalTo;
2929
import static org.hamcrest.Matchers.greaterThanOrEqualTo;
30+
import static org.hamcrest.Matchers.nullValue;
3031
import static org.mockito.Mockito.mock;
3132
import static org.mockito.Mockito.when;
3233

@@ -36,7 +37,7 @@ public class CCRFeatureSetTests extends ESTestCase {
3637
private ClusterService clusterService;
3738

3839
@Before
39-
public void init() throws Exception {
40+
public void init() {
4041
licenseState = mock(XPackLicenseState.class);
4142
clusterService = mock(ClusterService.class);
4243
}
@@ -116,7 +117,11 @@ public void testUsageStats() throws Exception {
116117
assertThat(ccrUsage.available(), equalTo(ccrFeatureSet.available()));
117118

118119
assertThat(ccrUsage.getNumberOfFollowerIndices(), equalTo(numFollowerIndices));
119-
assertThat(ccrUsage.getLastFollowTimeInMillis(), greaterThanOrEqualTo(0L));
120+
if (numFollowerIndices != 0) {
121+
assertThat(ccrUsage.getLastFollowTimeInMillis(), greaterThanOrEqualTo(0L));
122+
} else {
123+
assertThat(ccrUsage.getLastFollowTimeInMillis(), nullValue());
124+
}
120125
assertThat(ccrUsage.getNumberOfAutoFollowPatterns(), equalTo(numAutoFollowPatterns));
121126
}
122127

0 commit comments

Comments
 (0)