-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add invalid and incorrect URI tests to E2E script #363
Conversation
Signed-off-by: Omar Khasawneh <[email protected]>
Signed-off-by: Omar Khasawneh <[email protected]>
Signed-off-by: Omar Khasawneh <[email protected]>
Signed-off-by: Omar Khasawneh <[email protected]>
Signed-off-by: Omar Khasawneh <[email protected]>
Codecov Report
@@ Coverage Diff @@
## main #363 +/- ##
=========================================
Coverage 64.78% 64.78%
Complexity 694 694
=========================================
Files 81 81
Lines 3107 3107
Branches 272 272
=========================================
Hits 2013 2013
Misses 918 918
Partials 176 176
Flags with carried forward coverage won't be shown. Click here to find out more. |
self.assertEqual(response.status_code, HTTPStatus.NOT_FOUND) | ||
|
||
# This test will send an incorrect URI | ||
incorrectUri = "/_cluster/incorrectUri" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was surprised by this request returning a 405 so I checked on the OpenSearch cluster and the return is different. Nothing to action now. Just something to keep in mind:
TrafficCapture git:(all-cdk-poc) ✗ curl https://localhost:19200/_cluster/incorrectUri --insecure -u admin:admin -v
* Trying 127.0.0.1:19200...
* Connected to localhost (127.0.0.1) port 19200 (#0)
* ALPN: offers h2,http/1.1
* (304) (OUT), TLS handshake, Client hello (1):
* (304) (IN), TLS handshake, Server hello (2):
* (304) (IN), TLS handshake, Unknown (8):
* (304) (IN), TLS handshake, Request CERT (13):
* (304) (IN), TLS handshake, Certificate (11):
* (304) (IN), TLS handshake, CERT verify (15):
* (304) (IN), TLS handshake, Finished (20):
* (304) (OUT), TLS handshake, Certificate (11):
* (304) (OUT), TLS handshake, Finished (20):
* SSL connection using TLSv1.3 / AEAD-AES256-GCM-SHA384
* ALPN: server did not agree on a protocol. Uses default.
* Server certificate:
* subject: DC=de; L=test; O=node; OU=node; CN=node-0.example.com
* start date: Apr 22 03:43:47 2018 GMT
* expire date: Apr 19 03:43:47 2028 GMT
* issuer: DC=com; DC=example; O=Example Com Inc.; OU=Example Com Inc. Root CA; CN=Example Com Inc. Root CA
* SSL certificate verify result: unable to get local issuer certificate (20), continuing anyway.
* using HTTP/1.x
* Server auth using Basic with user 'admin'
> GET /_cluster/incorrectUri HTTP/1.1
> Host: localhost:19200
> Authorization: Basic YWRtaW46YWRtaW4=
> User-Agent: curl/8.1.2
> Accept: */*
>
< HTTP/1.1 405 Method Not Allowed
< Allow: POST
< content-type: application/json; charset=UTF-8
< content-length: 113
<
* Connection #0 to host localhost left intact
{"error":"Incorrect HTTP method for uri [/_cluster/incorrectUri] and method [GET], allowed: [POST]","status":405}%
➜ TrafficCapture git:(all-cdk-poc) ✗ curl https://localhost:29200/_cluster/incorrectUri --insecure -u admin:admin -v
* Trying 127.0.0.1:29200...
* Connected to localhost (127.0.0.1) port 29200 (#0)
* ALPN: offers h2,http/1.1
* (304) (OUT), TLS handshake, Client hello (1):
* (304) (IN), TLS handshake, Server hello (2):
* (304) (IN), TLS handshake, Unknown (8):
* (304) (IN), TLS handshake, Request CERT (13):
* (304) (IN), TLS handshake, Certificate (11):
* (304) (IN), TLS handshake, CERT verify (15):
* (304) (IN), TLS handshake, Finished (20):
* (304) (OUT), TLS handshake, Certificate (11):
* (304) (OUT), TLS handshake, Finished (20):
* SSL connection using TLSv1.3 / AEAD-AES256-GCM-SHA384
* ALPN: server did not agree on a protocol. Uses default.
* Server certificate:
* subject: DC=de; L=test; O=node; OU=node; CN=node-0.example.com
* start date: Apr 22 03:43:47 2018 GMT
* expire date: Apr 19 03:43:47 2028 GMT
* issuer: DC=com; DC=example; O=Example Com Inc.; OU=Example Com Inc. Root CA; CN=Example Com Inc. Root CA
* SSL certificate verify result: unable to get local issuer certificate (20), continuing anyway.
* using HTTP/1.x
* Server auth using Basic with user 'admin'
> GET /_cluster/incorrectUri HTTP/1.1
> Host: localhost:29200
> Authorization: Basic YWRtaW46YWRtaW4=
> User-Agent: curl/8.1.2
> Accept: */*
>
< HTTP/1.1 400 Bad Request
< content-type: application/json; charset=UTF-8
< content-length: 78
<
* Connection #0 to host localhost left intact
{"error":"no handler found for uri [/_cluster/incorrectUri] and method [GET]"}%
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for pointing that out Brian!
Description
This PR adds a test to the E2E script that uses invalid and incorrect URIs. This PR is built on #362.
Issues Resolved
MIGRATIONS-1153
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.