Unmute and fix testSubParserArray (#40626)
testSubParserArray failed, fixed and improved to not always have an object as outer-level inside array. Closes #40617
This commit is contained in:
parent
92d07e9377
commit
14ee3d3f95
|
@ -376,7 +376,7 @@ public class XContentParserTests extends ESTestCase {
|
||||||
builder.startArray();
|
builder.startArray();
|
||||||
int numberOfTokens = 0;
|
int numberOfTokens = 0;
|
||||||
for (int i = 0; i < numberOfArrayElements; ++i) {
|
for (int i = 0; i < numberOfArrayElements; ++i) {
|
||||||
numberOfTokens += generateRandomObjectForMarking(builder);
|
numberOfTokens += generateRandomObject(builder, 0);
|
||||||
}
|
}
|
||||||
builder.endArray();
|
builder.endArray();
|
||||||
builder.endObject();
|
builder.endObject();
|
||||||
|
@ -390,7 +390,7 @@ public class XContentParserTests extends ESTestCase {
|
||||||
assertEquals(XContentParser.Token.START_ARRAY, parser.nextToken()); // [
|
assertEquals(XContentParser.Token.START_ARRAY, parser.nextToken()); // [
|
||||||
XContentParser subParser = new XContentSubParser(parser);
|
XContentParser subParser = new XContentSubParser(parser);
|
||||||
try {
|
try {
|
||||||
int tokensToSkip = randomInt(numberOfTokens - 1);
|
int tokensToSkip = randomInt(numberOfTokens);
|
||||||
for (int i = 0; i < tokensToSkip; i++) {
|
for (int i = 0; i < tokensToSkip; i++) {
|
||||||
// Simulate incomplete parsing
|
// Simulate incomplete parsing
|
||||||
assertNotNull(subParser.nextToken());
|
assertNotNull(subParser.nextToken());
|
||||||
|
|
Loading…
Reference in New Issue