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

Main test: Update query returned records limit #30

Merged
merged 6 commits into from
Sep 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"click == 7.1.2",
"prompt_toolkit == 2.0.6",
"Pygments == 2.15.1",
"cli_helpers[styles] == 2.3.0",
"cli_helpers[styles] == 2.3.1",
"opensearch-py == 1.0.0",
"pyfiglet == 0.8.post1",
"boto3 == 1.34.34",
Expand Down
30 changes: 15 additions & 15 deletions tests/test_formatter.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,11 @@ def test_format_output(self):

expected = [
"fetched rows / total rows = 1/1",
"+--------+-------+",
"| name | age |",
"|--------+-------|",
"| Tim | 24 |",
"+--------+-------+",
"+------+-----+",
"| name | age |",
"|------+-----|",
"| Tim | 24 |",
"+------+-----+",
]
assert list(results) == expected

Expand Down Expand Up @@ -109,11 +109,11 @@ def test_format_array_output(self):

expected = [
"fetched rows / total rows = 1/1",
"+--------+---------+",
"| name | age |",
"|--------+---------|",
"| Tim | [24,25] |",
"+--------+---------+",
"+------+---------+",
"| name | age |",
"|------+---------|",
"| Tim | [24,25] |",
"+------+---------+",
]
assert list(results) == expected

Expand Down Expand Up @@ -161,11 +161,11 @@ def test_fake_large_output(self):
expected = [
"fetched rows / total rows = 200/1000\n"
"Attention: Use LIMIT keyword when retrieving more than 200 rows of data",
"+--------+---------+",
"| name | age |",
"|--------+---------|",
"| Tim | [24,25] |",
"+--------+---------+",
"+------+---------+",
"| name | age |",
"|------+---------|",
"| Tim | [24,25] |",
"+------+---------+",
]
assert list(results) == expected

Expand Down
5 changes: 3 additions & 2 deletions tests/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@

INVALID_ENDPOINT = "http://invalid:9200"
ENDPOINT = "http://localhost:9200"
QUERY = "select * from %s" % TEST_INDEX_NAME
# In OS >= 2.17, limit defaults to 10k, otherwise it's 200. Specify manually for consistency.
QUERY = "select * from %s LIMIT 150" % TEST_INDEX_NAME


class TestMain:
Expand All @@ -32,7 +33,7 @@ def test_explain(self, connection):
{
"name": "OpenSearchIndexScan",
"description": {
"request": 'OpenSearchQueryRequest(indexName=opensearchsql_cli_test, sourceBuilder={"from":0,"size":10000,"timeout":"1m","_source":{"includes":["a"],"excludes":[]}}, searchDone=false)'
"request": 'OpenSearchQueryRequest(indexName=opensearchsql_cli_test, sourceBuilder={"from":0,"size":150,"timeout":"1m","_source":{"includes":["a"],"excludes":[]}}, searchDone=false)'
},
"children": [],
}
Expand Down
Loading