Skip to content

YAML configuration

In order to generate a valid LocustTest custom resource, a valid yaml configuration should be prepared.

The following sections will break-down the supported configuration and provide the full YAML spec at the end.

Note

Although all following examples are for a single test, _Intensive Brew_ supports having several _test_ configurations in the same `.yaml` file.

Locust configuration

This sections highlight all the available options that would impact the configuration of Locust.

Test entry point

entry_point: str is a mandatory field that allows Intensive Brew to know which .py file to use as an entry to locust.

test-config.yaml
configurations:
  ...
  test_name:
    entry_point: "<path>/demo.py" 

Test load requirements

vanilla_specs: object is a mandatory section that can be used to configure:

  • Number of users
  • Users spawn rate
  • Test duration
  • Target host of the test
  • Timeout to end all current tasks if run_time was reached [Optional field]
test-config.yaml
configurations:
  ...
  test_name:
    ...
    vanilla_specs:
      # * Number of users
      users: int
      # * Users spawn rate
      spawn_rate: int
      # * Test duration
      run_time: str 
      # * Test target URL 
      target_host: str
      # * Timeout to end current task (sec)
      termination_timeout: int

Custom load shapes

custom_load_shapes: bool is an optional flag that enables the support of Locust "Custom Load Shapes" feature. This feature doesn't follow the traditional way of declaring users, spawn rate and test run duration.

Important

  • When this flag is set to true, the vanilla_specs section becomes optional and is ignored even if provided.
  • Additional configuration like test target host is expected to be passed through custom config files or directly coded into the test.
test-config.yaml
configurations:
  ...
  test_name:
    ...
    # * Enable "custom load shapes" support. Default: false
    custom_load_shapes: true

Cluster nodes configuration

This sections highlight all the available options that would impact the configuration of the deployed cluster nodes.

Locust container image

image: str is an optional flag that instructs Intensive Brew to populate the image field in LocustTest. Default is to use the latest Locust image.

test-config.yaml
configurations:
  ...
  test_name:
    ...
    image: str

Kubernetes test configuration map

configmap: str is an optional flag that instructs Intensive Brew to populate the configMap field in LocustTest. This is a feature supported by the Locust Operator where it is possible to [deploy tests as k8s configMap] and then having it mounted on the load generation pods.

test-config.yaml
configurations:
  ...
  test_name:
    ...
    configmap: <valid k8s configMap name>

Worker replicas count

worker_replicas: int is an optional flag that instructs Intensive Brew to populate the workerReplicas field in LocustTest. Default value is 5.

test-config.yaml
configurations:
  ...
  test_name:
    ...
    worker_replicas: int

Kubernetes Affinity

It is an optional section that instructs Intensive Brew to populate the affinity field in LocustTest. The spec is structured in a similar way as the Operator.

test-config.yaml
configurations:
  ...
  test_name:
    ...
    affinity:
      nodeAffinity:
        requiredDuringSchedulingIgnoredDuringExecution: 
          <label-key>: <label-value> 

Kubernetes pod taint tolerations

It is an optional flag that instructs Intensive Brew to populate the tolerations field in LocustTest. The spec is structured in a similar way as the Operator.

test-config.yaml
configurations:
  ...
  tolerations: 
      - key: <string value>
        operator: <"Exists", "Equal">
        value: <string value>
        effect: <"NoSchedule", "PreferNoSchedule", "NoExecute">
      ...

Expert mode

expert_mode: obj is an optional section that grants direct control over what the LocustTest fields for masterCommandSeed & workerCommandSeed will contain.

Important

  • When this section is set, all other sections from the "Locust configuration" section becomes optional and is ignored even if provided.

Warning

  • Activating this mode will suppress any processing of the data and directly pass the command "as-is".
  • If you find yourself using this mode frequently, consider opening a feature request to support your use case instead.
test-config.yaml
configurations:
  ...
  test_name:
    # ! USE WITH CAUTION
    expert_mode:
      # * Enable expert mode. Default: false
      enabled: bool
      # * Commands to pass "as-is"
      masterCommandSeed: str
      workerCommandSeed: str

Full YAML spec

test-config.yaml
configurations:
  # Test name
  load_test:

    #  Entry point script
    entry_point: str 

    # Load requirements
    vanilla_specs: 
      # Number of users
      users: int 
      # Users spawn rate
      spawn_rate: int 
      # Test duration
      run_time: str 
      # Test target URL 
      target_host: str 
      # Timeout to end current task (sec) 
      termination_timeout: int 

    # Custom load shapes support.
    custom_load_shapes: bool

    # Locust container image
    image: str 

    # Test configuration map
    configmap: str 

    # Worker replicas
    worker_replicas: int 

    # Kubernetes affinity
    affinity: 
      nodeAffinity:
        requiredDuringSchedulingIgnoredDuringExecution: 
          <label-key>: <label-value>

    # Kubernetes pod taint toleration      
    tolerations: 
      - key: <string value>
        operator: <"Exists", "Equal">
        value: <string value>
        effect: <"NoSchedule", "PreferNoSchedule", "NoExecute">

    # ! USE WITH  CAUTION
    expert_mode:
      # Enable expert mode. Default: false
      enabled: bool
      # Commands to pass "as-is"
      masterCommandSeed: str
      workerCommandSeed: str

Last update: November 21, 2023