Bug #2821
closedosmotestvty.py fails when run with python3
100%
Description
======================================================================
ERROR: test_unknown_command (main.TestVTY)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/max/source/gsm/osmo-python-tests/scripts/osmotestvty.py", line 62, in test_unknown_command
assert(self.vty.verify(test_str, ['% Unknown command.']))
File "/home/max/source/gsm/osmo-python-tests/osmopy/obscvty.py", line 245, in verify
res = self.command(command, close).split('\r\n')
File "/home/max/source/gsm/osmo-python-tests/osmopy/obscvty.py", line 223, in command
return self._common_command(request, close)
File "/home/max/source/gsm/osmo-python-tests/osmopy/obscvty.py", line 179, in _common_command
self.socket.send("%s\r" % request)
TypeError: a bytes-like object is required, not 'str'
The error is observed with osmo-msc, osmo-bts etc.
Updated by msuraev about 6 years ago
- Status changed from New to In Progress
- % Done changed from 0 to 10
Workaround is available in https://gerrit.osmocom.org/#/c/5677/
The proper fix would be to either migrate to python 3 only code or make it compatible with both python 2 and 3.
Updated by msuraev about 6 years ago
- % Done changed from 10 to 50
Workaround is merged, additional related fix is available in gerrit 5777.
Updated by msuraev about 6 years ago
- % Done changed from 50 to 60
Gerrit 5791 and 5793 should resolve remaining issues.
Updated by msuraev about 6 years ago
- % Done changed from 60 to 80
Fixes were merged, there's still weird issue with osmo-pcu where one of the vty tests fails in semingly random fashion. Not sure if it's related or why it's only observed with osmo-pcu jenkins tests.
Updated by msuraev about 6 years ago
The failure looks as follows:
test_unknown_command (__main__.TestVTY) ... ok ====================================================================== ERROR: test_history (__main__.TestVTY) ---------------------------------------------------------------------- Traceback (most recent call last): File "/usr/local/lib/python2.7/dist-packages/osmopython-0.0.9-py2.7.egg/EGG-INFO/scripts/osmotestvty.py", line 56, in test_history File "build/bdist.linux-x86_64/egg/osmopy/obscvty.py", line 223, in command return self._common_command(request, close) File "build/bdist.linux-x86_64/egg/osmopy/obscvty.py", line 185, in _common_command data = self.socket.recv(4096) error: [Errno 104] Connection reset by peer
or
test_unknown_command (__main__.TestVTY) ... ok ====================================================================== ERROR: test_history (__main__.TestVTY) ---------------------------------------------------------------------- Traceback (most recent call last): File "/usr/local/lib/python2.7/dist-packages/osmopython-0.0.9-py2.7.egg/EGG-INFO/scripts/osmotestvty.py", line 56, in test_history File "build/bdist.linux-x86_64/egg/osmopy/obscvty.py", line 223, in command return self._common_command(request, close) File "build/bdist.linux-x86_64/egg/osmopy/obscvty.py", line 188, in _common_command raise IOError("Failed to read data (did the app crash?)") IOError: Failed to read data (did the app crash?)
It could be that this is result of some sort of installation artefact from previous update. One solution we could try is to use pip for installing it instead of setup.py: the latter does not have proper uninstall command which makes much harder to ensure clean installation.
Updated by msuraev about 6 years ago
The update to containers with pip install is sent in gerrit 5852. Once it's installed inside buildslaves as well (which has to be done manually unfortunately) I'll send patch with updated osmo-python-tests installation.
Updated by msuraev about 6 years ago
Gerrit 5859 fixed the issue - the problem was in parallel test execution used by default in config. matrix.
Updated by msuraev about 6 years ago
- Status changed from In Progress to Resolved
- % Done changed from 80 to 100