torproject / stem

Python controller library for Tor
https://stem.torproject.org/
GNU Lesser General Public License v3.0
279 stars 76 forks source link

Some unit tests are failing in CentOS 8 #71

Closed jorti closed 4 years ago

jorti commented 4 years ago

Hello,

The following tests are failing in CentOS 8. They pass fine in Fedora.

Let me know if you need any other information.

+ /usr/bin/python3.6 run_tests.py --unit
======================================================================
                             INITIALISING                             
======================================================================
  stem version...                            1.8.0
  python version...                          3.6.8
  operating system...                        Linux (Red Hat Enterprise Linux 8.2)
  cryptography version...                    2.3
  mock version...                            1.0
  pyflakes version...                        2.1.1
  pycodestyle version...                     2.5.0
  checking for orphaned .pyc files...        done (0.0s)
  checking for unused tests...               done (0.0s)
  importing test modules...                  done (0.8s)
  running pyflakes...                        running
  running pycodestyle...                     running
======================================================================
                              UNIT TESTS                              
======================================================================
  util.enum...                                         success (0.00s)
  util.connection...                                   success (0.07s)
  util.conf...                                         success (0.00s)
  util.log...                                          success (0.00s)
  util.proc...                                         failed (0.08s)
test_connections                                       1 ms  [SUCCESS]
test_connections_ipv6                                        [FAILURE]
test_connections_ipv6_by_user                                [FAILURE]
test_cwd                                               0 ms  [SUCCESS]
test_file_descriptors_used                             0 ms  [SUCCESS]
test_high_connection_count                                   [FAILURE]
test_memory_usage                                      0 ms  [SUCCESS]
test_physical_memory                                   0 ms  [SUCCESS]
test_stats                                            20 ms  [SUCCESS]
test_system_start_time                                 0 ms  [SUCCESS]
test_uid                                               0 ms  [SUCCESS]
======================================================================
FAIL: test_connections_ipv6
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib64/python3.6/unittest/mock.py", line 1183, in patched
    return func(*args, **keywargs)
  File "/builddir/build/BUILD/stem-1.8.0/test/unit/util/proc.py", line 277, in test_connections_ipv6
    self.assertEqual(expected, proc.connections(pid = pid))
AssertionError: Lists differ: [Conn[17 chars]ess='2a01:04f8:0190:514a:0000:0000:0000:0002',[311 chars]rue)] != [Conn[17 chars]ess='f804:012a:4a51:9001:0000:0000:0200:0000',[311 chars]rue)]
First differing element 0:
Conne[16 chars]ess='2a01:04f8:0190:514a:0000:0000:0000:0002',[118 chars]True)
Conne[16 chars]ess='f804:012a:4a51:9001:0000:0000:0200:0000',[118 chars]True)
Diff is 1347 characters long. Set self.maxDiff to None to see it.
======================================================================
FAIL: test_connections_ipv6_by_user
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib64/python3.6/unittest/mock.py", line 1183, in patched
    return func(*args, **keywargs)
  File "/builddir/build/BUILD/stem-1.8.0/test/unit/util/proc.py", line 306, in test_connections_ipv6_by_user
    self.assertEqual(expected, proc.connections(user = 'me'))
AssertionError: Lists differ: [Conn[37 chars]0000:0000:ffff:0509:9e4b', local_port=5222, re[486 chars]rue)] != [Conn[37 chars]0000:ffff:0000:4b9e:0905', local_port=5222, re[486 chars]rue)]
First differing element 0:
Conne[36 chars]0000:0000:ffff:0509:9e4b', local_port=5222, re[99 chars]True)
Conne[36 chars]0000:ffff:0000:4b9e:0905', local_port=5222, re[99 chars]True)
Diff is 2042 characters long. Set self.maxDiff to None to see it.
======================================================================
FAIL: test_high_connection_count
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib64/python3.6/unittest/mock.py", line 1183, in patched
    return func(*args, **keywargs)
  File "/builddir/build/BUILD/stem-1.8.0/test/unit/util/proc.py", line 348, in test_high_connection_count
    self.assertEqual(expected, proc.connections(pid))
AssertionError: Lists differ: [Conn[64 chars]ess='51.34.34.34', remote_port=8772, protocol=[294 chars]lse)] != [Conn[64 chars]ess='34.34.34.51', remote_port=8772, protocol=[294 chars]lse)]
First differing element 0:
Conne[63 chars]ess='51.34.34.34', remote_port=8772, protocol=[16 chars]alse)
Conne[63 chars]ess='34.34.34.51', remote_port=8772, protocol=[16 chars]alse)
Diff is 1358 characters long. Set self.maxDiff to None to see it.
----------------------------------------------------------------------
Ran 11 tests in 0.080s
FAILED (failures=3)
  util.str_tools...                                    success (0.00s)
  util.system...                                       success (0.01s)
  util.term...                                         success (0.00s)
  util.tor_tools...                                    success (0.00s)
  util.__init__...                                     success (0.00s)
  installation...                                      success (0.00s)
  descriptor.descriptor...                             success (0.00s)
  descriptor.compression...                            success (0.00s)
  descriptor.export...                                 success (0.00s)
  descriptor.reader...                                 success (0.04s)
  descriptor.collector...                              success (0.70s)
  descriptor.remote...                                 success (0.18s)
  descriptor.server_descriptor...                      success (0.06s)
  descriptor.extrainfo_descriptor...                   success (0.05s)
  descriptor.microdescriptor...                        success (0.00s)
  descriptor.router_status_entry...                    success (0.02s)
  descriptor.tordnsel...                               success (0.00s)
  descriptor.networkstatus.detached_signature...       success (0.00s)
  descriptor.networkstatus.directory_authority...      success (0.01s)
  descriptor.networkstatus.key_certificate...          success (0.01s)
  descriptor.networkstatus.document_v2...              success (0.00s)
  descriptor.networkstatus.document_v3...              success (0.08s)
  descriptor.networkstatus.bridge_document...          success (0.00s)
  descriptor.hidden_service_v2...                      success (0.01s)
  descriptor.hidden_service_v3...                      success (0.01s)
  descriptor.certificate...                            success (0.00s)
  descriptor.bandwidth_file...                         success (0.01s)
  exit_policy.rule...                                  success (0.01s)
  exit_policy.policy...                                success (0.04s)
  endpoint...                                          success (0.00s)
  version...                                           success (0.00s)
  manual...                                            success (0.01s)
  directory.authority...                               success (0.00s)
  directory.fallback...                                success (0.02s)
  tutorial...                                          success (0.01s)
  tutorial_examples...                                 success (0.02s)
  response.add_onion...                                success (0.00s)
  response.control_message...                          success (0.00s)
  response.control_line...                             success (0.00s)
  response.events...                                   success (0.02s)
  response.getinfo...                                  success (0.00s)
  response.getconf...                                  success (0.00s)
  response.singleline...                               success (0.00s)
  response.authchallenge...                            success (0.00s)
  response.protocolinfo...                             success (0.00s)
  response.mapaddress...                               success (0.00s)
  client.size...                                       success (0.00s)
  client.address...                                    success (0.00s)
  client.link_protocol...                              success (0.00s)
  client.certificate...                                success (0.00s)
  client.link_specifier...                             success (0.00s)
  client.kdf...                                        success (0.00s)
  client.cell...                                       success (0.01s)
  connection.authentication...                         success (0.05s)
  connection.connect...                                success (0.00s)
  control.controller...                                success (0.29s)
  interpreter.arguments...                             success (0.01s)
  interpreter.autocomplete...                          success (0.00s)
  interpreter.help...                                  success (0.00s)
  interpreter.commands...                              success (0.01s)
  doctest...                                           success (0.06s)
STATIC CHECKS
* /builddir/build/BUILD/stem-1.8.0/stem/util/ed25519.py
  line 59   - undefined name 'xrange'                  | range = xrange
TESTING FAILED (10 seconds)
  [UNIT TEST] test_connections_ipv6 (test.unit.util.proc.TestProc) ... FAIL
  [UNIT TEST] test_connections_ipv6_by_user (test.unit.util.proc.TestProc) ... FAIL
  [UNIT TEST] test_high_connection_count (test.unit.util.proc.TestProc) ... FAIL
You can re-run just these tests with:
  run_tests.py --unit --test util.proc
atagar commented 4 years ago

Great catch Juan! Fix pushed...

https://gitweb.torproject.org/stem.git/commit/?id=b31551f

I'm surprised this is the first time we've ran our unit tests on a big-endian system. :P

Feel free to reopen if you need anything else.

jorti commented 4 years ago

Then it's not something CentOS-specific. The RPM build process failed because it happened to run in a s390x machine: https://koji.fedoraproject.org/koji/taskinfo?taskID=48524443

Thanks for the fix!