random activity generator
takes a happn client at construction time, and performs random activities against the clients happn server. highly configurable - allows for the percentage of gets, sets, removes and ons to be configured. For ons, gets and removes some initial data needs to be created - this is also configurable
quickstart:
npm install happn-random-activity-generator --save-dev
configuration:
var RandomActivity = ; //the options are the second parameter - the amounts are the default amountsgenerator = happnClientInstance interval:20//in milliseconds, the interval between each new random call percentageGets:020//range out of 100 of gets that are randomly chosen percentageSets:2080//range out of 100 of sets that are randomly chosen percentageRemoves:8090//range out of 100 of removes that are randomly chosen percentageOns:90100//range out of 100 of ons that are randomly chosen initialDataRemoveCount:40//initial data generated for remove calls initialDataOnCount:20//initial data generated for on calls initialDataGetCount:50//initial data generated for get calls randomDataSize:3//the random data object has a bigData property, this setting creates a string of length (32 * 3) onTimeout:100//when the verify operation runs, this is the timeout reached when testing ons;
start, stop and verify:
when you start the random activity, the timespan it takes to generate the initial data is stored - this is so that when you stop the activity, the system waits for that timespan to actually stop - this allows for accuracy that is not affected by the initialization procedure
var happn = var service = happnservice;var happn_client = happnclient; service
replay
you can create 2 generators, have one do a run, then pass it to another generator (perhaps connected to a different db) - its logs is parsed and exactly the same activity is replicated
the following is an example from the test
generator;
daemon mode
this is for testing activity over a long period (days/weeks/months), running in this mode does not store a replay log, and only stores aggregated data related to the run
following example from the test
generator;//NB here is where you set the mode to "daemon"