You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by GitBox <gi...@apache.org> on 2022/04/14 10:08:44 UTC

[GitHub] [camel-quarkus] zhfeng opened a new pull request, #3729: Fix #3728 AWS S3 integration test should remove all objects in finall…

zhfeng opened a new pull request, #3729:
URL: https://github.com/apache/camel-quarkus/pull/3729

   …y block
   
   <!-- Uncomment and fill this section if your PR is not trivial
   [ ] An issue should be filed for the change unless this is a trivial change (fixing a typo or similar). One issue should ideally be fixed by not more than one commit and the other way round, each commit should fix just one issue, without pulling in other changes.
   [ ] Each commit in the pull request should have a meaningful and properly spelled subject line and body. Copying the title of the associated issue is typically enough. Please include the issue number in the commit message prefixed by #.
   [ ] The pull request description should explain what the pull request does, how, and why. If the info is available in the associated issue or some other external document, a link is enough.
   [ ] Phrases like Fix #<issueNumber> or Fixes #<issueNumber> will auto-close the named issue upon merging the pull request. Using them is typically a good idea.
   [ ] Please run mvn process-resources -Pformat (and amend the changes if necessary) before sending the pull request.
   [ ] Contributor guide is your good friend: https://camel.apache.org/camel-quarkus/latest/contributor-guide.html
   -->


-- 
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: commits-unsubscribe@camel.apache.org

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


[GitHub] [camel-quarkus] zhfeng merged pull request #3729: Fix #3728 AWS S3 integration test should remove all objects in finall…

Posted by GitBox <gi...@apache.org>.
zhfeng merged PR #3729:
URL: https://github.com/apache/camel-quarkus/pull/3729


-- 
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: commits-unsubscribe@camel.apache.org

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


[GitHub] [camel-quarkus] essobedo commented on a diff in pull request #3729: Fix #3728 AWS S3 integration test should remove all objects in finall…

Posted by GitBox <gi...@apache.org>.
essobedo commented on code in PR #3729:
URL: https://github.com/apache/camel-quarkus/pull/3729#discussion_r850306156


##########
integration-test-groups/aws2/aws2-s3/src/test/java/org/apache/camel/quarkus/component/aws2/s3/it/Aws2S3Test.java:
##########
@@ -164,47 +164,51 @@ public void testKms() throws Exception {
         final String oid = UUID.randomUUID().toString();
         final String blobContent = "Hello KMS " + oid;
 
-        // Create
-        RestAssured.given()
-                .contentType(ContentType.TEXT)
-                .body(blobContent)
-                .post("/aws2/s3/object/" + oid + "?useKms=true")
-                .then()
-                .statusCode(201);
-
-        // Read
-        RestAssured.get("/aws2/s3/object/" + oid + "?useKms=true")
-                .then()
-                .statusCode(200)
-                .body(is(blobContent));
+        try {
+            // Create
+            RestAssured.given()
+                    .contentType(ContentType.TEXT)
+                    .body(blobContent)
+                    .post("/aws2/s3/object/" + oid + "?useKms=true")
+                    .then()
+                    .statusCode(201);
 
-        // Delete
-        deleteObject(oid);
+            // Read
+            RestAssured.get("/aws2/s3/object/" + oid + "?useKms=true")
+                    .then()
+                    .statusCode(200)
+                    .body(is(blobContent));
+        } finally {
+            // Delete
+            deleteObject(oid);

Review Comment:
   Should be done in an AfterEach method instead of a  finally block



-- 
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: commits-unsubscribe@camel.apache.org

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


[GitHub] [camel-quarkus] ppalaga commented on a diff in pull request #3729: Fix #3728 AWS S3 integration test should remove all objects in finall…

Posted by GitBox <gi...@apache.org>.
ppalaga commented on code in PR #3729:
URL: https://github.com/apache/camel-quarkus/pull/3729#discussion_r850635403


##########
integration-test-groups/aws2/aws2-s3/src/test/java/org/apache/camel/quarkus/component/aws2/s3/it/Aws2S3Test.java:
##########
@@ -164,47 +164,51 @@ public void testKms() throws Exception {
         final String oid = UUID.randomUUID().toString();
         final String blobContent = "Hello KMS " + oid;
 
-        // Create
-        RestAssured.given()
-                .contentType(ContentType.TEXT)
-                .body(blobContent)
-                .post("/aws2/s3/object/" + oid + "?useKms=true")
-                .then()
-                .statusCode(201);
-
-        // Read
-        RestAssured.get("/aws2/s3/object/" + oid + "?useKms=true")
-                .then()
-                .statusCode(200)
-                .body(is(blobContent));
+        try {
+            // Create
+            RestAssured.given()
+                    .contentType(ContentType.TEXT)
+                    .body(blobContent)
+                    .post("/aws2/s3/object/" + oid + "?useKms=true")
+                    .then()
+                    .statusCode(201);
 
-        // Delete
-        deleteObject(oid);
+            // Read
+            RestAssured.get("/aws2/s3/object/" + oid + "?useKms=true")
+                    .then()
+                    .statusCode(200)
+                    .body(is(blobContent));
+        } finally {
+            // Delete
+            deleteObject(oid);

Review Comment:
   @essobedo thanks for the review! 
   We were hit by high AWS bills in the past when tests were either missing cleanup code or when something failed midair and the cleanup code was not invoked. Using try-catch helps to address both: missing cleanup code is easier to spot and existing cleanup code is harder to skip. Thus +1 for this change from my side. 



-- 
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: commits-unsubscribe@camel.apache.org

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


[GitHub] [camel-quarkus] zhfeng commented on a diff in pull request #3729: Fix #3728 AWS S3 integration test should remove all objects in finall…

Posted by GitBox <gi...@apache.org>.
zhfeng commented on code in PR #3729:
URL: https://github.com/apache/camel-quarkus/pull/3729#discussion_r850384194


##########
integration-test-groups/aws2/aws2-s3/src/test/java/org/apache/camel/quarkus/component/aws2/s3/it/Aws2S3Test.java:
##########
@@ -164,47 +164,51 @@ public void testKms() throws Exception {
         final String oid = UUID.randomUUID().toString();
         final String blobContent = "Hello KMS " + oid;
 
-        // Create
-        RestAssured.given()
-                .contentType(ContentType.TEXT)
-                .body(blobContent)
-                .post("/aws2/s3/object/" + oid + "?useKms=true")
-                .then()
-                .statusCode(201);
-
-        // Read
-        RestAssured.get("/aws2/s3/object/" + oid + "?useKms=true")
-                .then()
-                .statusCode(200)
-                .body(is(blobContent));
+        try {
+            // Create
+            RestAssured.given()
+                    .contentType(ContentType.TEXT)
+                    .body(blobContent)
+                    .post("/aws2/s3/object/" + oid + "?useKms=true")
+                    .then()
+                    .statusCode(201);
 
-        // Delete
-        deleteObject(oid);
+            // Read
+            RestAssured.get("/aws2/s3/object/" + oid + "?useKms=true")
+                    .then()
+                    .statusCode(200)
+                    .body(is(blobContent));
+        } finally {
+            // Delete
+            deleteObject(oid);

Review Comment:
   The oid is a random generated id and there are some other tests such as ```copyObjectDeleteBucket``` which has a different test logic. There's also a ```@AfterEach``` method to check the objects leaking. 



-- 
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: commits-unsubscribe@camel.apache.org

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