This is an automated email from the ASF dual-hosted git repository.

elharo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-resolver.git


The following commit(s) were added to refs/heads/master by this push:
     new e405010d Stop the container in the shutdown method (#1525)
e405010d is described below

commit e405010d88bddce33cafaf782d1663d8d2688aa0
Author: Elliotte Rusty Harold <[email protected]>
AuthorDate: Fri Jul 11 17:37:23 2025 +0000

    Stop the container in the shutdown method (#1525)
    
    * How flaky is this test?
    * stop the server
---
 .../aether/transport/minio/MinioTransporterIT.java | 72 ++++++++--------------
 1 file changed, 26 insertions(+), 46 deletions(-)

diff --git 
a/maven-resolver-transport-minio/src/test/java/org/eclipse/aether/transport/minio/MinioTransporterIT.java
 
b/maven-resolver-transport-minio/src/test/java/org/eclipse/aether/transport/minio/MinioTransporterIT.java
index 6af72ce2..6332633f 100644
--- 
a/maven-resolver-transport-minio/src/test/java/org/eclipse/aether/transport/minio/MinioTransporterIT.java
+++ 
b/maven-resolver-transport-minio/src/test/java/org/eclipse/aether/transport/minio/MinioTransporterIT.java
@@ -39,7 +39,6 @@ import 
org.eclipse.aether.transport.minio.internal.RepositoryIdObjectNameMapperF
 import org.eclipse.aether.util.FileUtils;
 import org.eclipse.aether.util.repository.AuthenticationBuilder;
 import org.junit.jupiter.api.AfterEach;
-import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
 import org.testcontainers.containers.MinIOContainer;
@@ -62,7 +61,6 @@ class MinioTransporterIT {
     private MinIOContainer minioContainer;
     private MinioClient minioClient;
     private RepositorySystemSession session;
-    private RemoteRepository repository;
     private ObjectNameMapperFactory objectNameMapperFactory;
 
     @BeforeEach
@@ -87,13 +85,12 @@ class MinioTransporterIT {
         }
 
         session = new DefaultRepositorySystemSession(h -> true);
-        repository = newRepo(RepositoryAuth.WITH);
         objectNameMapperFactory = new RepositoryIdObjectNameMapperFactory();
     }
 
     @AfterEach
-    public void stopSuite() {
-        minioContainer.start();
+    void stopSuite() {
+        minioContainer.stop();
     }
 
     enum RepositoryAuth {
@@ -120,19 +117,17 @@ class MinioTransporterIT {
     }
 
     @Test
-    void peekWithoutAuth() {
+    void peekWithoutAuth() throws NoTransporterException {
         try {
             new MinioTransporter(session, newRepo(RepositoryAuth.WITHOUT), 
objectNameMapperFactory);
             fail("Should throw");
-        } catch (NoTransporterException e) {
-            fail("Should not throw this");
         } catch (IllegalStateException e) {
             assertTrue(e.getMessage().contains("No accessKey and/or secretKey 
provided"));
         }
     }
 
     @Test
-    void peekWithWrongAuth() throws Exception {
+    void peekWithWrongAuth() throws NoTransporterException {
         try (MinioTransporter transporter =
                 new MinioTransporter(session, newRepo(RepositoryAuth.WRONG), 
objectNameMapperFactory)) {
             try {
@@ -146,7 +141,7 @@ class MinioTransporterIT {
     }
 
     @Test
-    void peekNonexistent() throws Exception {
+    void peekNonexistent() throws NoTransporterException {
         try (MinioTransporter transporter =
                 new MinioTransporter(session, newRepo(RepositoryAuth.WITH), 
objectNameMapperFactory)) {
             try {
@@ -163,16 +158,13 @@ class MinioTransporterIT {
     void peekExistent() throws Exception {
         try (MinioTransporter transporter =
                 new MinioTransporter(session, newRepo(RepositoryAuth.WITH), 
objectNameMapperFactory)) {
-            try {
-                transporter.peek(new PeekTask(URI.create(OBJECT_NAME)));
-            } catch (Exception e) {
-                Assertions.fail("Should not throw");
-            }
+            transporter.peek(new PeekTask(URI.create(OBJECT_NAME)));
+            // Should not throw
         }
     }
 
     @Test
-    void getNonexistent() throws Exception {
+    void getNonexistent() throws NoTransporterException {
         try (MinioTransporter transporter =
                 new MinioTransporter(session, newRepo(RepositoryAuth.WITH), 
objectNameMapperFactory)) {
             try {
@@ -189,13 +181,9 @@ class MinioTransporterIT {
     void getExistent() throws Exception {
         try (MinioTransporter transporter =
                 new MinioTransporter(session, newRepo(RepositoryAuth.WITH), 
objectNameMapperFactory)) {
-            try {
-                GetTask task = new GetTask(URI.create(OBJECT_NAME));
-                transporter.get(task);
-                assertEquals(OBJECT_CONTENT, new String(task.getDataBytes(), 
StandardCharsets.UTF_8));
-            } catch (Exception e) {
-                Assertions.fail("Should not throw");
-            }
+            GetTask task = new GetTask(URI.create(OBJECT_NAME));
+            transporter.get(task);
+            assertEquals(OBJECT_CONTENT, new String(task.getDataBytes(), 
StandardCharsets.UTF_8));
         }
     }
 
@@ -203,15 +191,11 @@ class MinioTransporterIT {
     void putNonexistent() throws Exception {
         try (MinioTransporter transporter =
                 new MinioTransporter(session, newRepo(RepositoryAuth.WITH), 
objectNameMapperFactory)) {
-            try {
-                URI uri = URI.create("test");
-                transporter.put(new 
PutTask(uri).setDataBytes(OBJECT_CONTENT.getBytes(StandardCharsets.UTF_8)));
-                GetTask task = new GetTask(uri);
-                transporter.get(task);
-                assertEquals(OBJECT_CONTENT, new String(task.getDataBytes(), 
StandardCharsets.UTF_8));
-            } catch (Exception e) {
-                Assertions.fail("Should not throw");
-            }
+            URI uri = URI.create("test");
+            transporter.put(new 
PutTask(uri).setDataBytes(OBJECT_CONTENT.getBytes(StandardCharsets.UTF_8)));
+            GetTask task = new GetTask(uri);
+            transporter.get(task);
+            assertEquals(OBJECT_CONTENT, new String(task.getDataBytes(), 
StandardCharsets.UTF_8));
         }
     }
 
@@ -219,20 +203,16 @@ class MinioTransporterIT {
     void putExistent() throws Exception {
         try (MinioTransporter transporter =
                 new MinioTransporter(session, newRepo(RepositoryAuth.WITH), 
objectNameMapperFactory)) {
-            try {
-                URI uri = URI.create(OBJECT_NAME);
-                GetTask task = new GetTask(uri);
-                transporter.get(task);
-                assertEquals(OBJECT_CONTENT, new String(task.getDataBytes(), 
StandardCharsets.UTF_8));
-
-                String altContent = "altContent";
-                transporter.put(new 
PutTask(uri).setDataBytes(altContent.getBytes(StandardCharsets.UTF_8)));
-                task = new GetTask(uri);
-                transporter.get(task);
-                assertEquals(altContent, new String(task.getDataBytes(), 
StandardCharsets.UTF_8));
-            } catch (Exception e) {
-                Assertions.fail("Should not throw");
-            }
+            URI uri = URI.create(OBJECT_NAME);
+            GetTask task = new GetTask(uri);
+            transporter.get(task);
+            assertEquals(OBJECT_CONTENT, new String(task.getDataBytes(), 
StandardCharsets.UTF_8));
+
+            String altContent = "altContent";
+            transporter.put(new 
PutTask(uri).setDataBytes(altContent.getBytes(StandardCharsets.UTF_8)));
+            task = new GetTask(uri);
+            transporter.get(task);
+            assertEquals(altContent, new String(task.getDataBytes(), 
StandardCharsets.UTF_8));
         }
     }
 }

Reply via email to