Tasks¶
The tasks
classes contain micro-actions that are executed at some phase
of the test and do not participate in the final result.
These tasks are executed on a specified trigger, through the at: configuration parameter. For example:
tasks:
- at: setup
class: ...
...
Known Triggers¶
The following table summarises the task triggers available in the driver.
Task Name | Source | Description |
---|---|---|
setup |
Session | Called when the sytem is ready and right before the first policy is started. Use this trigger to initialize your app state. |
pretest |
Session | Called before every run is started. Use this trigger to wipe the state before the tests are started. |
posttest |
Session | Called right after every run. Use this trigger to clean-up your system between the runs. |
teardown |
Session | Called when the system has finished all tests and is about to start reporting. Use this trigger to clean-up your system. |
intertest |
Policy | Called inbetween the tests, when a parameter changes. This implementation depends on the policy you are using. Usually you should use this trigger to bring your system into a known state right before every value is applied. |
auth.AuthEE¶
-
class
performance.driver.classes.tasks.auth.
AuthEE
(config, eventbus)[source]¶ Authenticate against an Enterprise-Edition cluster
tasks: - class: tasks.auth.AuthEE at: ... # The username to authenticate against user: bootstrapuser # The password to use password: deleteme # [Optional] The base cluster URL # Instead of specifying this configuration parameter you can specify # the `cluster_url` definition (not recommended) cluster_url: "https://cluster.dcos.io"
This task authenticates against the enterprise cluster and obtains an authentication token.
This task sets the
dcos_auth_token
definition and makes it available for other components to use.
auth.AuthOpen¶
-
class
performance.driver.classes.tasks.auth.
AuthOpen
(config, eventbus)[source]¶ Authenticate against an Open-Source Edition cluster
tasks: - class: tasks.auth.AuthOpen at: ... # The user token to (re-)use token: bootstrapuser # [Optional] The base cluster URL # Instead of specifying this configuration parameter you can specify # the `cluster_url` definition (not recommended) cluster_url: "https://cluster.dcos.io"
This task authenticates against the enterprise cluster and obtains an authentication token.
This task sets the
dcos_auth_token
definition and makes it available for other components to use.
http.Request¶
-
class
performance.driver.classes.tasks.http.
Request
(config, eventbus)[source]¶ Perform an arbitrary HTTP request as a single-shot task
tasks: - class: tasks.http.Request at: ... # The URL to send the requests at url: http://127.0.0.1:8080/v2/apps # [Optional] The body of the HTTP request body: | { "cmd": "sleep 1200", "cpus": 0.1, "mem": 64, "disk": 0, "instances": {{instances}}, "id": "/scale-instances/{{uuid()}}", "backoffFactor": 1.0, "backoffSeconds": 0 } # [Optional] The HTTP Verb to use (Defaults to 'GET') verb: POST # [Optional] How many times to repeat the same HTTP request # Note that in this case you can use the {{_i}} macro repeat: 10 # [Optional] The HTTP headers to send headers: Accept: text/plain
Note
This channel will automatically inject an
Authorization
header if adcos_auth_token
definition exists, so you don’t have to specify it through theheaders
configuration.Note that a
dcos_auth_token
can be dynamically injected via an authentication task.
marathon.RemoveAllApps¶
-
class
performance.driver.classes.tasks.marathon.
RemoveAllApps
(*args, **kwargs)[source]¶ Remove matching apps from marathon
tasks: - class: tasks.marathon.RemoveAllApps at: ... # The base url to marathon url: "{{marathon_url}}" # [Optional] Additional headers to include to the marathon request headers: x-Originating-From: Python
This task is enumerating all apps in the root group and delets each one of them.
Note
This task will block the execution of other tasks until all deployments are completed. This is intentional in order allow other tasks to be executed in series.
marathon.RemoveMatchingApps¶
-
class
performance.driver.classes.tasks.marathon.
RemoveMatchingApps
(*args, **kwargs)[source]¶ Removes matching apps from marathon
tasks: - class: tasks.marathon.RemoveMatchingApps at: ... # The base url to marathon url: "{{marathon_url}}" # The string portion in the app name to match match: "test-01-" # [Optional] Additional headers to include to the marathon request headers: x-Originating-From: Python
This task is enumerating all apps in the root group, checking wich ones contain the string contained in the
match
parameter and removes them.Note
This task will block the execution of other tasks until all deployments are completed. This is intentional in order allow other tasks to be executed in series.
marathon.RemoveGroup¶
-
class
performance.driver.classes.tasks.marathon.
RemoveGroup
(*args, **kwargs)[source]¶ Removes a specific group from marathon
tasks: - class: tasks.marathon.RemoveGroup at: ... # The base url to marathon url: "{{marathon_url}}" # The group to remove group: "tests/01" # [Optional] Additional headers to include to the marathon request headers: x-Originating-From: Python
This task removes the given group from marathon.
Note
This task will block the execution of other tasks until all deployments are completed. This is intentional in order allow other tasks to be executed in series.