Documentation
¶
Overview ¶
Package inputs gives scenario scripts the data and settings they read from outside the script (FR-CLI-17): data files whose rows feed virtual users, and environment variables the run exposes by name.
A script can only read an environment variable the run named with -env or -secret-env. Nothing else in the process environment is reachable through the `env` global, so a scenario written by someone else (or by an agent) cannot sweep up unrelated secrets. A value named with -secret-env is registered with internal/secrets, which keeps it out of the report, the JSON output, the audit record and logs.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseData ¶
ParseData loads each -data value. A value is a path, or name=path. A bare path is named after the file, without its extension, so users.csv is `data.users`. Names must be usable as an identifier in a script.
func ResolveEnv ¶
ResolveEnv reads the named environment variables. Names in secret are also registered as secrets. A name may be listed in both; it is then a secret. Each name may be a comma-separated list. A variable that is not set is an error, so a typo shows before any load is sent.
Types ¶
type Inputs ¶
type Inputs struct {
// contains filtered or unexported fields
}
Inputs implements netapi.Inputs.
func New ¶
New returns Inputs for the given variables and data files, or nil when there are none, which is how the scripting runtimes know to expose nothing.
func (*Inputs) DatasetNames ¶
DatasetNames lists the data file names, sorted.
type Set ¶
type Set struct {
// contains filtered or unexported fields
}
Set is one data file's rows.
func LoadSet ¶
LoadSet reads a CSV file (a header row, then one row per line) or a JSON file (an array of objects). The extension picks the format.