evoila / osb-checker-kotlin

This application is a generalized test program for service brokers. It runs rest calls against the defined service broker and checks if it behaves as expected to the service broker API specification. Tests are created dynamically based upon the service broker catalog or custom input by the operator.
https://www.evoila.de
Apache License 2.0
5 stars 6 forks source link

Contract tests failing with 401 when 412 expected #30

Closed mattmcneeney closed 4 years ago

mattmcneeney commented 4 years ago

When running the -con test suite, all of the tests are failing on my dummy broker:

└─ JUnit Jupiter ✔
   └─ ContractJUnit5 ✔
      └─ testHeaderForAPIVersion() ✔
         └─ Requests should contain header X-Broker-API-Version ✔
            ├─ GET - v2/catalog should reject with 412 ✘ 1 expectation failed.
            │        Expected status code <412> but was <401>.
            ├─ PUT - v2/service_instance/instance_id should reject with 412 ✘ 1 expectation failed.
            │        Expected status code <412> but was <401>.
            ├─ DELETE - v2/service_instance/instance_id should reject with 412 ✘ 1 expectation failed.
            │        Expected status code <412> but was <401>.
            ├─ GET - v2/service_instance/instance_id/last_operation should reject with 412 ✘ 1 expectation failed.
            │        Expected status code <412> but was <401>.
            ├─ DELETE - v2/service_instance/instance_id?service_id=Invalid&plan_id=Invalid  should reject with 412) ✘ 1 expectation failed.
            │        Expected status code <412> but was <401>.
            ├─ PUT - v2/service_instance/instance_id/service_binding/binding_id  should reject with 412) ✘ 1 expectation failed.
            │        Expected status code <412> but was <401>.
            └─ DELETE - v2/service_instance/instance_id/service_binding/binding_id?service_id=Invalid&plan_id=Invalid should reject with 412 ✘ 1 expectation failed.
                     Expected status code <412> but was <401>.

The broker logic first checks for the correct basic auth credentials, before then checking for the correct X-Broker-API-Version header. I think that this ordering is making the test fail.

My hypothesis is that this test suite is not sending the correct basic auth information as specified in my application.yml file. Are you able to check if this is the case for me?

mattmcneeney commented 4 years ago

I found a potential fix for this - I'll open a PR and we can see if you're happy with the change.

joStrauss commented 4 years ago

I merged your PR.

Thank you!