|
| 1 | +@Authorized |
| 2 | +Feature: rlsapi v1 /infer endpoint API tests |
| 3 | + |
| 4 | + Background: |
| 5 | + Given The service is started locally |
| 6 | + And REST API service prefix is /v1 |
| 7 | + |
| 8 | + Scenario: Basic inference with minimal request (question only) |
| 9 | + Given The system is in default state |
| 10 | + And I set the Authorization header to Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6Ikpva |
| 11 | + When I use "infer" to ask question with authorization header |
| 12 | + """ |
| 13 | + {"question": "How do I list files in Linux?"} |
| 14 | + """ |
| 15 | + Then The status code of the response is 200 |
| 16 | + And The rlsapi response should have valid structure |
| 17 | + |
| 18 | + Scenario: Inference with full context (systeminfo populated) |
| 19 | + Given The system is in default state |
| 20 | + And I set the Authorization header to Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6Ikpva |
| 21 | + When I use "infer" to ask question with authorization header |
| 22 | + """ |
| 23 | + {"question": "How do I configure SELinux?", "context": {"systeminfo": {"os": "RHEL", "version": "9.3", "arch": "x86_64"}}} |
| 24 | + """ |
| 25 | + Then The status code of the response is 200 |
| 26 | + And The rlsapi response should have valid structure |
| 27 | + |
| 28 | + Scenario: Request without authorization returns 401 |
| 29 | + Given The system is in default state |
| 30 | + When I use "infer" to ask question |
| 31 | + """ |
| 32 | + {"question": "How do I list files?"} |
| 33 | + """ |
| 34 | + Then The status code of the response is 401 |
| 35 | + And The body of the response is the following |
| 36 | + """ |
| 37 | + { |
| 38 | + "detail": { |
| 39 | + "response": "Missing or invalid credentials provided by client", |
| 40 | + "cause": "No Authorization header found" |
| 41 | + } |
| 42 | + } |
| 43 | + """ |
| 44 | + |
| 45 | + Scenario: Request with empty bearer token returns 401 |
| 46 | + Given The system is in default state |
| 47 | + And I set the Authorization header to Bearer |
| 48 | + When I use "infer" to ask question with authorization header |
| 49 | + """ |
| 50 | + {"question": "How do I list files?"} |
| 51 | + """ |
| 52 | + Then The status code of the response is 401 |
| 53 | + And The body of the response contains No token found in Authorization header |
| 54 | + |
| 55 | + Scenario: Empty/whitespace question returns 422 |
| 56 | + Given The system is in default state |
| 57 | + And I set the Authorization header to Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6Ikpva |
| 58 | + When I use "infer" to ask question with authorization header |
| 59 | + """ |
| 60 | + {"question": " "} |
| 61 | + """ |
| 62 | + Then The status code of the response is 422 |
| 63 | + And The body of the response contains Question cannot be empty |
| 64 | + |
| 65 | + Scenario: Response contains valid structure (data.text, data.request_id) |
| 66 | + Given The system is in default state |
| 67 | + And I set the Authorization header to Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6Ikpva |
| 68 | + When I use "infer" to ask question with authorization header |
| 69 | + """ |
| 70 | + {"question": "What is RHEL?"} |
| 71 | + """ |
| 72 | + Then The status code of the response is 200 |
| 73 | + And The rlsapi response should have valid structure |
| 74 | + |
| 75 | + Scenario: Multiple requests generate unique request_ids |
| 76 | + Given The system is in default state |
| 77 | + And I set the Authorization header to Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6Ikpva |
| 78 | + When I use "infer" to ask question with authorization header |
| 79 | + """ |
| 80 | + {"question": "First question"} |
| 81 | + """ |
| 82 | + Then The status code of the response is 200 |
| 83 | + And I store the rlsapi request_id |
| 84 | + When I use "infer" to ask question with authorization header |
| 85 | + """ |
| 86 | + {"question": "Second question"} |
| 87 | + """ |
| 88 | + Then The status code of the response is 200 |
| 89 | + And The rlsapi request_id should be different from the stored one |
0 commit comments