[Endpoint] Log random seed for sample data CLI to console (#60646)

* log random seed to console

* fix off by 1 error with children
This commit is contained in:
marshallmain 2020-03-19 17:01:39 -04:00 committed by GitHub
parent cd2d54d59a
commit 404e941e63
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 3 deletions

View file

@ -325,7 +325,7 @@ export class EndpointDocGenerator {
for (let i = 0; i < generations; i++) {
const newParents: EndpointEvent[] = [];
parents.forEach(element => {
const numChildren = this.randomN(maxChildrenPerNode);
const numChildren = this.randomN(maxChildrenPerNode + 1);
for (let j = 0; j < numChildren; j++) {
timestamp = timestamp + 1000;
const child = this.generateEvent({

View file

@ -131,8 +131,13 @@ async function main() {
process.exit(1);
}
}
const generator = new EndpointDocGenerator(argv.seed);
let seed = argv.seed;
if (!seed) {
seed = Math.random().toString();
// eslint-disable-next-line no-console
console.log('No seed supplied, using random seed: ' + seed);
}
const generator = new EndpointDocGenerator(seed);
for (let i = 0; i < argv.numHosts; i++) {
await client.index({
index: argv.metadataIndex,