[ 
https://issues.apache.org/jira/browse/CASSANDRA-11799?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15294133#comment-15294133
 ] 

Michael Shuler commented on CASSANDRA-11799:
--------------------------------------------

We finally figured out how to reproduce this. When using {{--with-xunit}} and 
we {{| tee -a logfile}}, this is when we expose the problem.

All looks fine locally:
{noformat}
$ nosetests --with-xunit -vs 
cqlsh_tests/cqlsh_tests.py:TestCqlsh.test_unicode_invalid_request_error 
cqlsh_tests/cqlsh_tests.py:TestCqlsh.test_unicode_syntax_error
test_unicode_invalid_request_error (cqlsh_tests.cqlsh_tests.TestCqlsh) ... (EE) 
 <stdin>:2:InvalidRequest: code=2200 [Invalid query] message=""ä" is not a 
valid keyspace name"(EE)  ok
test_unicode_syntax_error (cqlsh_tests.cqlsh_tests.TestCqlsh) ... (EE)  
<stdin>:2:Invalid syntax at char 1(EE)  <stdin>:2:  ä;(EE)  <stdin>:2:  ^(EE)  
ok

----------------------------------------------------------------------
XML: /home/mshuler/git/cassandra-dtest/nosetests.xml
----------------------------------------------------------------------
Ran 2 tests in 24.650s

OK
{noformat}

Pipe to tee and we repro the problem in CI:
{noformat}
$ nosetests --with-xunit -vs 
cqlsh_tests/cqlsh_tests.py:TestCqlsh.test_unicode_invalid_request_error 
cqlsh_tests/cqlsh_tests.py:TestCqlsh.test_unicode_syntax_error | tee -a logfile
test_unicode_invalid_request_error (cqlsh_tests.cqlsh_tests.TestCqlsh) ... (EE) 
 ERROR
test_unicode_syntax_error (cqlsh_tests.cqlsh_tests.TestCqlsh) ... (EE)  
<stdin>:2:Invalid syntax at char 1(EE)  ERROR

======================================================================
ERROR: test_unicode_invalid_request_error (cqlsh_tests.cqlsh_tests.TestCqlsh)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/mshuler/git/cassandra-dtest/cqlsh_tests/cqlsh_tests.py", line 
476, in test_unicode_invalid_request_error
    output, err = node1.run_cqlsh(cmds=cmd, return_output=True)
  File "/home/mshuler/git/ccm/ccmlib/node.py", line 816, in run_cqlsh
    print_("(EE) ", err, end='')
  File "/usr/lib/python2.7/dist-packages/nose/plugins/xunit.py", line 126, in 
write
    s.write(data)
  File "/usr/lib/python2.7/dist-packages/nose/plugins/xunit.py", line 126, in 
write
    s.write(data)
  File "/usr/lib/python2.7/dist-packages/nose/plugins/xunit.py", line 126, in 
write
    s.write(data)
  File "/usr/lib/python2.7/dist-packages/nose/plugins/xunit.py", line 126, in 
write
    s.write(data)
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe4' in position 
62: ordinal not in range(128)
-------------------- >> begin captured logging << --------------------
dtest: DEBUG: cluster ccm directory: /tmp/dtest-Wvh3PT
dtest: DEBUG: Custom init_config not found. Setting defaults.
dtest: DEBUG: Done setting configuration options:
{   'initial_token': None,
    'num_tokens': '256',
    'phi_convict_threshold': 5,
    'range_request_timeout_in_ms': 10000,
    'read_request_timeout_in_ms': 10000,
    'request_timeout_in_ms': 10000,
    'truncate_request_timeout_in_ms': 10000,
    'write_request_timeout_in_ms': 10000}
--------------------- >> end captured logging << ---------------------

======================================================================
ERROR: test_unicode_syntax_error (cqlsh_tests.cqlsh_tests.TestCqlsh)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/mshuler/git/cassandra-dtest/cqlsh_tests/cqlsh_tests.py", line 
456, in test_unicode_syntax_error
    output, err = node1.run_cqlsh(cmds=u"ä;".encode('utf8'), return_output=True)
  File "/home/mshuler/git/ccm/ccmlib/node.py", line 816, in run_cqlsh
    print_("(EE) ", err, end='')
  File "/usr/lib/python2.7/dist-packages/nose/plugins/xunit.py", line 126, in 
write
    s.write(data)
  File "/usr/lib/python2.7/dist-packages/nose/plugins/xunit.py", line 126, in 
write
    s.write(data)
  File "/usr/lib/python2.7/dist-packages/nose/plugins/xunit.py", line 126, in 
write
    s.write(data)
  File "/usr/lib/python2.7/dist-packages/nose/plugins/xunit.py", line 126, in 
write
    s.write(data)
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe4' in position 
12: ordinal not in range(128)
-------------------- >> begin captured logging << --------------------
dtest: DEBUG: cluster ccm directory: /tmp/dtest-lh6EEU
dtest: DEBUG: Custom init_config not found. Setting defaults.
dtest: DEBUG: Done setting configuration options:
{   'initial_token': None,
    'num_tokens': '256',
    'phi_convict_threshold': 5,
    'range_request_timeout_in_ms': 10000,
    'read_request_timeout_in_ms': 10000,
    'request_timeout_in_ms': 10000,
    'truncate_request_timeout_in_ms': 10000,
    'write_request_timeout_in_ms': 10000}
--------------------- >> end captured logging << ---------------------

----------------------------------------------------------------------
XML: /home/mshuler/git/cassandra-dtest/nosetests.xml
----------------------------------------------------------------------
Ran 2 tests in 24.832s

FAILED (errors=2)
{noformat}

Workaround is to {{export PYTHONIOENCODING='utf-8'}} and pipe to tee:
{noformat}
$ export PYTHONIOENCODING='utf-8'
$ nosetests --with-xunit -vs 
cqlsh_tests/cqlsh_tests.py:TestCqlsh.test_unicode_invalid_request_error 
cqlsh_tests/cqlsh_tests.py:TestCqlsh.test_unicode_syntax_error | tee -a logfile
test_unicode_invalid_request_error (cqlsh_tests.cqlsh_tests.TestCqlsh) ... (EE) 
 <stdin>:2:InvalidRequest: code=2200 [Invalid query] message=""ä" is not a 
valid keyspace name"(EE)  ok
test_unicode_syntax_error (cqlsh_tests.cqlsh_tests.TestCqlsh) ... (EE)  
<stdin>:2:Invalid syntax at char 1(EE)  <stdin>:2:  ä;(EE)  <stdin>:2:  ^(EE)  
ok

----------------------------------------------------------------------
XML: /home/mshuler/git/cassandra-dtest/nosetests.xml
----------------------------------------------------------------------
Ran 2 tests in 25.611s

OK
{noformat}



> dtest failure in cqlsh_tests.cqlsh_tests.TestCqlsh.test_unicode_syntax_error
> ----------------------------------------------------------------------------
>
>                 Key: CASSANDRA-11799
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-11799
>             Project: Cassandra
>          Issue Type: Test
>            Reporter: Philip Thompson
>            Assignee: Tyler Hobbs
>              Labels: cqlsh, dtest
>             Fix For: 2.2.x, 3.0.x, 3.x
>
>
> example failure:
> http://cassci.datastax.com/job/cassandra-3.0_dtest/703/testReport/cqlsh_tests.cqlsh_tests/TestCqlsh/test_unicode_syntax_error
> Failed on CassCI build cassandra-3.0_dtest #703
> Also failing is 
> cqlsh_tests.cqlsh_tests.TestCqlsh.test_unicode_invalid_request_error
> The relevant failure is
> {code}
> 'ascii' codec can't encode character u'\xe4' in position 12: ordinal not in 
> range(128)
> {code}
> These are failing on 2.2, 3.0 and trunk.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to