Skip to content
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

PR to Fix the missing Gradle Reports in opensearch-integ-test/ folder #5092

Merged
merged 1 commit into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions src/test_workflow/integ_test/integ_test_suite_opensearch.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,18 @@ def custom_node_endpoint_encoder(node_endpoint: NodeEndpoint) -> dict:
logging.info(f"{script} does not exist. Skipping integ tests for {self.component.name}")
return 0

@property
def additional_test_report_dirs(self) -> list[str]:
return ["integrationTest", "integTestRemote"]

@property
def test_artifact_files(self) -> dict:
return {
"opensearch-integ-test": os.path.join(self.repo_work_dir, "build", "reports", "tests", "integTest")
}
default_report_path = os.path.join(self.repo_work_dir, "build", "reports", "tests", "integTest")
peterzhuamazon marked this conversation as resolved.
Show resolved Hide resolved
if os.path.exists(default_report_path):
return {"opensearch-integ-test": default_report_path}
for root, dirs, files in os.walk(self.repo_work_dir):
for test_report_dir in self.additional_test_report_dirs:
potential_path = os.path.join(root, "build", "reports", "tests", test_report_dir)
if os.path.exists(potential_path):
return {"opensearch-integ-test": potential_path}
return {"opensearch-integ-test": default_report_path}
Original file line number Diff line number Diff line change
Expand Up @@ -244,3 +244,56 @@ def test_multi_execute_integtest_sh(self, mock_execute: Mock, mock_git: Mock, mo

assert(mock_test_result_data.return_value in integ_test_suite.result_data)
self.assertEqual(integ_test_suite.additional_cluster_config, None)

@patch("os.path.exists", return_value=True)
@patch("os.walk", return_value=[(os.path.join("/some", "path"), ["build"], ["integTest", "integrationTest", "integTestRemote"])])
def test_test_artifact_files_default(self, *mocks: Any) -> None:
dependency_installer = MagicMock()
test_config, component = self.__get_test_config_and_bundle_component("job-scheduler")
integ_test_suite = IntegTestSuiteOpenSearch(
dependency_installer,
component,
test_config,
self.bundle_manifest,
self.build_manifest,
self.work_dir,
MagicMock()
)
integ_test_suite.repo_work_dir = os.path.join("/some", "path")
expected_path = {
"opensearch-integ-test": os.path.join("/some", "path", "build", "reports", "tests", "integTest")
}
result = integ_test_suite.test_artifact_files
self.assertEqual(result, expected_path)

@patch("os.path.exists", return_value=False)
@patch("os.walk", return_value=[])
def test_test_artifact_files_no_default_path(self, *mocks: Any) -> None:
dependency_installer = MagicMock()
test_config, component = self.__get_test_config_and_bundle_component("job-scheduler")
integ_test_suite = IntegTestSuiteOpenSearch(
dependency_installer,
component,
test_config,
self.bundle_manifest,
self.build_manifest,
self.work_dir,
MagicMock()
)
integ_test_suite.repo_work_dir = os.path.join("/some", "path")
default_path = os.path.join(integ_test_suite.repo_work_dir, "build", "reports", "tests", "integTest")
expected_path = {"opensearch-integ-test": default_path}
result = integ_test_suite.test_artifact_files
self.assertEqual(result, expected_path)

def test_test_report_dirs(self, *mocks: Any) -> None:
integ_test_suite = IntegTestSuiteOpenSearch(
MagicMock(),
MagicMock(),
MagicMock(),
self.bundle_manifest,
self.build_manifest,
self.work_dir,
MagicMock()
)
self.assertEqual(integ_test_suite.additional_test_report_dirs, ["integrationTest", "integTestRemote"])
Loading