-
Notifications
You must be signed in to change notification settings - Fork 25.2k
[TRANSFORM] Remove HLRC from single node tests #84220
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1347,8 +1347,8 @@ public void testPivotWithGeoBoundsAgg() throws Exception { | |
)).get(0); | ||
assertThat(actualObj.get("type"), equalTo("point")); | ||
List<Double> coordinates = (List<Double>) actualObj.get("coordinates"); | ||
assertEquals((4 + 10), coordinates.get(1), 0.000001); | ||
assertEquals((4 + 15), coordinates.get(0), 0.000001); | ||
assertEquals(-76.0, coordinates.get(1), 0.000001); | ||
assertEquals(-161.0, coordinates.get(0), 0.000001); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also due to the lat/lon change |
||
} | ||
|
||
public void testPivotWithGeoCentroidAgg() throws Exception { | ||
|
@@ -1411,8 +1411,8 @@ public void testPivotWithGeoCentroidAgg() throws Exception { | |
assertEquals(3.878048780, actual.doubleValue(), 0.000001); | ||
String actualString = (String) ((List<?>) XContentMapValues.extractValue("hits.hits._source.location", searchResult)).get(0); | ||
String[] latlon = actualString.split(","); | ||
assertEquals((4 + 10), Double.valueOf(latlon[0]), 0.000001); | ||
assertEquals((4 + 15), Double.valueOf(latlon[1]), 0.000001); | ||
assertEquals(-76.0, Double.valueOf(latlon[0]), 0.000001); | ||
assertEquals(-161.0, Double.valueOf(latlon[1]), 0.000001); | ||
} | ||
|
||
@SuppressWarnings("unchecked") | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -248,8 +248,8 @@ public void testRestrictiveBucketSelector() throws Exception { | |
String indexName = "special_pivot_bucket_selector_reviews"; | ||
createReviewsIndex(indexName, 1000, 327, "date", false, 5, "affiliate_id"); | ||
|
||
verifyDestIndexHitsCount(indexName, "special_pivot_bucket_selector-10", 10, 14); | ||
verifyDestIndexHitsCount(indexName, "special_pivot_bucket_selector-10000", 10000, 14); | ||
verifyDestIndexHitsCount(indexName, "special_pivot_bucket_selector-10", 10, 41); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The change here is the result of fixing the geo-coordinates that were failing bulk upload |
||
verifyDestIndexHitsCount(indexName, "special_pivot_bucket_selector-10000", 10000, 41); | ||
} | ||
|
||
private void verifyDestIndexHitsCount(String sourceIndex, String transformId, int maxPageSearchSize, long expectedDestIndexCount) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,7 +39,6 @@ | |
import static org.elasticsearch.xcontent.XContentFactory.jsonBuilder; | ||
import static org.hamcrest.Matchers.equalTo; | ||
import static org.hamcrest.Matchers.is; | ||
import static org.junit.Assert.assertThat; | ||
|
||
public abstract class TransformRestTestCase extends ESRestTestCase { | ||
|
||
|
@@ -88,7 +87,7 @@ protected void createReviewsIndex( | |
min = 10 + (i % 49); | ||
} | ||
int sec = 10 + (i % 49); | ||
String location = (user + 10) + "," + (user + 15); | ||
String location = (((user + 10) % 180) - 90) + "," + (((user + 15) % 360) - 180); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bulk upload was failing for the test |
||
|
||
String date_string = "2017-01-" + day + "T" + hour + ":" + min + ":" + sec; | ||
if (dateType.equals("date_nanos")) { | ||
|
@@ -123,21 +122,33 @@ protected void createReviewsIndex( | |
|
||
if (i % 50 == 0) { | ||
bulk.append("\r\n"); | ||
final Request bulkRequest = new Request("POST", "/_bulk"); | ||
bulkRequest.addParameter("refresh", "true"); | ||
bulkRequest.setJsonEntity(bulk.toString()); | ||
client().performRequest(bulkRequest); | ||
doBulk(bulk.toString(), true); | ||
// clear the builder | ||
bulk.setLength(0); | ||
day += 1; | ||
} | ||
} | ||
|
||
bulk.append("\r\n"); | ||
doBulk(bulk.toString(), true); | ||
} | ||
|
||
final Request bulkRequest = new Request("POST", "/_bulk"); | ||
bulkRequest.addParameter("refresh", "true"); | ||
bulkRequest.setJsonEntity(bulk.toString()); | ||
client().performRequest(bulkRequest); | ||
@SuppressWarnings("unchecked") | ||
protected void doBulk(String bulkDocuments, boolean refresh) throws IOException { | ||
Request bulkRequest = new Request("POST", "/_bulk"); | ||
if (refresh) { | ||
bulkRequest.addParameter("refresh", "true"); | ||
} | ||
bulkRequest.setJsonEntity(bulkDocuments); | ||
bulkRequest.setOptions(RequestOptions.DEFAULT); | ||
Response bulkResponse = client().performRequest(bulkRequest); | ||
assertOK(bulkResponse); | ||
var bulkMap = entityAsMap(bulkResponse); | ||
var hasErrors = (boolean) bulkMap.get("errors"); | ||
if (hasErrors) { | ||
var items = (List<Map<String, Object>>) bulkMap.get("items"); | ||
fail("Bulk item failures: " + items.toString()); | ||
} | ||
} | ||
|
||
protected void putReviewsIndex(String indexName, String dateType, boolean isDataStream) throws IOException { | ||
|
@@ -463,6 +474,13 @@ protected static List<Map<String, Object>> getTransforms(List<Map<String, String | |
return transformConfigs == null ? Collections.emptyList() : transformConfigs; | ||
} | ||
|
||
@SuppressWarnings("unchecked") | ||
protected static Map<String, Object> getTransforms(int from, int size) throws IOException { | ||
Request request = new Request("GET", getTransformEndpoint() + "_all?from=" + from + "&size=" + size); | ||
Response response = adminClient().performRequest(request); | ||
return entityAsMap(response); | ||
} | ||
|
||
protected static String getTransformState(String transformId) throws IOException { | ||
Map<?, ?> transformStatsAsMap = getTransformStateAndStats(transformId); | ||
return transformStatsAsMap == null ? null : (String) XContentMapValues.extractValue("state", transformStatsAsMap); | ||
|
@@ -477,6 +495,13 @@ protected static String getTransformState(String transformId) throws IOException | |
return (Map<?, ?>) transforms.get(0); | ||
} | ||
|
||
protected static Map<String, Object> getTransformStateAndStats(int from, int size) throws IOException { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since it returns a number of transforms, would it make sense to name it |
||
Response statsResponse = client().performRequest( | ||
new Request("GET", getTransformEndpoint() + "_stats?from=" + from + "&size=" + size) | ||
); | ||
return entityAsMap(statsResponse); | ||
} | ||
|
||
protected static void deleteTransform(String transformId) throws IOException { | ||
Request request = new Request("DELETE", getTransformEndpoint() + transformId); | ||
request.addParameter("ignore", "404"); // Ignore 404s because they imply someone was racing us to delete this | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
static?