-
Notifications
You must be signed in to change notification settings - Fork 277
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding backwards compatability workflow for OpenSearch and OpenSearch Dashboards. Issue: #705 Signed-off-by: Kawika Avilla <[email protected]>
- Loading branch information
Showing
24 changed files
with
3,910 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
--- | ||
name: OpenSearch Dashboards | ||
components: | ||
- name: OpenSearch-Dashboards | ||
bwc-test: | ||
test-configs: | ||
- without-security | ||
- name: functionalTestDashboards | ||
integ-test: | ||
test-configs: | ||
- with-security | ||
- without-security | ||
schema-version: '1.0' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# | ||
# The OpenSearch Contributors require contributions made to | ||
# this file be licensed under the Apache-2.0 license or a | ||
# compatible open source license. | ||
|
||
import abc | ||
import logging | ||
import os | ||
|
||
from system.temporary_directory import TemporaryDirectory | ||
from test_workflow.test_recorder.test_recorder import TestRecorder | ||
from test_workflow.test_result.test_suite_results import TestSuiteResults | ||
|
||
|
||
class BwcTestRunner(abc.ABC): | ||
def __init__(self, args, test_manifest): | ||
self.args = args | ||
self.test_manifest = test_manifest | ||
|
||
self.tests_dir = os.path.join(os.getcwd(), "test-results") | ||
os.makedirs(self.tests_dir, exist_ok=True) | ||
self.test_recorder = TestRecorder(self.args.test_run_id, "bwc-test", self.tests_dir) | ||
|
||
def run(self): | ||
with TemporaryDirectory(keep=self.args.keep, chdir=True) as work_dir: | ||
all_results = TestSuiteResults() | ||
for component in self.components.select(focus=self.args.component): | ||
if component.name in self.test_manifest.components: | ||
test_config = self.test_manifest.components[component.name] | ||
if test_config.bwc_test: | ||
test_suite = self.__create_test_suite__(component, test_config, work_dir) | ||
test_results = test_suite.execute_tests() | ||
all_results.append(component.name, test_results) | ||
else: | ||
logging.info(f"Skipping bwc-tests for {component.name}, as it is currently not supported") | ||
else: | ||
logging.info(f"Skipping bwc-tests for {component.name}, as it is currently not declared in the test manifest") | ||
|
||
return all_results |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# | ||
# The OpenSearch Contributors require contributions made to | ||
# this file be licensed under the Apache-2.0 license or a | ||
# compatible open source license. | ||
|
||
import logging | ||
import os | ||
|
||
from manifests.test_manifest import TestManifest | ||
from test_workflow.bwc_test.bwc_test_runner import BwcTestRunner | ||
from test_workflow.bwc_test.bwc_test_start_properties_opensearch import BwcTestStartPropertiesOpenSearch | ||
from test_workflow.bwc_test.bwc_test_suite_opensearch import BwcTestSuiteOpenSearch | ||
from test_workflow.test_args import TestArgs | ||
|
||
|
||
class BwcTestRunnerOpenSearch(BwcTestRunner): | ||
|
||
def __init__(self, args: TestArgs, test_manifest: TestManifest): | ||
super().__init__(args, test_manifest) | ||
self.properties = BwcTestStartPropertiesOpenSearch(args.paths.get("opensearch", os.getcwd())) | ||
|
||
self.components = self.properties.build_manifest.components | ||
|
||
logging.info("Entering BWC test for OpenSearch") | ||
|
||
def __create_test_suite__(self, component, test_config, work_dir): | ||
return BwcTestSuiteOpenSearch( | ||
work_dir.name, | ||
component, | ||
test_config, | ||
self.test_recorder, | ||
self.properties.bundle_manifest, | ||
) |
33 changes: 33 additions & 0 deletions
33
src/test_workflow/bwc_test/bwc_test_runner_opensearch_dashboards.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# | ||
# The OpenSearch Contributors require contributions made to | ||
# this file be licensed under the Apache-2.0 license or a | ||
# compatible open source license. | ||
|
||
import logging | ||
import os | ||
|
||
from manifests.test_manifest import TestManifest | ||
from test_workflow.bwc_test.bwc_test_runner import BwcTestRunner | ||
from test_workflow.bwc_test.bwc_test_start_properties_opensearch_dashboards import BwcTestStartPropertiesOpenSearchDashboards | ||
from test_workflow.bwc_test.bwc_test_suite_opensearch_dashboards import BwcTestSuiteOpenSearchDashboards | ||
from test_workflow.test_args import TestArgs | ||
|
||
|
||
class BwcTestRunnerOpenSearchDashboards(BwcTestRunner): | ||
|
||
def __init__(self, args: TestArgs, test_manifest: TestManifest): | ||
super().__init__(args, test_manifest) | ||
self.properties = BwcTestStartPropertiesOpenSearchDashboards(args.paths.get("opensearch-dashboards", os.getcwd())) | ||
|
||
self.components = self.properties.build_manifest.components | ||
logging.info("Entering BWC test for OpenSearch Dashboards") | ||
|
||
def __create_test_suite__(self, component, test_config, work_dir): | ||
return BwcTestSuiteOpenSearchDashboards( | ||
work_dir.name, | ||
component, | ||
test_config, | ||
self.test_recorder, | ||
self.properties.bundle_manifest, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# | ||
# The OpenSearch Contributors require contributions made to | ||
# this file be licensed under the Apache-2.0 license or a | ||
# compatible open source license. | ||
|
||
|
||
from manifests.test_manifest import TestManifest | ||
from test_workflow.bwc_test.bwc_test_runner_opensearch import BwcTestRunnerOpenSearch | ||
from test_workflow.bwc_test.bwc_test_runner_opensearch_dashboards import BwcTestRunnerOpenSearchDashboards | ||
from test_workflow.test_args import TestArgs | ||
|
||
|
||
class BwcTestRunners: | ||
RUNNERS = { | ||
"OpenSearch": BwcTestRunnerOpenSearch, | ||
"OpenSearch Dashboards": BwcTestRunnerOpenSearchDashboards | ||
} | ||
|
||
@classmethod | ||
def from_test_manifest(cls, args: TestArgs, test_manifest: TestManifest): | ||
return cls.RUNNERS[test_manifest.name](args, test_manifest) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# | ||
# The OpenSearch Contributors require contributions made to | ||
# this file be licensed under the Apache-2.0 license or a | ||
# compatible open source license. | ||
|
||
|
||
import abc | ||
|
||
from manifests.build_manifest import BuildManifest | ||
from manifests.bundle_manifest import BundleManifest | ||
|
||
|
||
class BwcTestStartProperties(abc.ABC): | ||
def __init__(self, path, build_dir, bundle_dir): | ||
self.path = path | ||
self.build_dir = build_dir | ||
self.bundle_dir = bundle_dir | ||
|
||
self.bundle_manifest = BundleManifest.from_urlpath("/".join([self.path.rstrip("/"), self.bundle_dir])) | ||
self.build_manifest = BuildManifest.from_urlpath("/".join([self.path.rstrip("/"), self.build_dir])) |
12 changes: 12 additions & 0 deletions
12
src/test_workflow/bwc_test/bwc_test_start_properties_opensearch.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# | ||
# The OpenSearch Contributors require contributions made to | ||
# this file be licensed under the Apache-2.0 license or a | ||
# compatible open source license. | ||
|
||
from test_workflow.bwc_test.bwc_test_start_properties import BwcTestStartProperties | ||
|
||
|
||
class BwcTestStartPropertiesOpenSearch(BwcTestStartProperties): | ||
def __init__(self, path): | ||
super().__init__(path, "builds/opensearch/manifest.yml", "dist/opensearch/manifest.yml") |
12 changes: 12 additions & 0 deletions
12
src/test_workflow/bwc_test/bwc_test_start_properties_opensearch_dashboards.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# | ||
# The OpenSearch Contributors require contributions made to | ||
# this file be licensed under the Apache-2.0 license or a | ||
# compatible open source license. | ||
|
||
from test_workflow.bwc_test.bwc_test_start_properties import BwcTestStartProperties | ||
|
||
|
||
class BwcTestStartPropertiesOpenSearchDashboards(BwcTestStartProperties): | ||
def __init__(self, path): | ||
super().__init__(path, "builds/opensearch-dashboards/manifest.yml", "dist/opensearch-dashboards/manifest.yml") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# | ||
# The OpenSearch Contributors require contributions made to | ||
# this file be licensed under the Apache-2.0 license or a | ||
# compatible open source license. | ||
|
||
import os | ||
|
||
from test_workflow.bwc_test.bwc_test_suite import BwcTestSuite | ||
|
||
|
||
class BwcTestSuiteOpenSearch(BwcTestSuite): | ||
|
||
def __init__( | ||
self, | ||
work_dir, | ||
component, | ||
test_config, | ||
test_recorder, | ||
manifest | ||
): | ||
|
||
super().__init__( | ||
work_dir, | ||
component, | ||
test_config, | ||
test_recorder, | ||
manifest | ||
) | ||
|
||
def get_cmd(self, script, security, manifest_build_location): | ||
return f"{script}" | ||
|
||
@property | ||
def test_artifact_files(self): | ||
return { | ||
"opensearch-bwc-test": os.path.join(self.repo_work_dir, "build", "reports", "tests", "bwcTest") | ||
} |
Oops, something went wrong.