Skip to content

Instantly share code, notes, and snippets.

@heoelri
Last active January 4, 2022 12:08
Show Gist options
  • Save heoelri/8412be325cf8213c344b016e951b49cc to your computer and use it in GitHub Desktop.
Save heoelri/8412be325cf8213c344b016e951b49cc to your computer and use it in GitHub Desktop.
Locust locals.tf file with definitions for headless and standalone
# see https://docs.locust.io/en/stable/configuration.html for details on individual Locust configuration options
environment_variables_common = {
"LOCUST_LOCUSTFILE" = "/home/locust/locust/${azurerm_storage_share_file.locustfile.name}"
}
# values which are needed when the Locust master schedules a load test
environment_variables_master = {
"LOCUST_HOST" = var.targeturl,
"LOCUST_MODE_MASTER" = "true"
"LOCUST_LOGFILE" = "/home/locust/locust/logs/${local.prefix}.log"
"LOCUST_CSV_FULL_HISTORY" = "true"
"LOCUST_CSV" = "locust/stats/${local.prefix}"
}
# values which are needed when the Python script is evaluated
environment_variables_worker = {
"LOCUST_MODE_WORKER" = "true"
"TENANT_NAME" = var.tenant_name,
"ROPC_POLICY_NAME" = var.ropc_policy_name,
"CLIENT_ID" = var.client_id,
"LOCUST_USERSFILE" = "/home/locust/locust/${azurerm_storage_share_file.usersfile.name}"
}
# specifics for headless mode (doesn't apply to worker - that's always headless)
environment_variables_headless = {
"LOCUST_RUN_TIME" = var.locust_runtime, # defaults to 0 when not in headless mode
"LOCUST_EXPECT_WORKERS" = var.locust_workers, # defaults to 0 when not in headless mode
"LOCUST_HEADLESS" = "true", # locust runs either in headless mode or webui
"LOCUST_SPAWN_RATE" = var.locust_spawn_rate,
"LOCUST_USERS" = var.locust_number_of_users
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment