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

[FEATURE] Introduce the smoke test for OpenSearch distribution + plugins #4551

Open
reta opened this issue Mar 21, 2024 · 25 comments
Open

[FEATURE] Introduce the smoke test for OpenSearch distribution + plugins #4551

reta opened this issue Mar 21, 2024 · 25 comments
Assignees
Labels
enhancement New Enhancement

Comments

@reta
Copy link
Contributor

reta commented Mar 21, 2024

Is your feature request related to a problem? Please describe

The OpenSearch distribution build has extensive support of running integration tests (integtest.sh) per individual components (mostly plugins at the moment) but not for a distribution with all plugins installed.

Describe the solution you'd like

It would be great to run a limited amount of amount of smoke tests for distribution with all plugins installed. The issue basically came out of opensearch-project/security#4003, and in nutshell is:

  • some plugins (like security, performance-analyzer) rely on internals of the OpenSearch
  • some plugins (like telemetry) introduce additional instrumentation / wrapping around these internals
  • changing or altering these internals could lead (and led in the past) to runtime failures

Having a full distribution and running a few tests to make sure key functional parts work would be sufficient to catch such issues early on.

Describe alternatives you've considered

Add integration tests to each plugin repo separately

Additional context

@reta reta added enhancement New Enhancement untriaged Issues that have not yet been triaged labels Mar 21, 2024
@reta
Copy link
Contributor Author

reta commented Mar 21, 2024

@peternied @Gaganjuneja fyi, @peterzhuamazon could you please add a few hints where to look at for implementing such a feature, thank you.

@peterzhuamazon
Copy link
Member

peterzhuamazon commented Mar 28, 2024

Have a discussion with @reta offline and introduced him on the current build repo test_workflow status.

Send this link: https://github.com/opensearch-project/opensearch-build/tree/main/src/test_workflow

Thanks.

@rishabh6788 rishabh6788 removed the untriaged Issues that have not yet been triaged label Apr 1, 2024
@gaiksaya
Copy link
Member

gaiksaya commented Apr 1, 2024

Here is the wiki with some details on the testing: https://github.com/opensearch-project/opensearch-build/wiki/Testing-the-Distribution

@reta Wondering what we are trying to achieve here? Please correct me if I am wrong, do you want to run integration test at the distribution level even in the plugin CI?

@reta
Copy link
Contributor Author

reta commented Apr 1, 2024

@reta Wondering what we are trying to achieve here? Please correct me if I am wrong, do you want to run integration test at the distribution level even in the plugin CI?

Thanks @gaiksaya ! No, I was thinking of running integration test at the distribution level with all (or at least most) of the plugins installed. The reasoning here is that we do have a few plugins now that affect OpenSearch core and every other plugin out there (indirectly or not) like security and telemetry, running a few smoke tests against full distribution would help us to catch crosscutting issues (that we run into in the past). Hope it make sense!

@peterzhuamazon
Copy link
Member

@reta Wondering what we are trying to achieve here? Please correct me if I am wrong, do you want to run integration test at the distribution level even in the plugin CI?

Thanks @gaiksaya ! No, I was thinking of running integration test at the distribution level with all (or at least most) of the plugins installed. The reasoning here is that we do have a few plugins now that affect OpenSearch core and every other plugin out there (indirectly or not) like security and telemetry, running a few smoke tests against full distribution would help us to catch crosscutting issues (that we run into in the past). Hope it make sense!

So that is pretty much what we are doing right now, but change to specific plugins or test cases, right? We are already running each plugin integTest while deploying full bundled distribution.

@reta
Copy link
Contributor Author

reta commented Apr 1, 2024

We are already running each plugin integTest while deploying full bundled distribution.

Correct, but the integTest in this case won't be focused on any specific plugin but distribution, I was thinking about just 1-2 core flows (like index + search fe), to make sure the distribution + plugins are working fine.

@gaiksaya
Copy link
Member

gaiksaya commented Apr 1, 2024

The TL;DR of the integration test workflow is:

Install the recently created distribution (min + plugins) into the VM. Clone the plugin repository, checkout a specific commit/branch used to build the above distribution and then run this https://github.com/opensearch-project/opensearch-build/blob/main/scripts/default/integtest.sh#L105

I believe you want the same for OpenSearch too? (min+plugins) and then run some gradle command for integTest of OpenSearch ?

Also heads-up we do not have any integration test for the distribution ONLY as such at this point. We do have validation that makes sure basic APIs like health and plugin list runs, but as such no integration tests for "OpenSearch as a Distribution"

@reta
Copy link
Contributor Author

reta commented Apr 1, 2024

I believe you want the same for OpenSearch too? (min+plugins) and then run some gradle command for integTest of OpenSearch ?

I think yes, I will look shortly but is sounds about right: install min, install plugins, run 1-2 tests

Also heads-up we do not have any integration test for the distribution ONLY as such at this point. We do have validation that makes sure basic APIs like health and plugin list runs, but as such no integration tests for "OpenSearch as a Distribution"

Correct, this is why this issue was created

@gaiksaya
Copy link
Member

gaiksaya commented Apr 1, 2024

Got it now! Thank you for being patient and helping us understand.
In that case,

  • Would these tests be added in OpenSearch repo or build repo? - Requires considerable effort
  • I believe we had received a feedback a while back to run gradle check at the distribution level as well (min + plugins instead of just min that runs at PR levels) - just the onboarding so minimum effort required.

@reta
Copy link
Contributor Author

reta commented Apr 1, 2024

Would these tests be added in OpenSearch repo or build repo? - Requires considerable effort

I was thinking about build repo, may be we could simplify it by using curl only (no need for Gradle etc), would the effort be justifiable?

I believe we had received a feedback a while back to run gradle check at the distribution level as well (min + plugins instead of just min that runs at PR levels) - just the onboarding so minimum effort required.

I think if we want keep tests in OpenSearch repo (not build repo), we could repurpose some existing tests and run them as run gradle check at the distribution level

@gaiksaya
Copy link
Member

gaiksaya commented Apr 1, 2024

I was thinking about build repo, may be we could simplify it by using curl only (no need for Gradle etc), would the effort be justifiable?

I believe so. We can either expand the validation workflow API test cases here or add new framework for integration testing at the distribution level separately.

I think if we want keep tests in OpenSearch repo (not build repo), we could repurpose some existing tests and run them as run gradle check at the distribution level

Right! I believe this is another problem we are trying to solve. Onboarding OpenSearch to test workflow can be another problem statement. I assumed if this repurposing was to add the integration tests at distribution level then it would be beneficial to get everything in one go.

Adding @prudhvigodithi @bbarani to this conversation to provide some insights and let us know if any parallel efforts are going on.

@reta
Copy link
Contributor Author

reta commented Apr 1, 2024

I believe so. We can either expand the validation workflow API test cases here or add new framework for integration testing at the distribution level separately.

👍 will look into it

. Onboarding OpenSearch to test workflow can be another problem statement. I assumed if this repurposing was to add the integration tests at distribution level then it would be beneficial to get everything in one go.

👍 will look what we have now (we have a lot of test types and phases)

@prudhvigodithi
Copy link
Member

prudhvigodithi commented Apr 1, 2024

Reading the above comments what we can do is.

  • Extend the validation framework (as mentioned by @gaiksaya) to run one query/API/test per plugin (which can be extended as required in future) on the distribution.
  • This can be something like get/update the security settings, run the security admin script and test the security index.
  • Test the plugin behaviors on the distribution.
  • Index the data and run some queries (one query that can test each plugin functionality), test basic aggregations if required.
  • Have a common framework for other new plugins to onboard to these global distribution level tests.
  • This should be common for OpenSearch and OpenSearch Dashboards.
  • Dashboard API operations to create and test visualizations.

If we dont want this in build repo we can even have a new repo for this distribution level testing, something like https://github.com/opensearch-project/opensearch-dashboards-functional-test which should be common for both OpenSearch and OpenSearch Dashboards.

@reta is this something you are looking for ? :)

@reta
Copy link
Contributor Author

reta commented Apr 2, 2024

@reta is this something you are looking for ? :)

Thanks @prudhvigodithi , I think your comment incorporates possible directions for improving / evolving the validation part of the build, I currently have no knowledge of it (but the hints where to look, thanks to @gaiksaya ). At high level - I am looking for very specific phase at the validation step when we could:

  • install min distribution
  • install all bundled plugins
  • run a few smoke tests

The last step is not specific to any plugin but a distribution as a cohesive bundle.

@gaiksaya
Copy link
Member

gaiksaya commented Apr 2, 2024

We already do 1-2 so only part we need to add is run a few smoke tests
Also @prudhvigodithi, IMO keeping it simple (only related to distribution) might be helpful. If plugin specific tests come in we would be looking at another functional-test repo and mismatched tests. As @reta said those tests should be related to distribution as a cohesive bundle.
Core maintainers, community as well as contributors can contribute or let us know what would come under this test umbrella.

@seraphjiang
Copy link
Member

If we dont want this in build repo we can even have a new repo for this distribution level testing, something like https://github.com/opensearch-project/opensearch-dashboards-functional-test which should be common for both OpenSearch and OpenSearch Dashboards.

functional test repo is design for smoke test purpose (or we named it release test) for dashboards and dashboards plugin :)

@zelinh
Copy link
Member

zelinh commented Apr 15, 2024

[Grooming]
Acceptance Criteria:

  • Create a one pager differentiating smoke tests and validation.
  • Find out the location of these smoke tests. (What specific repos)
  • Tests should be generated for OS. OSD is pending decision from OSD core team.

@dblock
Copy link
Member

dblock commented Sep 5, 2024

@prudhvigodithi prudhvigodithi moved this from Backlog to 🏗 In progress in Engineering Effectiveness Board Sep 9, 2024
@prudhvigodithi prudhvigodithi moved this from 🏗 In progress to 🆕 New in Engineering Effectiveness Board Sep 9, 2024
@peterzhuamazon peterzhuamazon moved this from Planned (Next Quarter) to 🏗 In progress in Engineering Effectiveness Board Sep 23, 2024
@zelinh
Copy link
Member

zelinh commented Sep 25, 2024

We plan to create a new test workflow framework for smoke tests.

The main uncertainty we have now is how we define smoke tests.

Here are some of Scope and Requirements we were thinking:

  • Target Distribution:
    • Smoke tests will firstly apply to the OpenSearch distribution bundle. OpenSearch Dashboards can be onboarded later with the same framework.
  • Test Environment:
    • Smoke tests will require the OpenSearch distribution bundle to be installed with all plugins and the cluster to be spun up.
    • The tests will assume a with-security configuration for all cluster operations if security plugin is built within the bundle.
  • Test Coverage:
    • Basic smoke tests will cover essential functionalities such as index operations and API requests.
    • Tests will be run using simple curl commands to make API requests and validate responses.
  • Cluster Configuration:
    • The cluster setup will use default configurations, and no cleanup will be performed after tests.
  • Concurrency:
    • All smoke tests should be able to run concurrently, with no dependency on a specific sequence of execution.
  • Limitations:
    • Tests that require extensive data validation or cleanup are outside the scope of smoke testing and should be included in integration tests.

In this way, we would be focusing on testing the basic functionalities including API status verification for OpenSearch core and plugins with a distribution bundle spun up.

What do you think about any of specific smoke tests (any API requests) from Core perspective that we could start on? @reta

@reta
Copy link
Contributor Author

reta commented Sep 27, 2024

Thanks @zelinh , it makes perfect sense

What do you think about any of specific smoke tests (any API requests) from Core perspective that we could start on? @reta

I think as per comment:

basic smoke tests will cover essential functionalities such as index operations and API requests.

That would be great start. I sadly don't know if we already have such tests (as part of plugin suites) in some form or another, but that was an idea: install all plugins, ingest few documents, run search. I think we don't need many tests. Does it answer your question?

@peterzhuamazon
Copy link
Member

Thanks @zelinh , it makes perfect sense

What do you think about any of specific smoke tests (any API requests) from Core perspective that we could start on? @reta

I think as per comment:

basic smoke tests will cover essential functionalities such as index operations and API requests.

That would be great start. I sadly don't know if we already have such tests (as part of plugin suites) in some form or another, but that was an idea: install all plugins, ingest few documents, run search. I think we don't need many tests. Does it answer your question?

In our validation workflow the most we did was to call 9200/5601 port, list plugin, check cluster status and that is it. I assume we need to call more APIs as a baseline to see if the cluster is good.

@reta
Copy link
Contributor Author

reta commented Sep 27, 2024

In our validation workflow the most we did was to call 9200/5601 port, list plugin, check cluster status and that is it. I assume we need to call more APIs as a baseline to see if the cluster is good.

Correct, ingest + search for ingested docs

@zelinh
Copy link
Member

zelinh commented Sep 27, 2024

In our validation workflow the most we did was to call 9200/5601 port, list plugin, check cluster status and that is it. I assume we need to call more APIs as a baseline to see if the cluster is good.

Correct, ingest + search for ingested docs

Make sense for me. We could start with ingesting few docs and run some basic search on indices. The framework we design could also be elaborated with time.

@zelinh
Copy link
Member

zelinh commented Oct 22, 2024

We proposed smoke test workflow provides a foundational framework to run quick checks on the OpenSearch bundle. These tests run separately from the more complex integration tests but follow a similar deployment process.

Introduce a smoke test framework to the CI/CD process. The workflow will pass parameters like the distribution path, architecture, and components.
st2

Tasks:

  • Add new smoke test section into test manifest schema #5126
    A new "smoke-test" section will be added to the manifest file to specify which components are onboarded for smoke testing.

  • Onboard component test spec YAML and spec framework
    Each plugin will have a YAML file defining the smoke tests and associated API requests based on the OpenSearch API specification. The test specs will account for version differences in APIs.

  • Create smoke test python workflow for cluster deployment and testing #5164
    The new introduced smoke test runner automates OpenSearch cluster deployment, loads test manifests, sends API requests, and validates responses against the OpenSearch API specification with third-party OpenAPI-core python client. It ensures all key components function immediately after a build.

  • Integrate the smoke test workflow with CI/CD pipeline
    The new Jenkins pipeline would be created to integrate smoke tests with existing build workflow for automation to catch major issue in earlier stage.

@reta
Copy link
Contributor Author

reta commented Oct 28, 2024

Thanks for the update @zelinh

  Each plugin will have a YAML file defining the smoke tests and associated API requests based on the OpenSearch API specification. The test specs will account for version differences in APIs.

I think in general it makes sense but we very likely don't need that at first: the initial smoke test to run, as we discussed, has a goal of making sure basic ingestion + search work with all plugins installed. This flow (again, in basic form) does not directly depend on any plugin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New Enhancement
Projects
Status: 🏗 In progress
Development

No branches or pull requests

8 participants