forked from TrueCloudLab/s3-tests
add handling for EventStreamError exception
Signed-off-by: Gal Salomon <gal.salomon@gmail.com>
(cherry picked from commit 77f1334571
)
This commit is contained in:
parent
f4e362dc3c
commit
565e5c8b9b
1 changed files with 29 additions and 24 deletions
|
@ -4,6 +4,7 @@ import string
|
|||
import re
|
||||
import json
|
||||
from botocore.exceptions import ClientError
|
||||
from botocore.exceptions import EventStreamError
|
||||
|
||||
import uuid
|
||||
|
||||
|
@ -276,6 +277,7 @@ def run_s3select(bucket,key,query,column_delim=",",row_delim="\n",quot_char='"',
|
|||
s3 = get_client()
|
||||
result = ""
|
||||
result_status = {}
|
||||
|
||||
try:
|
||||
r = s3.select_object_content(
|
||||
Bucket=bucket,
|
||||
|
@ -291,10 +293,17 @@ def run_s3select(bucket,key,query,column_delim=",",row_delim="\n",quot_char='"',
|
|||
return result
|
||||
|
||||
if progress == False:
|
||||
|
||||
try:
|
||||
for event in r['Payload']:
|
||||
if 'Records' in event:
|
||||
records = event['Records']['Payload'].decode('utf-8')
|
||||
result += records
|
||||
|
||||
except EventStreamError as c:
|
||||
result = str(c)
|
||||
return result
|
||||
|
||||
else:
|
||||
result = []
|
||||
max_progress_scanned = 0
|
||||
|
@ -312,6 +321,7 @@ def run_s3select(bucket,key,query,column_delim=",",row_delim="\n",quot_char='"',
|
|||
if 'End' in event:
|
||||
result_status['End'] = event['End']
|
||||
|
||||
|
||||
if progress == False:
|
||||
return result
|
||||
else:
|
||||
|
@ -1141,8 +1151,6 @@ def test_alias():
|
|||
@pytest.mark.s3select
|
||||
def test_alias_cyclic_refernce():
|
||||
|
||||
## TEMP : RGW may return error-status that it is not handled by this test
|
||||
return
|
||||
number_of_rows = 10000
|
||||
|
||||
# purpose of test is to validate the s3select-engine is able to detect a cyclic reference to alias.
|
||||
|
@ -1296,8 +1304,6 @@ def test_csv_definition():
|
|||
@pytest.mark.s3select
|
||||
def test_schema_definition():
|
||||
|
||||
## TEMP : RGW may return error-status that it is not handled by this test
|
||||
return
|
||||
number_of_rows = 10000
|
||||
|
||||
# purpose of test is to validate functionality using csv header info
|
||||
|
@ -1313,7 +1319,6 @@ def test_schema_definition():
|
|||
|
||||
# using the scheme on first line, query is using the attach schema
|
||||
res_use = remove_xml_tags_from_result( run_s3select(bucket_name,csv_obj_name,"select c1,c3 from s3object;",csv_header_info="USE") ).replace("\n","")
|
||||
|
||||
# result of both queries should be the same
|
||||
s3select_assert_result( res_ignore, res_use)
|
||||
|
||||
|
|
Loading…
Reference in a new issue