From 8685442453023b8e9e0524e9d014e2b1a65af654 Mon Sep 17 00:00:00 2001 From: Daniel Widdis Date: Tue, 9 Jul 2024 18:03:27 -0700 Subject: [PATCH] Update tests to ensure update timestamp increments Signed-off-by: Daniel Widdis --- .../java/org/opensearch/flowframework/model/Template.java | 8 ++++---- .../org/opensearch/flowframework/model/TemplateTests.java | 3 ++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/main/java/org/opensearch/flowframework/model/Template.java b/src/main/java/org/opensearch/flowframework/model/Template.java index 5647f7cd0..a99b87c4b 100644 --- a/src/main/java/org/opensearch/flowframework/model/Template.java +++ b/src/main/java/org/opensearch/flowframework/model/Template.java @@ -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, @@ -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) { diff --git a/src/test/java/org/opensearch/flowframework/model/TemplateTests.java b/src/test/java/org/opensearch/flowframework/model/TemplateTests.java index 11f9aa2f0..0ce66c2de 100644 --- a/src/test/java/org/opensearch/flowframework/model/TemplateTests.java +++ b/src/test/java/org/opensearch/flowframework/model/TemplateTests.java @@ -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",