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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to