Skip to content

Commit

Permalink
Update tests to ensure update timestamp increments
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Widdis <[email protected]>
  • Loading branch information
dbwiddis committed Jul 10, 2024
1 parent d6510ee commit 8685442
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,9 @@ public class Template implements ToXContentObject {
* @param workflows Workflow graph definitions corresponding to the defined operations.
* @param uiMetadata The UI metadata related to the given workflow
* @param user The user extracted from the thread context from the request
* @param createdTime Created time in milliseconds since the epoch
* @param lastUpdatedTime Last Updated time in milliseconds since the epoch
* @param lastProvisionedTime Last Provisioned time in milliseconds since the epoch
* @param createdTime Created time as an Instant
* @param lastUpdatedTime Last Updated time as an Instant
* @param lastProvisionedTime Last Provisioned time as an Instant
*/
public Template(
String name,
Expand Down Expand Up @@ -348,7 +348,7 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws
/**
* Merges two templates by updating the fields from an existing template with the (non-null) fields of another one.
* @param existingTemplate An existing complete template.
* @param templateWithNewFields A template containing only fields to update. The fields must be included in {@link #UPDATE_FIELD_ALLOWLIST}.
* @param templateWithNewFields A template containing only fields to update. The fields must correspond to the field names in {@link #UPDATE_FIELD_ALLOWLIST}.
* @return the updated template.
*/
public static Template updateExistingTemplate(Template existingTemplate, Template templateWithNewFields) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@ public void testTemplate() throws IOException {
}

public void testUpdateExistingTemplate() {
Instant now = Instant.now();
// Time travel to guarantee update increments
Instant now = Instant.now().minusMillis(100);

Template original = new Template(
"name one",
Expand Down

0 comments on commit 8685442

Please sign in to comment.