Skip to content

Commit

Permalink
Main test: Update query returned records limit (#30)
Browse files Browse the repository at this point in the history
* Update query returned records limit

Signed-off-by: Simeon Widdis <[email protected]>

* Add manual limit to test query

Signed-off-by: Simeon Widdis <[email protected]>

* Lock cli_helpers[styles] version in tox

Signed-off-by: Simeon Widdis <[email protected]>

* Update cli_helpers[styles]

Signed-off-by: Simeon Widdis <[email protected]>

* Remove styles from tox config

Signed-off-by: Simeon Widdis <[email protected]>

---------

Signed-off-by: Simeon Widdis <[email protected]>
  • Loading branch information
Swiddis authored Sep 25, 2024
1 parent 800d743 commit d7f4041
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 18 deletions.
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

0 comments on commit d7f4041

Please sign in to comment.