Project

General

Profile

Bug #2821

osmotestvty.py fails when run with python3

Added by msuraev 6 months ago. Updated 6 months ago.

Status:
Resolved
Priority:
Normal
Assignee:
Target version:
-
Start date:
01/08/2018
Due date:
% Done:

100%

Estimated time:
Spec Reference:

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.


Related issues

Related to Osmocom.org Servers - Feature #2502: reproducible / automatic build slave generationResolved2017-09-07

History

#1 Updated by msuraev 6 months 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.

#2 Updated by msuraev 6 months ago

  • % Done changed from 10 to 50

Workaround is merged, additional related fix is available in gerrit 5777.

#3 Updated by msuraev 6 months ago

  • % Done changed from 50 to 60

Gerrit 5791 and 5793 should resolve remaining issues.

#4 Updated by msuraev 6 months 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.

#5 Updated by msuraev 6 months 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.

#6 Updated by msuraev 6 months 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.

#7 Updated by msuraev 6 months ago

  • Related to Feature #2502: reproducible / automatic build slave generation added

#8 Updated by msuraev 6 months ago

Gerrit 5859 fixed the issue - the problem was in parallel test execution used by default in config. matrix.

#9 Updated by msuraev 6 months ago

  • Status changed from In Progress to Resolved
  • % Done changed from 80 to 100

Also available in: Atom PDF

Add picture from clipboard (Maximum size: 48.8 MB)