powerfulseal / powerfulseal

A powerful testing tool for Kubernetes clusters.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

HTTP probe expected code is ignored

Niksko opened this issue · comments

The code field of probeHTTP isn't honoured. I can see from the implementation that this field is passed to the method that executes the probe, but it isn't actually used there, or in the calling function.

Steps to reproduce:

  1. Set up an endpoint that returns a 404
  2. Configure the following scenario:
    scenarios:
    - name: test
      steps:
      # make sure the service responds
      - probeHTTP:
          code: 404
          target:
            service:
              name: my-service
              namespace: my-namespace
              port: 80

Expected behaviour:
Probe succeeds

Actual behaviour:

owerfulseal-8498cf7884-g2js6 powerfulseal 2021-07-15 18:04:24 INFO action_probe_http.test Making a call: http://<url>, get, {}, 1000, 404, , , True
powerfulseal-8498cf7884-g2js6 powerfulseal 2021-07-15 18:04:24 ERROR action_probe_http.test Exception while calling <url>
powerfulseal-8498cf7884-g2js6 powerfulseal Traceback (most recent call last):
powerfulseal-8498cf7884-g2js6 powerfulseal   File "/usr/local/lib/python3.7/site-packages/powerfulseal/policy/action_probe_http.py", line 94, in make_call
powerfulseal-8498cf7884-g2js6 powerfulseal     resp.raise_for_status()
powerfulseal-8498cf7884-g2js6 powerfulseal   File "/usr/local/lib/python3.7/site-packages/requests/models.py", line 941, in raise_for_status
powerfulseal-8498cf7884-g2js6 powerfulseal     raise HTTPError(http_error_msg, response=self)
powerfulseal-8498cf7884-g2js6 powerfulseal requests.exceptions.HTTPError: 404 Client Error: Not Found for url: <url>
powerfulseal-8498cf7884-g2js6 powerfulseal 2021-07-15 18:04:24 ERROR action_probe_http.Itest No more retries allowed. Failing step
powerfulseal-8498cf7884-g2js6 powerfulseal 2021-07-15 18:04:24 WARNING scenario.test Step returned failure {'probeHTTP': {'code': 404, 'target': {'service': {'name': 'my-service', 'namespace': 'my-namespace', 'port': 80}}}}. Finishing scenario early

PR incoming 👍

Good catch!