You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by "liuxiaocs7 (via GitHub)" <gi...@apache.org> on 2023/03/19 08:50:41 UTC

[GitHub] [iceberg] liuxiaocs7 opened a new pull request, #7143: dell: remove usage of AssertHelpers

liuxiaocs7 opened a new pull request, #7143:
URL: https://github.com/apache/iceberg/pull/7143

   - SubTask of https://github.com/apache/iceberg/issues/7094
   Remove `AssertHelpers` in `iceberg-dell` module


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


[GitHub] [iceberg] liuxiaocs7 commented on a diff in pull request #7143: dell: remove usage of AssertHelpers

Posted by "liuxiaocs7 (via GitHub)" <gi...@apache.org>.
liuxiaocs7 commented on code in PR #7143:
URL: https://github.com/apache/iceberg/pull/7143#discussion_r1142441396


##########
dell/src/test/java/org/apache/iceberg/dell/ecs/TestEcsURI.java:
##########
@@ -54,10 +54,9 @@ private void assertURI(String bucket, String name, EcsURI ecsURI) {
 
   @Test
   public void testInvalidLocation() {
-    AssertHelpers.assertThrows(
-        "Invalid location should cause exception",
-        ValidationException.class,
-        "http://bucket/a",
-        () -> new EcsURI("http://bucket/a"));
+
+    Assertions.assertThatThrownBy(() -> new EcsURI("http://bucket/a"))
+        .isInstanceOf(ValidationException.class)
+        .hasMessageContaining("http://bucket/a");

Review Comment:
   got it, thx!



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


[GitHub] [iceberg] jackye1995 merged pull request #7143: dell: remove usage of AssertHelpers

Posted by "jackye1995 (via GitHub)" <gi...@apache.org>.
jackye1995 merged PR #7143:
URL: https://github.com/apache/iceberg/pull/7143


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


[GitHub] [iceberg] nastra commented on a diff in pull request #7143: dell: remove usage of AssertHelpers

Posted by "nastra (via GitHub)" <gi...@apache.org>.
nastra commented on code in PR #7143:
URL: https://github.com/apache/iceberg/pull/7143#discussion_r1141832101


##########
dell/src/test/java/org/apache/iceberg/dell/ecs/TestEcsCatalog.java:
##########
@@ -128,15 +127,13 @@ public void testDropNamespace() {
     ecsCatalog.createNamespace(Namespace.of("a", "b1"));
     ecsCatalog.createTable(TableIdentifier.of("a", "t1"), SCHEMA);
 
-    AssertHelpers.assertThrows(
-        "Drop an unknown namespace should throw exception",
-        NoSuchNamespaceException.class,
-        () -> ecsCatalog.dropNamespace(Namespace.of("unknown")));
+    Assertions.assertThatThrownBy(() -> ecsCatalog.dropNamespace(Namespace.of("unknown")))
+        .isInstanceOf(NoSuchNamespaceException.class)
+        .hasMessageContaining("Namespace %s does not exist", "unknown");

Review Comment:
   why not make the namespace name directly part of the expected error msg? `"Namespace unknown does not exist"`
   Same for all the other places



##########
dell/src/test/java/org/apache/iceberg/dell/ecs/TestEcsURI.java:
##########
@@ -54,10 +54,9 @@ private void assertURI(String bucket, String name, EcsURI ecsURI) {
 
   @Test
   public void testInvalidLocation() {
-    AssertHelpers.assertThrows(
-        "Invalid location should cause exception",
-        ValidationException.class,
-        "http://bucket/a",
-        () -> new EcsURI("http://bucket/a"));
+
+    Assertions.assertThatThrownBy(() -> new EcsURI("http://bucket/a"))
+        .isInstanceOf(ValidationException.class)
+        .hasMessageContaining("http://bucket/a");

Review Comment:
   let's generally try and make the error msg check as specific as possible



##########
dell/src/test/java/org/apache/iceberg/dell/ecs/TestEcsOutputFile.java:
##########
@@ -88,10 +88,8 @@ public void testFileAlreadyExists() throws IOException {
       output.write("1234567890".getBytes());
     }
 
-    AssertHelpers.assertThrows(
-        "Create should throw exception",
-        AlreadyExistsException.class,
-        outputFile.location(),
-        outputFile::create);
+    Assertions.assertThatThrownBy(outputFile::create)
+        .isInstanceOf(AlreadyExistsException.class)
+        .hasMessageContaining(outputFile.location());

Review Comment:
   ```suggestion
           .hasMessage("ECS object already exists: " + outputFile.location());
   ```



##########
dell/src/test/java/org/apache/iceberg/dell/ecs/TestEcsTableOperations.java:
##########
@@ -57,15 +57,15 @@ public void testConcurrentCommit() {
     // Use the TableOperations to test the CommitFailedException
     // High level actions, such as Table#updateProperties(), may refresh metadata.
     TableOperations operations = ((HasTableOperations) catalog2Table).operations();
-    AssertHelpers.assertThrows(
-        "Commit failed when use out-dated status",
-        CommitFailedException.class,
-        () ->
-            operations.commit(
-                operations.current(),
-                TableMetadata.buildFrom(operations.current())
-                    .removeProperties(ImmutableSet.of("a"))
-                    .build()));
+    Assertions.assertThatThrownBy(
+            () ->
+                operations.commit(
+                    operations.current(),
+                    TableMetadata.buildFrom(operations.current())
+                        .removeProperties(ImmutableSet.of("a"))
+                        .build()))
+        .isInstanceOf(CommitFailedException.class)
+        .hasMessageContaining("Replace failed, E-Tag ");

Review Comment:
   ```suggestion
           .hasMessageStartingWith("Replace failed, E-Tag")
           .hasMessageContaining("mismatch for table test2.t1");
   ```



##########
dell/src/test/java/org/apache/iceberg/dell/ecs/TestEcsURI.java:
##########
@@ -54,10 +54,9 @@ private void assertURI(String bucket, String name, EcsURI ecsURI) {
 
   @Test
   public void testInvalidLocation() {
-    AssertHelpers.assertThrows(
-        "Invalid location should cause exception",
-        ValidationException.class,
-        "http://bucket/a",
-        () -> new EcsURI("http://bucket/a"));
+
+    Assertions.assertThatThrownBy(() -> new EcsURI("http://bucket/a"))
+        .isInstanceOf(ValidationException.class)
+        .hasMessageContaining("http://bucket/a");

Review Comment:
   ```suggestion
           .hasMessage("Invalid ecs location: http://bucket/a");
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


[GitHub] [iceberg] liuxiaocs7 commented on a diff in pull request #7143: dell: remove usage of AssertHelpers

Posted by "liuxiaocs7 (via GitHub)" <gi...@apache.org>.
liuxiaocs7 commented on code in PR #7143:
URL: https://github.com/apache/iceberg/pull/7143#discussion_r1142445597


##########
dell/src/test/java/org/apache/iceberg/dell/ecs/TestEcsOutputFile.java:
##########
@@ -88,10 +88,8 @@ public void testFileAlreadyExists() throws IOException {
       output.write("1234567890".getBytes());
     }
 
-    AssertHelpers.assertThrows(
-        "Create should throw exception",
-        AlreadyExistsException.class,
-        outputFile.location(),
-        outputFile::create);
+    Assertions.assertThatThrownBy(outputFile::create)
+        .isInstanceOf(AlreadyExistsException.class)
+        .hasMessageContaining(outputFile.location());

Review Comment:
   Done!



##########
dell/src/test/java/org/apache/iceberg/dell/ecs/TestEcsTableOperations.java:
##########
@@ -57,15 +57,15 @@ public void testConcurrentCommit() {
     // Use the TableOperations to test the CommitFailedException
     // High level actions, such as Table#updateProperties(), may refresh metadata.
     TableOperations operations = ((HasTableOperations) catalog2Table).operations();
-    AssertHelpers.assertThrows(
-        "Commit failed when use out-dated status",
-        CommitFailedException.class,
-        () ->
-            operations.commit(
-                operations.current(),
-                TableMetadata.buildFrom(operations.current())
-                    .removeProperties(ImmutableSet.of("a"))
-                    .build()));
+    Assertions.assertThatThrownBy(
+            () ->
+                operations.commit(
+                    operations.current(),
+                    TableMetadata.buildFrom(operations.current())
+                        .removeProperties(ImmutableSet.of("a"))
+                        .build()))
+        .isInstanceOf(CommitFailedException.class)
+        .hasMessageContaining("Replace failed, E-Tag ");

Review Comment:
   Done!



##########
dell/src/test/java/org/apache/iceberg/dell/ecs/TestEcsURI.java:
##########
@@ -54,10 +54,9 @@ private void assertURI(String bucket, String name, EcsURI ecsURI) {
 
   @Test
   public void testInvalidLocation() {
-    AssertHelpers.assertThrows(
-        "Invalid location should cause exception",
-        ValidationException.class,
-        "http://bucket/a",
-        () -> new EcsURI("http://bucket/a"));
+
+    Assertions.assertThatThrownBy(() -> new EcsURI("http://bucket/a"))
+        .isInstanceOf(ValidationException.class)
+        .hasMessageContaining("http://bucket/a");

Review Comment:
   Done!



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


[GitHub] [iceberg] liuxiaocs7 commented on a diff in pull request #7143: dell: remove usage of AssertHelpers

Posted by "liuxiaocs7 (via GitHub)" <gi...@apache.org>.
liuxiaocs7 commented on code in PR #7143:
URL: https://github.com/apache/iceberg/pull/7143#discussion_r1142418595


##########
dell/src/test/java/org/apache/iceberg/dell/ecs/TestEcsCatalog.java:
##########
@@ -128,15 +127,13 @@ public void testDropNamespace() {
     ecsCatalog.createNamespace(Namespace.of("a", "b1"));
     ecsCatalog.createTable(TableIdentifier.of("a", "t1"), SCHEMA);
 
-    AssertHelpers.assertThrows(
-        "Drop an unknown namespace should throw exception",
-        NoSuchNamespaceException.class,
-        () -> ecsCatalog.dropNamespace(Namespace.of("unknown")));
+    Assertions.assertThatThrownBy(() -> ecsCatalog.dropNamespace(Namespace.of("unknown")))
+        .isInstanceOf(NoSuchNamespaceException.class)
+        .hasMessageContaining("Namespace %s does not exist", "unknown");

Review Comment:
   make sense, thanks.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


[GitHub] [iceberg] jackye1995 commented on pull request #7143: dell: remove usage of AssertHelpers

Posted by "jackye1995 (via GitHub)" <gi...@apache.org>.
jackye1995 commented on PR #7143:
URL: https://github.com/apache/iceberg/pull/7143#issuecomment-1476884776

   CI passed, thanks for working on this!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org