cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Joseph Lynch (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (CASSANDRA-15012) token_generator_test.TestTokenGenerator test fails on 2.2
Date Mon, 04 Mar 2019 21:50:00 GMT

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

Joseph Lynch edited comment on CASSANDRA-15012 at 3/4/19 9:49 PM:
------------------------------------------------------------------

Man it's tricky to write py2/py3 compatible code without {{future}} and {{six}} isn't it
haha. Ok, maybe third times the charm:
||2.2||
|Cassandra patch: [6b081698|https://github.com/apache/cassandra/commit/6b0816983bb8e49365187ce7a935e126dfdf9e5f]|
|Cassandra [branch|https://github.com/apache/cassandra/compare/cassandra-2.2...jolynch:CASSANDRA-15012]|
|dtest patch [PR|https://github.com/apache/cassandra-dtest/pull/42]|
|dtest circleci run: [!https://circleci.com/gh/jolynch/cassandra/tree/CASSANDRA-15012.png?circle-token=
1102a59698d04899ec971dd36e925928f7b521f5!|https://circleci.com/gh/jolynch/cassandra/tree/CASSANDRA-15012]|

{noformat}
$ python2 --version
Python 2.7.15rc1

$ python2 tools/bin/token-generator --murmur3
Token Generator Interactive Mode
--------------------------------

 How many datacenters will participate in this Cassandra cluster? 1
 How many nodes are in datacenter #1? 3

DC #1:
  Node #1:  -9223372036854775808
  Node #2:  -3074457345618258603
  Node #3:   3074457345618258602

$ python3 --version
Python 3.6.7

$ python3 tools/bin/token-generator --murmur3
Token Generator Interactive Mode
--------------------------------

 How many datacenters will participate in this Cassandra cluster? 1
 How many nodes are in datacenter #1? 3

DC #1:
  Node #1:  -9223372036854775808
  Node #2:  -3074457345618258603
  Node #3:   3074457345618258602
{noformat}


was (Author: jolynch):
Man it's tricky to write py2/py3 compatible code without {{future}} and {{six}} isn't it
haha. Ok, maybe third times the charm:
||2.2||
|Cassandra patch: [1c28ad23|https://github.com/apache/cassandra/commit/1c28ad235f0ceece4c822283447f2ccf6c73ee8c]|
|Cassandra [branch|https://github.com/apache/cassandra/compare/cassandra-2.2...jolynch:CASSANDRA-15012]|
|dtest patch [PR|https://github.com/apache/cassandra-dtest/pull/42]|
|dtest circleci run: [!https://circleci.com/gh/jolynch/cassandra/tree/CASSANDRA-15012.png?circle-token=
1102a59698d04899ec971dd36e925928f7b521f5!|https://circleci.com/gh/jolynch/cassandra/tree/CASSANDRA-15012]|

{noformat}
$ python2 --version
Python 2.7.15rc1

$ python2 tools/bin/token-generator --murmur3
Token Generator Interactive Mode
--------------------------------

 How many datacenters will participate in this Cassandra cluster? 1
 How many nodes are in datacenter #1? 3

DC #1:
  Node #1:  -9223372036854775808
  Node #2:  -3074457345618258603
  Node #3:   3074457345618258602

$ python3 --version
Python 3.6.7

$ python3 tools/bin/token-generator --murmur3
Token Generator Interactive Mode
--------------------------------

 How many datacenters will participate in this Cassandra cluster? 1
 How many nodes are in datacenter #1? 3

DC #1:
  Node #1:  -9223372036854775808
  Node #2:  -3074457345618258603
  Node #3:   3074457345618258602
{noformat}

> token_generator_test.TestTokenGenerator test fails on 2.2
> ---------------------------------------------------------
>
>                 Key: CASSANDRA-15012
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-15012
>             Project: Cassandra
>          Issue Type: Improvement
>          Components: Test/dtest
>            Reporter: Joseph Lynch
>            Assignee: Joseph Lynch
>            Priority: Minor
>              Labels: beginner, dtest, test
>             Fix For: 2.2.x
>
>         Attachments: --graph output.png, test-output.png
>
>
> While running tests for the 2.2.14 candidate I noticed that the {{TestTokenGenerator}}
dtests are broken. I reproduced locally as well, the issue appears to be that we're running
a python2 script with python3 (since dtests run python3 now).
> Should be a quick fix to make the token generator script py2/3 compatible.
> Example local run:
> {noformat}
> pytest --cassandra-dir=/home/josephl/pg/cassandra_2 -k TestTokenGenerator           
                                                                                         
                                 1 ↵
> ===============================================================================================================
test session starts ================================================================================================================
> platform linux -- Python 3.6.7, pytest-3.6.4, py-1.7.0, pluggy-0.7.1
> rootdir: /home/josephl/pg/cassandra-dtest, inifile: pytest.ini
> plugins: timeout-1.3.3, flaky-3.4.0
> timeout: 900.0s
> timeout method: signal
> timeout func_only: False
> collected 1028 items / 1025 deselected                                              
                                                                                         
                                                                    
> token_generator_test.py FFF                                                         
                                                                                         
                                                              [100%]
> =====================================================================================================================
FAILURES =====================================================================================================================
> _________________________________________________________________________________________________
TestTokenGenerator.test_multi_dc_tokens_default __________________________________________________________________________________________________
> self = <token_generator_test.TestTokenGenerator object at 0x7f5188c7cdd8>
>     def test_multi_dc_tokens_default(self):
> >       self._multi_dc_tokens()
> token_generator_test.py:167: 
> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
> token_generator_test.py:153: in _multi_dc_tokens
>     generated_tokens = self.call_token_generator(self.cluster.get_install_dir(), random,
dc_nodes)
> token_generator_test.py:43: in call_token_generator
>     token_gen_output = subprocess.check_output(args)
> /usr/lib/python3.6/subprocess.py:336: in check_output
>     **kwargs).stdout
> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
> input = None, timeout = None, check = True, popenargs = (['/home/josephl/pg/cassandra_2/tools/bin/token-generator',
'3', '5'],), kwargs = {'stdout': -1}, process = <subprocess.Popen object at 0x7f5188b80208>,
stdout = b'', stderr = None
> retcode = 1
>     def run(*popenargs, input=None, timeout=None, check=False, **kwargs):
>         """Run command with arguments and return a CompletedProcess instance.
>     
>         The returned instance will have attributes args, returncode, stdout and
>         stderr. By default, stdout and stderr are not captured, and those attributes
>         will be None. Pass stdout=PIPE and/or stderr=PIPE in order to capture them.
>     
>         If check is True and the exit code was non-zero, it raises a
>         CalledProcessError. The CalledProcessError object will have the return code
>         in the returncode attribute, and output & stderr attributes if those streams
>         were captured.
>     
>         If timeout is given, and the process takes too long, a TimeoutExpired
>         exception will be raised.
>     
>         There is an optional argument "input", allowing you to
>         pass a string to the subprocess's stdin.  If you use this argument
>         you may not also use the Popen constructor's "stdin" argument, as
>         it will be used internally.
>     
>         The other arguments are the same as for the Popen constructor.
>     
>         If universal_newlines=True is passed, the "input" argument must be a
>         string and stdout/stderr in the returned object will be strings rather than
>         bytes.
>         """
>         if input is not None:
>             if 'stdin' in kwargs:
>                 raise ValueError('stdin and input arguments may not both be used.')
>             kwargs['stdin'] = PIPE
>     
>         with Popen(*popenargs, **kwargs) as process:
>             try:
>                 stdout, stderr = process.communicate(input, timeout=timeout)
>             except TimeoutExpired:
>                 process.kill()
>                 stdout, stderr = process.communicate()
>                 raise TimeoutExpired(process.args, timeout, output=stdout,
>                                      stderr=stderr)
>             except:
>                 process.kill()
>                 process.wait()
>                 raise
>             retcode = process.poll()
>             if check and retcode:
>                 raise CalledProcessError(retcode, process.args,
> >                                        output=stdout, stderr=stderr)
> E               subprocess.CalledProcessError: Command '['/home/josephl/pg/cassandra_2/tools/bin/token-generator',
'3', '5']' returned non-zero exit status 1.
> /usr/lib/python3.6/subprocess.py:418: CalledProcessError
> --------------------------------------------------------------------------------------------------------------
Captured stdout setup ---------------------------------------------------------------------------------------------------------------
> 10:03:31,457 ccm DEBUG Log-watching thread starting.
> ----------------------------------------------------------------------------------------------------------------
Captured log setup ----------------------------------------------------------------------------------------------------------------
> 10:03:31,425 conftest INFO Starting execution of test_multi_dc_tokens_default at 2019-02-05
10:03:31.425612
> 10:03:31,426 dtest_setup INFO cluster ccm directory: /tmp/dtest-89rd87ne
> ---------------------------------------------------------------------------------------------------------------
Captured stderr call ---------------------------------------------------------------------------------------------------------------
>   File "/home/josephl/pg/cassandra_2/tools/bin/token-generator", line 160
>     print "%sDC #%d:" % (indentstr, dcnum + 1)
>                     ^
> SyntaxError: invalid syntax
> -------------------------------------------------------------------------------------------------------------
Captured stdout teardown -------------------------------------------------------------------------------------------------------------
> 10:03:31,708 ccm DEBUG Log-watching thread exiting.
> ...
> ...
> ...
> {noformat}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org


Mime
View raw message