From e8949e13048a7e6d93cfd9ec3caafdedb73c47a5 Mon Sep 17 00:00:00 2001 From: Askwang <135721692+Askwang@users.noreply.github.com> Date: Fri, 18 Oct 2024 10:26:45 +0800 Subject: [PATCH] fix test --- .../src/main/java/org/apache/paimon/utils/TagManager.java | 4 ++-- .../java/org/apache/paimon/table/FileStoreTableTestBase.java | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/paimon-core/src/main/java/org/apache/paimon/utils/TagManager.java b/paimon-core/src/main/java/org/apache/paimon/utils/TagManager.java index 75942909f94e..e96ad77f0e29 100644 --- a/paimon-core/src/main/java/org/apache/paimon/utils/TagManager.java +++ b/paimon-core/src/main/java/org/apache/paimon/utils/TagManager.java @@ -103,7 +103,7 @@ public void createTag( List callbacks) { checkArgument( !StringUtils.isNullOrWhitespaceOnly(tagName), "Tag name '%s' is blank.", tagName); - checkArgument(!tagExists(tagName), "Tag %s already exists.", tagName); + checkArgument(!tagExists(tagName), "Tag name '%s' already exists.", tagName); createOrReplaceTag(snapshot, tagName, timeRetained, callbacks); } @@ -115,7 +115,7 @@ public void replaceTag( List callbacks) { checkArgument( !StringUtils.isNullOrWhitespaceOnly(tagName), "Tag name '%s' is blank.", tagName); - checkArgument(tagExists(tagName), "Tag %s does not exist.", tagName); + checkArgument(tagExists(tagName), "Tag name '%s' does not exist.", tagName); createOrReplaceTag(snapshot, tagName, timeRetained, callbacks); } diff --git a/paimon-core/src/test/java/org/apache/paimon/table/FileStoreTableTestBase.java b/paimon-core/src/test/java/org/apache/paimon/table/FileStoreTableTestBase.java index f8b15c155f63..f6343bfe437f 100644 --- a/paimon-core/src/test/java/org/apache/paimon/table/FileStoreTableTestBase.java +++ b/paimon-core/src/test/java/org/apache/paimon/table/FileStoreTableTestBase.java @@ -1136,8 +1136,9 @@ public void testCreateSameTagName() throws Exception { table.createTag("test-tag", 1); // verify that tag file exist assertThat(tagManager.tagExists("test-tag")).isTrue(); - // Create again - table.createTag("test-tag", 1); + // Create again failed if tag existed + Assertions.assertThatThrownBy(() -> table.createTag("test-tag", 1)) + .hasMessageContaining("Tag name 'test-tag' already exists."); Assertions.assertThatThrownBy(() -> table.createTag("test-tag", 2)) .hasMessageContaining("Tag name 'test-tag' already exists."); }