probe k6

http

Probe an endpoint to make sure it responds to an http request with the expected HTTP status code

Run it now
View details
Typeprobe
Modulechaosk6.probes
Namehttp
Returnboolean

Usage

JSON

{
  "name": "http",
  "type": "probe",
  "provider": {
    "type": "python",
    "module": "chaosk6.probes",
    "func": "http",
    "arguments": {
      "endpoint": ""
    }
  }
}

YAML

name: http
provider:
  arguments:
    endpoint: ""
  func: http
  module: chaosk6.probes
  type: python
type: probe

Arguments

NameTypeDefaultRequiredTitleDescription
endpointstringYesEndpointTarget endpoint
methodstring”GET”NoMethodHTTP method to apply
statusinteger200NoStatusExpected HTTP status code
bodystring""NoBodyHTTP request body to send
headersmappingnullNoHeadersHTTP request headers
vusinteger1NoVUsNumber of virtual users
durationstring""NoDurationHow long to run the test for
debugbooleanfalseNoDebugRun the test with the debug flag set
timeoutinteger1NoTimeoutHTTP requests timeout

Depending on the endpoint and your payload, this action might be destructive. Use with caution.

  • endpoint (str): The URL to the endpoint to probe
  • method (str): A valid http request method name, like GET, POST, PUT, DELETE,OPTIONS, or PATCH
  • status (int): The expected HTTP Response status code.
  • vus (int): The amount of concurrent virtual users accessing the endpoint
  • duration (str): How long to probe the endpoint. Expressed as a duration string, i.e ”20s”, “1m”, “1h” etc.
  • timeout (int): Timeout duration for http requests. Defaults to 1 second

Signature

def http(endpoint: str,
         method: str = 'GET',
         status: int = 200,
         body: str = '',
         headers: dict = {},
         vus: int = 1,
         duration: str = '',
         debug: bool = False,
         timeout: int = 1) -> bool:
    pass