sparkletown/sparkle

View on GitHub
scripts/simulator/simulator.config.json5.example

Summary

Maintainability
Test Coverage
// NOTE: JSON5 is superset of JSON with some added functionalities @see https://json5.org/
// NOTE: JSON5 makes it easier for people to write config files while JSON is more geared for data transfer

// For the full definition of this file's expected values, you can check SimConfig in ./scripts/lib/types.ts
// For extensive changes, you can create multiple *.config.json or *.config.json5 files in this directory


{
  // this points to your credentials file, @see ./scripts/simulator/simulator.credentials.json5.example
  credentials: "./simulator/simulator.credentials.json",

  // this is the project a.k.a. environment to run the test to
  // must be the same as the one specified in the credentials file
  projectId: "simulator-project",

  // default: undefined - if set, number of minutes after which the simulator should end all simulations
  timeout: 1,

  // default: true - if set to false, the script will not wait for CTRL+C but exit immediately, useful for just cleanup
  keepAlive: false,

  // values are same as SimulationName from ./scripts/lib/types.ts
  // you can pick which simulations to run or comment it out for all simulations to run
  // an empty array means no simulations will run
  //  simulate: [
  //    'chat',
  //    'experience',
  //    'seat',
  //    'table',
  //  ],

  log: {

    // default: false - if set to true, there will be a lot more chatter in the console from the simulations run
    verbose: true,

    // default: true - useful for debugging, when set to false, there will be no stack trace printed when Error is thrown
    stack: false,
  },

  // some useful settings for the creation/retention of simulated users
  user: {

    // how many simulated users to find/create for the simulation
    count: 100,

    // this tag is set to simulated data as botUserScriptTag:scriptTag along with bot:true
    // and it makes it easier to identify data for removal, especially if multiple scripts are run
    scriptTag: "user-simulator",

    // default: true - when set to false, simulator doesn't try to create missing users, useful when they're pre-created
    createMissing: true,

    // default: true - when set to false, the simulator will not delete the created user DB records
    // for the case of users, it is the very same ones found/created by the simulator
    // cleanup flag in the other simulations will delete only those with appropriate fields bot:true and botUserScriptTag:scriptTag
    cleanup: true,
  },

  // configuration relevant to the venue being tested
  venue: {

    // required venue name/id
    id: "venue id",
  },

  // The following settings will be overridden by the ones for the respective simulations

  // chunkSize determines how many users to do simulations with at once time, per each cycle
  // defaults: DEFAULT_CHAT_CHUNK_SIZE, DEFAULT_CHAT_EXPERIENCE_SIZE, DEFAULT_SEAT_CHUNK_SIZE
  chunkSize: 100,

  // tick determines the time in milliseconds to wait between each operation with a chunk of the users
  // defaults: DEFAULT_CHAT_TICK_MS, DEFAULT_EXPERIENCE_TICK_MS,DEFAULT_SEAT_TICK_MS
  tick: 1000,

  // affinity determines how likely it is for a single user to perform the simulated action
  // value is from 0 (meaning 0%) to 1 (meaning 100%)
  // defaults: DEFAULT_CHAT_AFFINITY, DEFAULT_EXPERIENCE_AFFINITY, DEFAULT_SEAT_AFFINITY
  affinity: 0.01,

  // settings for the seats simulation
  seat: {

    // determines how eager a simulated user is to sit for the first time
    // it works the same as affinity, only for the unseated users
    // default: DEFAULT_SEAT_IMPATIENCE - should be same value as DEFAULT_SEAT_AFFINITY
    impatience: 0.5,

    affinity: 0.01,
    chunkSize: 100,
    tick: 1000,
  },

  // settings for the chat simulation
  chat: {
    affinity: 0.005,
    chunkSize: 100,
    cleanup: true,
    tick: 9999,
  },

  // settings for the experience/reactions simulation
  experience: {
    affinity: 0.005,
    chunkSize: 100,
    cleanup: true,
    tick: 9999,
  }
}