ppalaga commented on a change in pull request #3279:
URL: https://github.com/apache/camel-quarkus/pull/3279#discussion_r746027414
##########
File path:
integration-test-groups/aws2/aws2-s3/src/test/java/org/apache/camel/quarkus/component/aws2/Aws2S3Test.java
##########
@@ -36,6 +37,19 @@
@QuarkusTestResource(Aws2TestResource.class)
class Aws2S3Test {
+ @AfterEach
+ public void after() {
+
+ // Make sure all create objects have been deleted
+ final String[] objects = RestAssured.given()
+ .get("/aws2/s3/object-keys")
+ .then()
+ .statusCode(200)
+ .extract()
+ .body().as(String[].class);
+ Assertions.assertTrue(objects.length == 0);
Review comment:
> Is it good idea to put assertions in @AfterEach ?
My understanding is that this `@AfterEach` assertion is intended much more
as a check that the test has no leaks than an ordinary assertion checking the
behavior of the application under test. Hence +1 for me.
> Would each test be successful only when objects.length ==0, maybe we could
assert at the end of each test ?
`@AfterEach` has the advantage that it holds for all current and future test
methods. If a method gets added in the future that leaks objects, the author
will get notified early.
> Would objects.length==0 show a situation where the tests execution is not
satisfying, maybe throwing an exception is better ?
Well, the assert method throws an AssertionError. Not sure what else could
we do for making the test execution fail?
--
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]