summaryrefslogtreecommitdiff
path: root/environment.go
diff options
context:
space:
mode:
Diffstat (limited to 'environment.go')
-rw-r--r--environment.go46
1 files changed, 24 insertions, 22 deletions
diff --git a/environment.go b/environment.go
index 1c23109..6b7815c 100644
--- a/environment.go
+++ b/environment.go
@@ -16,24 +16,32 @@ import (
// Environment contains global configuration for load testing.
//
type Environment struct {
+ // AttackRunning will be set to non-nil if there is a load
+ // testing currently running.
+ AttackRunning *RunRequest
+
// ListenAddress is the address and port where Trunks HTTP web
// will run.
// If its emtpy, it will set to DefaultListenAddress.
ListenAddress string `ini:"trunks::listen_address"`
+ websocketListenAddress string
+
+ // ResultsDir is the path where the output of load testing will be
+ // stored.
+ // This field is optional, if its empty it will be set to the working
+ // directory where the program is running.
+ ResultsDir string `ini:"trunks:results:dir"`
+
+ // ResultsSuffix define custom string to add to the file name to
+ // uniquely identify results on each run.
+ ResultsSuffix string `ini:"trunks:result:suffix"`
+
// WebSocketListenPort is the port number where Trunks WebSocket API
// will run.
// If its empty, it will set to DefaultWebSocketListenPort.
WebSocketListenPort int
- // MaxAttackDuration define the maximum duration for an attack to be
- // run on each target.
- // The purpose of this option is to prevent client to attack service
- // and bringing it down.
- // This field is optional, default to DefaultMaxAttackDuration if its
- // zero.
- MaxAttackDuration time.Duration `ini:"trunks::max_attack_duration"`
-
// MaxAttackRate define the maximum AttackRate can be set by client.
// The purpose of this option is to prevent client to set attack rate
// which may bring down the service to be tested.
@@ -41,21 +49,15 @@ type Environment struct {
// zero.
MaxAttackRate int `ini:"trunks::max_attack_rate"`
- // ResultsDir is the path where the output of load testing will be
- // stored.
- // This field is optional, if its empty it will be set to the working
- // directory where the program is running.
- ResultsDir string `ini:"trunks:results:dir"`
-
- // ResultsSuffix define custom string to add to the file name to
- // uniquely identify results on each run.
- ResultsSuffix string `ini:"trunks:result:suffix"`
+ // MaxAttackDuration define the maximum duration for an attack to be
+ // run on each target.
+ // The purpose of this option is to prevent client to attack service
+ // and bringing it down.
+ // This field is optional, default to DefaultMaxAttackDuration if its
+ // zero.
+ MaxAttackDuration time.Duration `ini:"trunks::max_attack_duration"`
- // AttackRunning will be set to non-nil if there is a load
- // testing currently running.
- AttackRunning *RunRequest
- mtx sync.Mutex
- websocketListenAddress string
+ mtx sync.Mutex
}
func (env *Environment) init() (err error) {