-
Notifications
You must be signed in to change notification settings - Fork 34
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
Added a framework for end-to-end tests #1022
Merged
YANG-DB
merged 2 commits into
opensearch-project:main
from
Bit-Quill:e2e-tests-framework
Jan 29, 2025
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
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,124 @@ | ||
# End-to-End Tests | ||
|
||
## Overview | ||
|
||
The end-to-end tests start the integration test docker cluster and execute queries against it. Queries can be | ||
sent to the Spark master or to OpenSearch server (using async query). | ||
|
||
The tests will run a query and compare the results to an expected results file. | ||
|
||
There are four types of tests: | ||
1. SQL queries sent to the Spark master | ||
2. PPL queries sent to the Spark master | ||
3. SQL queries sent to the OpenSearch server as an async query | ||
4. PPL queries sent to the OpenSearch server as an async query | ||
|
||
## Running the End-to-End Tests | ||
|
||
The tests can be run using SBT: | ||
|
||
```shell | ||
sbt e2etest/test | ||
``` | ||
|
||
## Test Structure | ||
|
||
### SQL Queries for Spark Master | ||
|
||
Create two files: | ||
* `e2e-test/src/test/resources/spark/queries/sql/[NAME].sql` | ||
* `e2e-test/src/test/resources/spark/queries/sql/[NAME].results` | ||
|
||
The `*.sql` file contains only the SQL query on one line. | ||
|
||
The `*.results` file contains the results in CSV format with a header (column names). | ||
|
||
### PPL Queries for Spark Master | ||
|
||
Create two files: | ||
* `e2e-test/src/test/resources/spark/queries/ppl/[NAME].ppl` | ||
* `e2e-test/src/test/resources/spark/queries/ppl/[NAME].results` | ||
|
||
The `*.ppl` file contains only the PPL query on one line. | ||
|
||
The `*.results` file contains the results in CSV format with a header (column names). | ||
|
||
### SQL Queries for OpenSearch Async API | ||
|
||
Create two files: | ||
* `e2e-test/src/test/resources/opensearch/queries/sql/[NAME].sql` | ||
* `e2e-test/src/test/resources/opensearch/queries/sql/[NAME].results` | ||
|
||
The `*.sql` file contains only the SQL query on one line. | ||
|
||
The `*.results` file contains the results in JSON format. The format is the exact output from the REST call | ||
to get the async query results (`_plugins/_async_query/[QUERY_ID]`). | ||
|
||
Results example: | ||
```json | ||
{ | ||
"status": "SUCCESS", | ||
"schema": [ | ||
{ | ||
"name": "id", | ||
"type": "integer" | ||
}, | ||
{ | ||
"name": "name", | ||
"type": "string" | ||
} | ||
], | ||
"datarows": [ | ||
[ | ||
1, | ||
"Foo" | ||
], | ||
[ | ||
2, | ||
"Bar" | ||
] | ||
], | ||
"total": 2, | ||
"size": 2 | ||
} | ||
``` | ||
|
||
### PPL Queries for OpenSearch Async API | ||
|
||
Create two files: | ||
* `e2e-test/src/test/resources/opensearch/queries/ppl/[NAME].ppl` | ||
* `e2e-test/src/test/resources/opensearch/queries/ppl/[NAME].results` | ||
|
||
The `*.ppl` file contains only the PPL query on one line. | ||
|
||
The `*.results` file contains the results in JSON format. The format is the exact output from the REST call | ||
to get the async query results (`_plugins/_async_query/[QUERY_ID]`). | ||
|
||
Results example: | ||
```json | ||
{ | ||
"status": "SUCCESS", | ||
"schema": [ | ||
{ | ||
"name": "id", | ||
"type": "integer" | ||
}, | ||
{ | ||
"name": "name", | ||
"type": "string" | ||
} | ||
], | ||
"datarows": [ | ||
[ | ||
1, | ||
"Foo" | ||
], | ||
[ | ||
2, | ||
"Bar" | ||
] | ||
], | ||
"total": 2, | ||
"size": 2 | ||
} | ||
``` |
30 changes: 30 additions & 0 deletions
30
e2e-test/src/test/resources/opensearch/indices/customer.mapping.json
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,30 @@ | ||
{ | ||
"mappings": { | ||
"properties": { | ||
"c_custkey": { | ||
"type": "integer" | ||
}, | ||
"c_name": { | ||
"type": "text" | ||
}, | ||
"c_address": { | ||
"type": "text" | ||
}, | ||
"c_nationkey": { | ||
"type": "integer" | ||
}, | ||
"c_phone": { | ||
"type": "text" | ||
}, | ||
"c_acctbal": { | ||
"type": "double" | ||
}, | ||
"c_mktsegment": { | ||
"type": "text" | ||
}, | ||
"c_comment": { | ||
"type": "text" | ||
} | ||
} | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
e2e-test/src/test/resources/opensearch/indices/http_logs.json
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 @@ | ||
{"index": {"_index": "http_logs"}} | ||
{"@timestamp": 1696154400000, "year": 2023, "month": 10, "day": 1, "clientip": "40.135.0.0", "request": "GET /images/hm_bg.jpg HTTP/1.0", "status": 200, "size": 24736} | ||
{"index": {"_index": "http_logs"}} | ||
{"@timestamp": 1696154700000, "year": 2023, "month": 10, "day": 1, "clientip": "232.0.0.0", "request": "GET /images/hm_bg.jpg HTTP/1.0", "status": 200, "size": 24736} | ||
{"index": {"_index": "http_logs"}} | ||
{"@timestamp": 1696155000000, "year": 2023, "month": 10, "day": 1, "clientip": "26.1.0.0", "request": "GET /images/hm_bg.jpg HTTP/1.0", "status": 200, "size": 24736} | ||
{"index": {"_index": "http_logs"}} | ||
{"@timestamp": 1696155300000, "year": 2023, "month": 10, "day": 1, "clientip": "247.37.0.0", "request": "GET /french/splash_inet.html HTTP/1.0", "status": 200, "size": 3781} | ||
{"index": {"_index": "http_logs"}} | ||
{"@timestamp": 1696155600000, "year": 2023, "month": 10, "day": 1, "clientip": "247.37.0.0", "request": "GET /images/hm_nbg.jpg HTTP/1.0", "status": 304, "size": 0} | ||
{"index": {"_index": "http_logs"}} | ||
{"@timestamp": 1696155900000, "year": 2023, "month": 10, "day": 1, "clientip": "252.0.0.0", "request": "GET /images/hm_bg.jpg HTTP/1.0", "status": 200, "size": 24736} |
30 changes: 30 additions & 0 deletions
30
e2e-test/src/test/resources/opensearch/indices/http_logs.mapping.json
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,30 @@ | ||
{ | ||
"mappings": { | ||
"properties": { | ||
"@timestamp": { | ||
"type": "date" | ||
}, | ||
"year": { | ||
"type": "integer" | ||
}, | ||
"month": { | ||
"type": "integer" | ||
}, | ||
"day": { | ||
"type": "integer" | ||
}, | ||
"clientip": { | ||
"type": "keyword" | ||
}, | ||
"request": { | ||
"type": "text" | ||
}, | ||
"status": { | ||
"type": "integer" | ||
}, | ||
"size": { | ||
"type": "integer" | ||
} | ||
} | ||
} | ||
} |
54 changes: 54 additions & 0 deletions
54
e2e-test/src/test/resources/opensearch/indices/lineitem.mapping.json
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,54 @@ | ||
{ | ||
"mappings": { | ||
"properties": { | ||
"l_orderkey": { | ||
"type": "integer" | ||
}, | ||
"l_partkey": { | ||
"type": "text" | ||
}, | ||
"l_suppkey": { | ||
"type": "integer" | ||
}, | ||
"l_linenumber": { | ||
"type": "integer" | ||
}, | ||
"l_quantity": { | ||
"type": "double" | ||
}, | ||
"l_extendedprice": { | ||
"type": "double" | ||
}, | ||
"l_discount": { | ||
"type": "double" | ||
}, | ||
"l_tax": { | ||
"type": "double" | ||
}, | ||
"l_returnflag": { | ||
"type": "text" | ||
}, | ||
"l_linestatus": { | ||
"type": "text" | ||
}, | ||
"l_shipdate": { | ||
"type": "date" | ||
}, | ||
"l_commitdate": { | ||
"type": "date" | ||
}, | ||
"l_receiptdate": { | ||
"type": "date" | ||
}, | ||
"l_shipinstruct": { | ||
"type": "text" | ||
}, | ||
"l_shipmode": { | ||
"type": "text" | ||
}, | ||
"l_comment": { | ||
"type": "text" | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 looks great
I'm missing some detailed review and call diagram sequence of how the E2E operates for each case:
What are the functions of each docker-compose service and which sequence the call each other
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.
Added some documentation with diagrams to explain how these queries are executed.