You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@seatunnel.apache.org by fa...@apache.org on 2022/06/27 05:35:13 UTC

[incubator-seatunnel] branch api-draft updated: fix VariablesSubstituteTest create time now twice (#2063)

This is an automated email from the ASF dual-hosted git repository.

fanjia pushed a commit to branch api-draft
in repository https://gitbox.apache.org/repos/asf/incubator-seatunnel.git


The following commit(s) were added to refs/heads/api-draft by this push:
     new a15ab7fa6 fix VariablesSubstituteTest create time now twice (#2063)
a15ab7fa6 is described below

commit a15ab7fa68c264c409b14400f21e4f624c8b9362
Author: Hisoka <fa...@qq.com>
AuthorDate: Mon Jun 27 13:35:09 2022 +0800

    fix VariablesSubstituteTest create time now twice (#2063)
---
 .../org/apache/seatunnel/common/utils/VariablesSubstituteTest.java | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/seatunnel-common/src/test/java/org/apache/seatunnel/common/utils/VariablesSubstituteTest.java b/seatunnel-common/src/test/java/org/apache/seatunnel/common/utils/VariablesSubstituteTest.java
index a1731c309..33d721ae8 100644
--- a/seatunnel-common/src/test/java/org/apache/seatunnel/common/utils/VariablesSubstituteTest.java
+++ b/seatunnel-common/src/test/java/org/apache/seatunnel/common/utils/VariablesSubstituteTest.java
@@ -20,20 +20,21 @@ package org.apache.seatunnel.common.utils;
 import org.junit.Assert;
 import org.junit.Test;
 
-import java.time.ZonedDateTime;
+import java.time.LocalDateTime;
 import java.time.format.DateTimeFormatter;
 import java.util.HashMap;
 
 public class VariablesSubstituteTest {
 
+    @SuppressWarnings("checkstyle:MagicNumber")
     @Test
     public void testSubstitute() {
         String timeFormat = "yyyyMMddHHmmss";
         DateTimeFormatter df = DateTimeFormatter.ofPattern(timeFormat);
-        String formattedDate = df.format(ZonedDateTime.now());
         String path = "data_${now}_${uuid}.parquet";
         String newPath = VariablesSubstitute.substitute(path, timeFormat);
-        Assert.assertTrue(newPath.contains(formattedDate));
+        String now = newPath.substring(5, 19);
+        LocalDateTime.parse(now, df);
 
         String text = "${var1} is a distributed, high-performance data integration platform for " +
                 "the synchronization and ${var2} of massive data (offline & real-time).";