Skip to content

Commit

Permalink
Fix GCS Repository YAML Test Build (elastic#57073) (elastic#57101)
Browse files Browse the repository at this point in the history
A few relatively obvious issues here:

* We cannot run the different IT runs (large blob setting one and normal integ run) concurrently
* We need to set the dependency tasks up correctly for the large blob run so that it works in isolation
* We can't use the `localAddress` for the location header of the resumable upload
(this breaks in YAML tests because GCS is using a loopback port forward for the initial request and the
local address will be chosen as the actual Docker container host)

Closes elastic#57026
  • Loading branch information
original-brownbear committed May 27, 2020
1 parent 9798f74 commit b7ca40a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
3 changes: 2 additions & 1 deletion plugins/repository-gcs/qa/google-cloud-storage/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ integTest.mustRunAfter(thirdPartyTest)
* an additional test that forces the large blob threshold to be small to exercise the resumable upload path.
*/
task largeBlobIntegTest(type: RestIntegTestTask) {
mustRunAfter(thirdPartyTest)
mustRunAfter(thirdPartyTest, integTest)
}

check.dependsOn integTest
Expand Down Expand Up @@ -158,6 +158,7 @@ final Closure testClustersConfiguration = {

if (useFixture) {
tasks.integTest.dependsOn createServiceAccountFile
tasks.largeBlobIntegTest.dependsOn createServiceAccountFile
/* Use a closure on the string to delay evaluation until tests are executed */
setting 'gcs.client.integration_test.endpoint', { "${-> fixtureAddress('gcs-fixture')}" }, IGNORE_VALUE
setting 'gcs.client.integration_test.token_uri', { "${-> fixtureAddress('gcs-fixture')}/o/oauth2/token" }, IGNORE_VALUE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
import org.elasticsearch.common.bytes.CompositeBytesReference;
import org.elasticsearch.common.collect.Tuple;
import org.elasticsearch.common.io.Streams;
import org.elasticsearch.common.network.InetAddresses;
import org.elasticsearch.common.regex.Regex;
import org.elasticsearch.rest.RestStatus;
import org.elasticsearch.rest.RestUtils;
Expand All @@ -40,7 +39,6 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.InetSocketAddress;
import java.net.URLDecoder;
import java.util.ArrayList;
import java.util.HashMap;
Expand Down Expand Up @@ -252,8 +250,7 @@ public Map<String, BytesReference> blobs() {
}

private String httpServerUrl(final HttpExchange exchange) {
final InetSocketAddress address = exchange.getLocalAddress();
return "http://" + InetAddresses.toUriString(address.getAddress()) + ":" + address.getPort();
return "http://" + exchange.getRequestHeaders().get("HOST").get(0);
}

private static final Pattern NAME_PATTERN = Pattern.compile("\"name\":\"([^\"]*)\"");
Expand Down

0 comments on commit b7ca40a

Please sign in to comment.