Explorar el Código

Remove Minio Host Hack in S3 Repository Build (#44491)

* Resolving the todo to clean this hackyness up
Armin Braun hace 6 años
padre
commit
5cda8709b6

+ 1 - 8
plugins/repository-s3/build.gradle

@@ -167,8 +167,6 @@ if (useFixture) {
     'http://127.0.0.1:' + minioPort
   }
 
-  File minioAddressFile = new File(project.buildDir, 'generated-resources/s3Fixture.address')
-
   normalization {
     runtimeClasspath {
       // ignore generated address file for the purposes of build avoidance
@@ -178,12 +176,7 @@ if (useFixture) {
 
   thirdPartyTest {
     dependsOn tasks.bundlePlugin, tasks.postProcessFixture
-    outputs.file(minioAddressFile)
-    doFirst {
-      file(minioAddressFile).text = "${ -> minioAddress.call() }"
-    }
-    // TODO: this could be a nonInputProperties.systemProperty so we don't need a file
-    systemProperty 'test.s3.endpoint', minioAddressFile.name
+    nonInputProperties.systemProperty 'test.s3.endpoint', "${ -> minioAddress.call() }"
   }
 
   task integTestMinio(type: RestIntegTestTask) {

+ 4 - 10
plugins/repository-s3/src/test/java/org/elasticsearch/repositories/s3/S3RepositoryThirdPartyTests.java

@@ -27,12 +27,10 @@ import org.elasticsearch.common.settings.Settings;
 import org.elasticsearch.plugins.Plugin;
 import org.elasticsearch.repositories.AbstractThirdPartyRepositoryTestCase;
 import org.elasticsearch.repositories.blobstore.BlobStoreRepository;
-import org.elasticsearch.test.StreamsUtils;
 
-import java.io.IOException;
 import java.util.Collection;
-import java.util.concurrent.Executor;
 import java.util.Map;
+import java.util.concurrent.Executor;
 import java.util.concurrent.TimeUnit;
 
 import static org.hamcrest.Matchers.blankOrNullString;
@@ -63,13 +61,9 @@ public class S3RepositoryThirdPartyTests extends AbstractThirdPartyRepositoryTes
         Settings.Builder settings = Settings.builder()
             .put("bucket", System.getProperty("test.s3.bucket"))
             .put("base_path", System.getProperty("test.s3.base", "testpath"));
-        final String endpointPath = System.getProperty("test.s3.endpoint");
-        if (endpointPath != null) {
-            try {
-                settings = settings.put("endpoint", StreamsUtils.copyToStringFromClasspath("/" + endpointPath));
-            } catch (IOException e) {
-                throw new AssertionError(e);
-            }
+        final String endpoint = System.getProperty("test.s3.endpoint");
+        if (endpoint != null) {
+            settings = settings.put("endpoint", endpoint);
         }
         AcknowledgedResponse putRepositoryResponse = client().admin().cluster().preparePutRepository("test-repo")
             .setType("s3")