Skip to content

Add sanity test script #3564

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

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

qianheng-aws
Copy link
Collaborator

@qianheng-aws qianheng-aws commented Apr 21, 2025

Description

Add sanity test script for submitting queries in batch and generating test reports automatically.

How to use:

python SanityTest.py --base-url ${URL_ADDRESS} --username *** --password *** --input-csv test_queries.csv --output-file test_report --max-workers 2

Related Issues

Check List

  • New functionality includes testing.
  • New functionality has been documented.
  • New functionality has javadoc added.
  • New functionality has a user manual doc added.
  • API changes companion pull request created.
  • Commits are signed per the DCO using --signoff.
  • Public documentation issue/PR created.

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.

Signed-off-by: Heng Qian <[email protected]>
Signed-off-by: Heng Qian <[email protected]>
Signed-off-by: Heng Qian <[email protected]>
Signed-off-by: Heng Qian <[email protected]>
Signed-off-by: Heng Qian <[email protected]>
Signed-off-by: Heng Qian <[email protected]>
@qianheng-aws qianheng-aws marked this pull request as ready for review April 22, 2025 08:35
"start_time": "2025-04-22 16:30:22.461505",
"end_time": "2025-04-22 16:30:22.863651",
"error": {
"error": "404 Client Error: Not Found for url: http://k8s-calcitep-opensear-8312a971dd-1309739395.us-west-1.elb.amazonaws.com/_plugins/_ppl",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you replace this url to localhost?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Signed-off-by: Heng Qian <[email protected]>
Signed-off-by: Heng Qian <[email protected]>
@@ -0,0 +1,3 @@
query_name,query,expected_status
Successful Demo,"source=opensearch_dashboards_sample_data_flights | patterns FlightDelayType | stats count() by patterns_field",SUCCESS
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we assert result?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was migrated from opensearch-spark repo and didn't support checking results currently. Plan to support such feature later.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It bring me that we can assert results comparing to enable/disable Calcite in script.

# Sanity Test Script

### Description
This Python script executes test queries from a CSV file using an asynchronous query API and generates comprehensive test reports.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the difference with existing IT? When should we use SanityTest script?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without this script, we need to do sanity test manually by submitting PPL queries one by one and recording the results.

In the sanity test for 3.0.0, we uses the same PPL queries and datas as opensearch-spark https://github.com/opensearch-project/opensearch-spark/blob/main/integ-test/script/test_cases.csv. But we plans to build more factual tests next time, which should be the major difference from existing IT,

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without this script, we need to do sanity test manually by submitting PPL queries one by one and recording the results.

We can run IT/YamlIT against remote cluster. ./gradlew ':integ-test:yamlRestTest' -Dtests.rest.cluster=localhost:9200 -Dtests.cluster=localhost:9200 -Dtests.clustername="yamlRestTest-0"

@dai-chen ask similar question in here.

My thoughts,

  • ExistingIT can leave with IT.
  • New command / functions, bug fix could migrate to YamlIT.
  • The tests in the PR can be considered a comprehensive test set, which can be leveraged to verify PPL behavior across both Spark and OpenSearch.

Copy link
Collaborator Author

@qianheng-aws qianheng-aws Apr 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems yamlRestTest can satisfy our requirements of sanity test already, including the feature of results matching. What's your opinion? @LantaoJin

@penghuo By the way, does this test framework support concurrency testing?

Copy link
Member

@LantaoJin LantaoJin Apr 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@penghuo 1. do we have any doc how to run yaml test (prepare data and queries)? 2. are yamlTest and sanity test equivalent? (can we sign-off the sanity requirement if yarmTest passed?)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@penghuo By the way, does this test framework support concurrency testing?

Not sure, I think it should, borrow it from opensearch-core.

  1. do we have any doc how to run yaml test (prepare data and queries)?

data and query is self contained for each feature. for instance. in opensearch-core, each aggregation feature is sepereate file.

  1. are yamlTest and sanity test equivalent?

I think so, we can add sanityTest as yamlTest, and run yamlTest against remote cluster, then signoff.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants