|
64 | 64 | import java.util.concurrent.atomic.AtomicLong; |
65 | 65 | import java.util.stream.Collectors; |
66 | 66 |
|
| 67 | +import static java.time.format.DateTimeFormatter.ISO_ZONED_DATE_TIME; |
67 | 68 | import static org.elasticsearch.client.Requests.clusterHealthRequest; |
68 | 69 | import static org.elasticsearch.client.Requests.createIndexRequest; |
69 | 70 | import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_NUMBER_OF_REPLICAS; |
@@ -181,7 +182,7 @@ public void testSingleNodeCluster() throws Exception { |
181 | 182 | GetLifecycleAction.LifecyclePolicyResponseItem responseItem = getLifecycleResponse.getPolicies().get(0); |
182 | 183 | assertThat(responseItem.getLifecyclePolicy(), equalTo(lifecyclePolicy)); |
183 | 184 | assertThat(responseItem.getVersion(), equalTo(1L)); |
184 | | - long actualModifiedDate = Instant.parse(responseItem.getModifiedDate()).toEpochMilli(); |
| 185 | + long actualModifiedDate = Instant.from(ISO_ZONED_DATE_TIME.parse(responseItem.getModifiedDate())).toEpochMilli(); |
185 | 186 | assertThat(actualModifiedDate, |
186 | 187 | is(both(greaterThanOrEqualTo(lowerBoundModifiedDate)).and(lessThanOrEqualTo(upperBoundModifiedDate)))); |
187 | 188 |
|
@@ -220,7 +221,7 @@ public void testExplainExecution() throws Exception { |
220 | 221 | GetLifecycleAction.LifecyclePolicyResponseItem responseItem = getLifecycleResponse.getPolicies().get(0); |
221 | 222 | assertThat(responseItem.getLifecyclePolicy(), equalTo(lifecyclePolicy)); |
222 | 223 | assertThat(responseItem.getVersion(), equalTo(1L)); |
223 | | - long actualModifiedDate = Instant.parse(responseItem.getModifiedDate()).toEpochMilli(); |
| 224 | + long actualModifiedDate = Instant.from(ISO_ZONED_DATE_TIME.parse(responseItem.getModifiedDate())).toEpochMilli(); |
224 | 225 |
|
225 | 226 | logger.info("Creating index [test]"); |
226 | 227 | CreateIndexResponse createIndexResponse = client().admin().indices().create(createIndexRequest("test").settings(settings)) |
@@ -295,7 +296,6 @@ public void testExplainParseOriginationDate() throws Exception { |
295 | 296 | GetLifecycleAction.LifecyclePolicyResponseItem responseItem = getLifecycleResponse.getPolicies().get(0); |
296 | 297 | assertThat(responseItem.getLifecyclePolicy(), equalTo(lifecyclePolicy)); |
297 | 298 | assertThat(responseItem.getVersion(), equalTo(1L)); |
298 | | - long actualModifiedDate = Instant.parse(responseItem.getModifiedDate()).toEpochMilli(); |
299 | 299 |
|
300 | 300 | String indexName = "test-2019.09.14"; |
301 | 301 | logger.info("Creating index [{}]", indexName); |
@@ -496,7 +496,7 @@ public void testCreatePolicyWhenStopped() throws Exception { |
496 | 496 | GetLifecycleAction.LifecyclePolicyResponseItem responseItem = getLifecycleResponse.getPolicies().get(0); |
497 | 497 | assertThat(responseItem.getLifecyclePolicy(), equalTo(lifecyclePolicy)); |
498 | 498 | assertThat(responseItem.getVersion(), equalTo(1L)); |
499 | | - long actualModifiedDate = Instant.parse(responseItem.getModifiedDate()).toEpochMilli(); |
| 499 | + long actualModifiedDate = Instant.from(ISO_ZONED_DATE_TIME.parse(responseItem.getModifiedDate())).toEpochMilli(); |
500 | 500 | assertThat(actualModifiedDate, |
501 | 501 | is(both(greaterThanOrEqualTo(lowerBoundModifiedDate)).and(lessThanOrEqualTo(upperBoundModifiedDate)))); |
502 | 502 | // assert ILM is still stopped |
|
0 commit comments