[TEST] increase minimum length of randomly generated fields in RandomObjects

We had a couple of unfortunate field name collisions in our CI, where the json duplicate check tripped. Increasing the minimum length of randomly generated field names should decrease the chance of this issue happening again.
This commit is contained in:
javanna 2017-04-10 11:32:14 +02:00 committed by Luca Cavanna
parent 9b3c85dd88
commit 3b7bc8012a
1 changed files with 3 additions and 3 deletions

View File

@ -190,11 +190,11 @@ public final class RandomObjects {
for (int i = 0; i < numFields; i++) {
if (currentDepth < 5 && random.nextBoolean()) {
if (random.nextBoolean()) {
builder.startObject(RandomStrings.randomAsciiOfLengthBetween(random, 4, 10));
builder.startObject(RandomStrings.randomAsciiOfLengthBetween(random, 6, 10));
addFields(random, builder, minNumFields, currentDepth + 1);
builder.endObject();
} else {
builder.startArray(RandomStrings.randomAsciiOfLengthBetween(random, 4, 10));
builder.startArray(RandomStrings.randomAsciiOfLengthBetween(random, 6, 10));
int numElements = randomIntBetween(random, 1, 5);
boolean object = random.nextBoolean();
int dataType = -1;
@ -213,7 +213,7 @@ public final class RandomObjects {
builder.endArray();
}
} else {
builder.field(RandomStrings.randomAsciiOfLengthBetween(random, 4, 10),
builder.field(RandomStrings.randomAsciiOfLengthBetween(random, 6, 10),
randomFieldValue(random, randomDataType(random)));
}
}