Skip to content

Commit

Permalink
Use basename with extension as OSD test case class name (opensearch-p…
Browse files Browse the repository at this point in the history
…roject#5116)

Signed-off-by: Peter Zhu <zhujiaxi@amazon.com>
  • Loading branch information
peterzhuamazon authored Oct 17, 2024
1 parent d43ad38 commit 7b7966b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/report_workflow/test_report_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ def get_failed_tests(product_name: str, test_result: str, test_result_files: lis
class_name = "DefaultClassName"
for testsuite in soup.find_all("testsuite"):
if testsuite["name"] == "Root Suite":
class_name = testsuite["file"].replace("cypress/", "").replace(".js", "")
class_name = os.path.basename(testsuite["file"])
testsuite_failures = int(testsuite["failures"])
if testsuite_failures > 0:
for testcase in testsuite.find_all("testcase"):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,12 +132,12 @@ def test_runner_component_entry_url_failed_test(self, report_args_mock: MagicMoc
test_report_component_dict = TestReportRunner(report_args_mock, self.TEST_MANIFEST_OPENSEARCH_DASHBOARDS).component_entry("alertingDashboards")
self.assertEqual(test_report_component_dict.get("configs")[0]["status"], "FAIL")
self.assertEqual(test_report_component_dict.get("configs")[0]["name"], "with-security")
self.assertEqual(test_report_component_dict.get("configs")[0]["failed_test"][0], "integration/plugins/alerting-dashboards-plugin/acknowledge_alerts_modal_spec#AcknowledgeAlertsModal "
self.assertEqual(test_report_component_dict.get("configs")[0]["failed_test"][0], "acknowledge_alerts_modal_spec.js#AcknowledgeAlertsModal "
"\"before all\" hook for \"Acknowledge button disabled when more than 1 trigger selected\"")

self.assertEqual(test_report_component_dict.get("configs")[1]["status"], "FAIL")
self.assertEqual(test_report_component_dict.get("configs")[1]["name"], "without-security")
self.assertEqual(test_report_component_dict.get("configs")[1]["failed_test"][1], "integration/plugins/alerting-dashboards-plugin/alert_spec#Alerts can be in 'Active' state "
self.assertEqual(test_report_component_dict.get("configs")[1]["failed_test"][1], "alert_spec.js#Alerts can be in 'Active' state "
"\"before each\" hook for \"after the monitor starts running\"")

@patch("report_workflow.report_args.ReportArgs")
Expand Down Expand Up @@ -181,10 +181,10 @@ def test_runner_component_entry_local_failed_test(self, report_args_mock: MagicM
test_report_component_dict = TestReportRunner(report_args_mock, self.TEST_MANIFEST_OPENSEARCH_DASHBOARDS).component_entry("indexManagementDashboards")
self.assertEqual(test_report_component_dict.get("configs")[0]["status"], "FAIL")
self.assertEqual(test_report_component_dict.get("configs")[0]["name"], "with-security")
self.assertEqual(test_report_component_dict.get("configs")[0]["failed_test"][0], "integration/plugins/index-management-dashboards-plugin/aliases#Aliases can be "
self.assertEqual(test_report_component_dict.get("configs")[0]["failed_test"][0], "aliases.js#Aliases can be "
"searched / sorted / paginated \"before each\" hook for \"successfully\"")

self.assertEqual(test_report_component_dict.get("configs")[1]["status"], "FAIL")
self.assertEqual(test_report_component_dict.get("configs")[1]["name"], "without-security")
self.assertEqual(test_report_component_dict.get("configs")[1]["failed_test"][1], "integration/plugins/index-management-dashboards-plugin/create_index#Create Index "
self.assertEqual(test_report_component_dict.get("configs")[1]["failed_test"][1], "create_index.js#Create Index "
"can be created and updated \"before each\" hook for \"Create a index successfully\"")

0 comments on commit 7b7966b

Please sign in to comment.