-
Notifications
You must be signed in to change notification settings - Fork 277
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
Updated integ-tests implementation to run all the OSD plugins. #3316
Conversation
Codecov Report
📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more @@ Coverage Diff @@
## main #3316 +/- ##
==========================================
- Coverage 91.74% 91.42% -0.32%
==========================================
Files 172 172
Lines 4991 5017 +26
==========================================
+ Hits 4579 4587 +8
- Misses 412 430 +18
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe the methods need to be separated into child classes due to -t
option. It only applies to dashboards and not opensearch.
@@ -114,7 +116,8 @@ def custom_node_endpoint_encoder(node_endpoint: NodeEndpoint) -> dict: | |||
|
|||
def execute_integtest_sh(self, endpoint: str, port: int, security: bool, test_config: str) -> int: | |||
cluster_endpoint_port = [ClusterEndpoint("cluster1", [NodeEndpoint(endpoint, port, 9300)], [])] | |||
return self.multi_execute_integtest_sh(cluster_endpoint_port, security, test_config) | |||
script = ScriptFinder.find_integ_test_script("functionalTestDashboards", "https://github.com/opensearch-project/opensearch-dashboards-functional-test.git") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will break for opensearch plugins. functional test only applies to dashboards. Also the I don't see ref
anywhere, this will by default clone main. You need to get the repo link and ref from input manifest, https://github.com/opensearch-project/opensearch-build/blob/main/manifests/2.6.0/opensearch-dashboards-2.6.0.yml#L13-L15
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see the function execute_integtest_sh in used only for OSD which calls multi_execute_integtest_sh, whereas OS directly uses multi_execute_integtest_sh.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah we need to change that behavior. Can you fix that as well? Adding @peterzhuamazon @prudhvigodithi for more input
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use the git lib in build repo to checkout ftrepo, do not need to use a find script call like this, because if cwd already have ftrepo content, you can just call the find script for integtest.sh and it will find it in root.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure Peter, started working on this change. Trying to fetch the integtest.sh from ftrepo based on ref branch from input manifest.
if os.path.exists(script): | ||
if len(cluster_endpoints) == 1: | ||
single_data_node = cluster_endpoints[0].data_nodes[0] | ||
cmd = f"bash {script} -b {single_data_node.endpoint} -p {single_data_node.port} -s {str(security).lower()} -v {self.bundle_manifest.build.version}" | ||
cmd = f"bash {script} -b {single_data_node.endpoint} -p {single_data_node.port} -s {str(security).lower()} -t {self.component.name} -v {self.bundle_manifest.build.version}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is again not true for opensearch components,
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can make multi_execute_integtest_sh abstract and implement it separately for OS and OSD.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just use a filter to remove -t if not needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another problem is what if user does not enter any component, then it should default run everything in the yml. Therefore, you method might not work as it will include ftrepo as a component to run.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @peterzhuamazon , the plan is to implement the multi_execute_integtest_sh in the child classes for OS and OSD. If that's the case I think the implementaion works well for OS too, let me know if I just need to add a filter to remove -t instead of having different implementations OS and OSD.
Currently I can see the tests are running sequentially for all OSD and OS plugins in yml if we do not provide --component names.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @Divyaasm,
Some comments here.
Thanks.
if os.path.exists(script): | ||
if len(cluster_endpoints) == 1: | ||
single_data_node = cluster_endpoints[0].data_nodes[0] | ||
cmd = f"bash {script} -b {single_data_node.endpoint} -p {single_data_node.port} -s {str(security).lower()} -v {self.bundle_manifest.build.version}" | ||
cmd = f"bash {script} -b {single_data_node.endpoint} -p {single_data_node.port} -s {str(security).lower()} -t {self.component.name} -v {self.bundle_manifest.build.version}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just use a filter to remove -t if not needed.
@@ -114,7 +116,8 @@ def custom_node_endpoint_encoder(node_endpoint: NodeEndpoint) -> dict: | |||
|
|||
def execute_integtest_sh(self, endpoint: str, port: int, security: bool, test_config: str) -> int: | |||
cluster_endpoint_port = [ClusterEndpoint("cluster1", [NodeEndpoint(endpoint, port, 9300)], [])] | |||
return self.multi_execute_integtest_sh(cluster_endpoint_port, security, test_config) | |||
script = ScriptFinder.find_integ_test_script("functionalTestDashboards", "https://github.com/opensearch-project/opensearch-dashboards-functional-test.git") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use the git lib in build repo to checkout ftrepo, do not need to use a find script call like this, because if cwd already have ftrepo content, you can just call the find script for integtest.sh and it will find it in root.
@@ -87,7 +88,8 @@ def __setup_cluster_and_execute_test_config(self, config: str) -> int: | |||
) as (endpoints): | |||
os.chdir(self.work_dir) | |||
self.pretty_print_message("Running integration tests for " + self.component.name + " " + config) | |||
return self.multi_execute_integtest_sh(endpoints, security, config) | |||
script = ScriptFinder.find_integ_test_script(self.component.name, self.repo.working_directory) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need to call the scriptfinder here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To make sure I separate the ftrepo clone for dashboards, Will change it back in the child class implementations.
if os.path.exists(script): | ||
if len(cluster_endpoints) == 1: | ||
single_data_node = cluster_endpoints[0].data_nodes[0] | ||
cmd = f"bash {script} -b {single_data_node.endpoint} -p {single_data_node.port} -s {str(security).lower()} -v {self.bundle_manifest.build.version}" | ||
cmd = f"bash {script} -b {single_data_node.endpoint} -p {single_data_node.port} -s {str(security).lower()} -t {self.component.name} -v {self.bundle_manifest.build.version}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another problem is what if user does not enter any component, then it should default run everything in the yml. Therefore, you method might not work as it will include ftrepo as a component to run.
Have offline discussion with @Divyaasm on this and there are several issues:
Thanks. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, Some minor improvements.
@@ -81,6 +94,38 @@ def __setup_cluster_and_execute_test_config(self, config: str) -> int: | |||
os.chdir(self.work_dir) | |||
return self.execute_integtest_sh(endpoint, port, security, config) | |||
|
|||
def multi_execute_integtest_sh(self, cluster_endpoints: list, security: bool, test_config: str) -> int: | |||
script = ScriptFinder.find_integ_test_script(self.component.name, self.repo.working_directory) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add tests for this asserting that self.repo
is always functionalTestDashboards
for opensearch dashboards
build_manifest_opensearch_dashboards.components["functionalTestDashboards"].repository, | ||
build_manifest_opensearch_dashboards.components["functionalTestDashboards"].commit_id, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Use single quotes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure Sayali
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
src/test_workflow/integ_test/integ_test_suite_opensearch_dashboards.py
Outdated
Show resolved
Hide resolved
src/test_workflow/integ_test/integ_test_suite_opensearch_dashboards.py
Outdated
Show resolved
Hide resolved
Thanks @Divyaasm this is a great addition to OSD test so that it can run parallel like OS test. |
return {"endpoint": node_endpoint.endpoint, "port": node_endpoint.port, "transport": node_endpoint.transport} | ||
if os.path.exists(script): | ||
single_node = cluster_endpoints[0].data_nodes[0] | ||
cmd = f"bash {script} -b {single_node.endpoint} -p {single_node.port} -s {str(security).lower()} -t {self.component.name} -v {self.bundle_manifest.build.version}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Checked with @peterzhuamazon . Please raise the PR to FTRep once ready.
How about we introduce a new parameter, say All we need to do would be add a condition to test which sub-class is calling this method and if it comes from |
The idea is good but the sub-component is actually the component of dashboards product. That's why in order to avoid confusion we went with refactoring the current set up. It is also true that they are sub-components of functional-test repo which is quite confusing but that is just from test perspective. For build workflow, we have similar thing where we build specific components. Wanted to keep the same for test as well. |
The logic is such that if |
Yeah got that but again will be confusing for component as well as other teams between components and sub-components for OS and OSD. I am happy to revisit this logic in future. The reason we turned |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
return {"endpoint": node_endpoint.endpoint, "port": node_endpoint.port, "transport": node_endpoint.transport} | ||
if os.path.exists(script): | ||
single_node = cluster_endpoints[0].data_nodes[0] | ||
cmd = f"bash {script} -b {single_node.endpoint} -p {single_node.port} -s {str(security).lower()} -t {self.component.name} -v {self.bundle_manifest.build.version} -o default" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if self.component.name
is empty will the tests still run for all components by default?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The list of components is fetched here based on input argument --component if that's not passed it runs for all the components in the test manifest. self.component.name has the plugin name and has it's value from the manifest and is not empty in any case.
We alter the plugin names passed to self.component.name based on --component argument to the workflow but run them individually each time with -t component.name as per test manifest.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! This makes it clear.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe opensearch-project/opensearch-dashboards-functional-test#644 needs to go in first before this PR can be merged?
Yes, and Peter seem to have PR related to integ-test OSD in line |
Signed-off-by: Divya Madala <[email protected]> Changes updated Signed-off-by: Divya Madala <[email protected]> add -o parameter Signed-off-by: Divya Madala <[email protected]> Updated test cases Signed-off-by: Divya Madala <[email protected]>
Signed-by: [email protected]
Fix to issue #2144
Description
-Made changes to run OSD plugins altogether or individually using --component arg.
-OSD integtests when triggered from buildrepo are now executed via opensearch-dashboards-functional-test repo.
-Updated test-cases accordingly.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.