Skip to content

Commit 7722f53

Browse files
Unmute and fix testSubParserArray (#40626)
testSubParserArray failed, fixed and improved to not always have an object as outer-level inside array. Closes #40617
1 parent 0fd8a9f commit 7722f53

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

libs/x-content/src/test/java/org/elasticsearch/common/xcontent/XContentParserTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ public void testSubParserArray() throws IOException {
376376
builder.startArray();
377377
int numberOfTokens = 0;
378378
for (int i = 0; i < numberOfArrayElements; ++i) {
379-
numberOfTokens += generateRandomObjectForMarking(builder);
379+
numberOfTokens += generateRandomObject(builder, 0);
380380
}
381381
builder.endArray();
382382
builder.endObject();
@@ -390,7 +390,7 @@ public void testSubParserArray() throws IOException {
390390
assertEquals(XContentParser.Token.START_ARRAY, parser.nextToken()); // [
391391
XContentParser subParser = new XContentSubParser(parser);
392392
try {
393-
int tokensToSkip = randomInt(numberOfTokens - 1);
393+
int tokensToSkip = randomInt(numberOfTokens);
394394
for (int i = 0; i < tokensToSkip; i++) {
395395
// Simulate incomplete parsing
396396
assertNotNull(subParser.nextToken());

0 commit comments

Comments
 (0)