Skip to content

Commit

Permalink
SOLR-17066 Fix ShardSplitTest & StressHdfsTest (#2457)
Browse files Browse the repository at this point in the history
Clarify getBaseURL
  • Loading branch information
dsmiley authored May 14, 2024
1 parent 2bd4df5 commit d141875
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1277,9 +1277,7 @@ protected void splitShard(
QueryRequest request = new QueryRequest(params);
request.setPath("/admin/collections");

String baseUrl =
((HttpSolrClient) shardToJetty.get(SHARD1).get(0).client.getSolrClient()).getBaseURL();
baseUrl = baseUrl.substring(0, baseUrl.length() - "collection1".length());
String baseUrl = shardToJetty.get(SHARD1).get(0).jetty.getBaseUrl().toString();

try (SolrClient baseServer =
new HttpSolrClient.Builder(baseUrl)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,4 +251,8 @@ private void createAndDeleteCollection() throws Exception {
}
}
}

protected String getBaseUrl(SolrClient client) {
return ((HttpSolrClient) client).getBaseURL();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -801,6 +801,7 @@ public ModifiableSolrParams getInvariantParams() {
return invariantParams;
}

/** Typically looks like {@code http://localhost:8983/solr} (no core or collection) */
public String getBaseURL() {
return baseUrl;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1115,16 +1115,6 @@ public static void createCollectionInOneInstance(
}
}

protected String getBaseUrl(SolrClient client) {
String url2 =
((HttpSolrClient) client)
.getBaseURL()
.substring(
0,
((HttpSolrClient) client).getBaseURL().length() - DEFAULT_COLLECTION.length() - 1);
return url2;
}

@Override
protected CollectionAdminResponse createCollection(
Map<String, List<Integer>> collectionInfos,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,10 @@ public static class CloudJettyRunner {
public JettySolrRunner jetty;
public String nodeName;
public String coreNodeName;

/** Core or Collection URL */
public String url;

public CloudSolrServerClient client;
public ZkNodeProps info;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -834,10 +834,7 @@ public void setProxyPort(int proxyPort) {
this.proxyPort = proxyPort;
}

/**
* Returns a base URL consisting of the protocol, host, and port for a Connector in use by the
* Jetty Server contained in this runner.
*/
/** Returns a base URL like {@code http://localhost:8983/solr} */
public URL getBaseUrl() {
try {
return new URL(protocol, host, jettyPort, "/solr");
Expand Down

0 comments on commit d141875

Please sign in to comment.