Skip to content

Commit

Permalink
Add human readable version of modified date for snapshot lifecycle po…
Browse files Browse the repository at this point in the history
…licy (#41035)

* Add human readable version of modified date for snapshot lifecycle policy

This small change changes it from:

```
...
"modified_date": 1554843903242,
...
```

To

```
...
"modified_date" : "2019-04-09T21:05:03.242Z",
"modified_date_millis" : 1554843903242,
...
```

Including the `"modified_date"` field when the `?human` field is used.

Relates to #38461

* Fix test
  • Loading branch information
dakrone authored Apr 11, 2019
1 parent d4fab06 commit e564b48
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public boolean equals(Object obj) {
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
builder.startObject(policy.getId());
builder.field("version", version);
builder.field("modified_date", modifiedDate);
builder.timeField("modified_date_millis", "modified_date", modifiedDate);
builder.field("policy", policy);
if (lastSuccess != null) {
builder.field("last_success", lastSuccess);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public void testFullPolicySnapshot() throws Exception {
Map<String, Object> lastSuccessObject = (Map<String, Object>) policyMetadataMap.get("last_success");
assertNotNull(lastSuccessObject);
Long lastSuccess = (Long) lastSuccessObject.get("time");
Long modifiedDate = (Long) policyMetadataMap.get("modified_date");
Long modifiedDate = (Long) policyMetadataMap.get("modified_date_millis");
assertNotNull(lastSuccess);
assertNotNull(modifiedDate);
assertThat(lastSuccess, greaterThan(modifiedDate));
Expand Down Expand Up @@ -133,7 +133,7 @@ public void testPolicyFailure() throws Exception {
assertNotNull(lastFailureObject);

Long lastFailure = (Long) lastFailureObject.get("time");
Long modifiedDate = (Long) policyMetadataMap.get("modified_date");
Long modifiedDate = (Long) policyMetadataMap.get("modified_date_millis");
assertNotNull(lastFailure);
assertNotNull(modifiedDate);
assertThat(lastFailure, greaterThan(modifiedDate));
Expand Down

0 comments on commit e564b48

Please sign in to comment.