Skip to content

Commit

Permalink
Put response json in error message (opensearch-project#920)
Browse files Browse the repository at this point in the history
Signed-off-by: Heng Qian <[email protected]>
  • Loading branch information
qianheng-aws authored Nov 15, 2024
1 parent 06f1420 commit c37b3bd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion integ-test/script/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Apart from the basic feature, it also has some advanced functionality includes:
### Usage
To use this script, you need to have Python **3.6** or higher installed. It also requires the following Python libraries:
```shell
pip install requests pandas
pip install requests pandas openpyxl
```

After getting the requisite libraries, you can run the script with the following command line parameters in your shell:
Expand Down
5 changes: 3 additions & 2 deletions integ-test/script/SanityTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def submit_query(self, query, session_id="Empty"):
response.raise_for_status()
return response_json
except Exception as e:
return {"error": str(e), "response": response_json}
return {"error": f"{str(e)}, got response {response_json}"}

# Call get API to check the query status
def get_query_result(self, query_id):
Expand All @@ -113,7 +113,7 @@ def get_query_result(self, query_id):
response.raise_for_status()
return response_json
except Exception as e:
return {"status": "FAILED", "error": str(e), "response": response_json}
return {"status": "FAILED", "error": f"{str(e)}, got response {response_json}"}

# Call delete API to cancel the query
def cancel_query(self, query_id):
Expand Down Expand Up @@ -204,6 +204,7 @@ def run_tests_from_csv(self, csv_file):
futures = [self.executor.submit(self.run_test, query, seq_id, expected_status) for query, seq_id, expected_status in queries]
for future in as_completed(futures):
result = future.result()
self.logger.info(f"Completed test: {result["query_name"]}, {result["query"]}, got result status: {result["status"]}")
self.test_results.append(result)

def generate_report(self):
Expand Down

0 comments on commit c37b3bd

Please sign in to comment.