Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix elevated teardown. #111

Open
danuker opened this issue May 28, 2021 · 0 comments
Open

Fix elevated teardown. #111

danuker opened this issue May 28, 2021 · 0 comments

Comments

@danuker
Copy link
Contributor

danuker commented May 28, 2021

On some systems (found on Ubuntu 18.04), compat creates a temporary folder as a superuser ("test user"), but at teardown tries to delete it as the "developer user" (with no permissions).

Here is a failure on a Ubuntu 18.04.4 VM in KVM:

dan@dan-Standard-PC-Q35-ICH9-2009:/share/server$ ./brink.sh test_loop 10 elevated.functional -vx
---> pavement.test_loop
---> pavement.build
::group::Paver build
Cleaning orphaned files in /share/server/build-server
Cleaning orphaned files in chevah/server
cd /share/server/build-server
Skipping current directory
Listing /share/server/build-server ...
Listing /share/server/build-server/lib/python27.zip ...
Can't list /share/server/build-server/lib/python27.zip
Listing /share/server/build-server/lib/python2.7 ...
Listing /share/server/build-server/lib/python2.7/plat-linux2 ...
Listing /share/server/build-server/lib/python2.7/lib-tk ...
Listing /share/server/build-server/lib/python2.7/lib-old ...
Can't list /share/server/build-server/lib/python2.7/lib-old
Listing /share/server/build-server/lib/python2.7/lib-dynload ...
Listing /share/server/build-server/lib/python2.7/site-packages ...
Listing /share/server/build-server/lib/python2.7/site-packages/cffi-1.14.5-py2.7-linux-x86_64.egg ...
cd /share/server
---> brink.pavement_commons.coverage_prepare
::endgroup::
--------------------------------------------------
| Running 0
--------------------------------------------------
---> brink.pavement_commons.test_python
---> brink.pavement_commons.test_super
cd /share/server/build-server
sudo CODECOV_TOKEN=*** bin/python bin/nose_runner.py dan chevah.server.tests.elevated.functional -vx
test_change_folder - elevated.functional.test_ftp_commands:TestControlChannelFTP.test_change_folder ... ok
test_create_delete_folder - elevated.functional.test_ftp_commands:TestControlChannelFTP.test_create_delete_folder ... ok
test_create_folder_over_file - elevated.functional.test_ftp_commands:TestControlChannelFTP.test_create_folder_over_file ... ok
test_delete_file - elevated.functional.test_ftp_commands:TestControlChannelFTP.test_delete_file ... ok
test_delete_file_non_existent - elevated.functional.test_ftp_commands:TestControlChannelFTP.test_delete_file_non_existent ... ok
test_delete_folder_non_existent - elevated.functional.test_ftp_commands:TestControlChannelFTP.test_delete_folder_non_existent ... ok
test_get_current_working_folder - elevated.functional.test_ftp_commands:TestControlChannelFTP.test_get_current_working_folder ... ok
test_get_file_size - elevated.functional.test_ftp_commands:TestControlChannelFTP.test_get_file_size ... ok
test_get_modified_date - elevated.functional.test_ftp_commands:TestControlChannelFTP.test_get_modified_date ... ok
test_get_modified_date_non_existent - elevated.functional.test_ftp_commands:TestControlChannelFTP.test_get_modified_date_non_existent ... ok
test_rename_empty_destination - elevated.functional.test_ftp_commands:TestControlChannelFTP.test_rename_empty_destination ... ok
test_rename_empty_source - elevated.functional.test_ftp_commands:TestControlChannelFTP.test_rename_empty_source ... ok
test_rename_file - elevated.functional.test_ftp_commands:TestControlChannelFTP.test_rename_file ... ok
test_rename_folder - elevated.functional.test_ftp_commands:TestControlChannelFTP.test_rename_folder ... ok
test_rename_non_existent - elevated.functional.test_ftp_commands:TestControlChannelFTP.test_rename_non_existent ... ok
test_rename_only_spaces_destination - elevated.functional.test_ftp_commands:TestControlChannelFTP.test_rename_only_spaces_destination ... ok
test_rename_only_spaces_source - elevated.functional.test_ftp_commands:TestControlChannelFTP.test_rename_only_spaces_source ... ok
test_change_folder - elevated.functional.test_ftp_commands:TestControlChannelFTPS.test_change_folder ... ERROR
ERROR

======================================================================
ERROR: test_change_folder - elevated.functional.test_ftp_commands:TestControlChannelFTPS.test_change_folder
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/share/server/chevah/server/testing/functional.py", line 147, in setUp
    self.startService()
  File "/share/server/chevah/server/testing/functional.py", line 408, in startService
    message="start the service",
  File "/share/server/chevah/server/testing/functional.py", line 435, in _waitWithTimeout
    self._events_queue,
AssertionError: Failed to start the service as quick as it should in 15 seconds.
deque([Event:0x7fe2fac7d550:20033
a-{"peer": {"protocol": "TCP", "port": 0, "family": "IPv4", "address": "0.0.0.0"}, "uuid": "Process", "name": "Process"}

{"reason": "No reason.", "details": "Traceback: <class 'chevah.server.commons.exception.ServerError'>: <ServerError instance at 0x7fe2faaeffa0 with str error:\n Traceback (most recent call last):\n  File \"/share/server/build-server/lib/python2.7/site-packages/twisted/python/reflect.py\", line 448, in safe_str\n    return str(o)\n  File \"/share/server/chevah/server/commons/exception.py\", line 65, in __str__\n    return self.__repr__()\n  File \"/share/server/chevah/server/commons/exception.py\", line 62, in __repr__\n    self._repr, ''.join(traceback.format_stack())))\nRuntimeError: Use _repr if you need debug serialization.\n20032\n{'details': u\"[('SSL routines', 'SSL_CTX_set_session_id_context', 'ssl session id context too long')]\", 'cert': u'test_data/pki/server-cert-and-key-2048.pem', 'ca': None, 'key': u'', 'crl': ()}\n  File \"/share/server/build-server/lib/python2.7/threading.py\", line 774, in __bootstrap\n    self.__bootstrap_inner()\n  File \"/share/server/build-server/lib/python2.7/threading.py\", line 801, in __bootstrap_inner\n    self.run()\n  File \"/share/server/build-server/lib/python2.7/threading.py\", line 754, in run\n    self.__target(*self.__args, **self.__kwargs)\n  File \"/share/server/chevah/server/testing/threaded_reactor.py\", line 29, in reactor_run\n    _reactor.run(installSignalHandlers=False)\n  File \"/share/server/build-server/lib/python2.7/site-packages/twisted/internet/base.py\", line 1283, in run\n    self.mainLoop()\n  File \"/share/server/build-server/lib/python2.7/site-packages/twisted/internet/base.py\", line 1292, in mainLoop\n    self.runUntilCurrent()\n  File \"/share/server/build-server/lib/python2.7/site-packages/twisted/internet/base.py\", line 888, in runUntilCurrent\n    log.err()\n  File \"/share/server/build-server/lib/python2.7/site-packages/twisted/python/log.py\", line 134, in err\n    msg(failure=_stuff, why=_why, isError=1, **kw)\n  File \"/share/server/build-server/lib/python2.7/site-packages/twisted/python/threadable.py\", line 53, in sync\n    return function(self, *args, **kwargs)\n  File \"/share/server/build-server/lib/python2.7/site-packages/twisted/python/log.py\", line 286, in msg\n    _publishNew(self._publishPublisher, actualEventDict, textFromEventDict)\n  File \"/share/server/build-server/lib/python2.7/site-packages/twisted/logger/_legacy.py\", line 154, in publishToNewObserver\n    observer(eventDict)\n  File \"/share/server/build-server/lib/python2.7/site-packages/twisted/logger/_observer.py\", line 131, in __call__\n    observer(event)\n  File \"/share/server/build-server/lib/python2.7/site-packages/twisted/logger/_legacy.py\", line 93, in __call__\n    self.legacyObserver(event)\n  File \"/share/server/chevah/server/side_effects.py\", line 105, in _handle_twisted_log\n    details = force_unicode(failure.getBriefTraceback())\n  File \"/share/server/build-server/lib/python2.7/site-packages/twisted/python/failure.py\", line 659, in getBriefTraceback\n    self.printBriefTraceback(file=io)\n  File \"/share/server/build-server/lib/python2.7/site-packages/twisted/python/failure.py\", line 744, in printBriefTraceback\n    self.printTraceback(file, elideFrameworkCode, detail='brief')\n  File \"/share/server/build-server/lib/python2.7/site-packages/twisted/python/failure.py\", line 712, in printTraceback\n    reflect.safe_str(self.value)))\n  File \"/share/server/build-server/lib/python2.7/site-packages/twisted/python/reflect.py\", line 448, in safe_str\n    return str(o)\n  File \"/share/server/chevah/server/commons/exception.py\", line 65, in __str__\n    return self.__repr__()\n  File \"/share/server/chevah/server/commons/exception.py\", line 62, in __repr__\n    self._repr, ''.join(traceback.format_stack())))\n\n>\n/share/server/build-server/lib/python2.7/threading.py:754:run\n/share/server/chevah/server/testing/threaded_reactor.py:29:reactor_run\n/share/server/build-server/lib/python2.7/site-packages/twisted/internet/base.py:1283:run\n/share/server/build-server/lib/python2.7/site-packages/twisted/internet/base.py:1292:mainLoop\n--- <exception caught here> ---\n/share/server/build-server/lib/python2.7/site-packages/twisted/internet/base.py:886:runUntilCurrent\n/share/server/chevah/server/testing/functional.py:401:start_listening_from_thread\n/share/server/build-server/lib/python2.7/site-packages/twisted/internet/posixbase.py:495:listenTCP\n/share/server/build-server/lib/python2.7/site-packages/twisted/internet/tcp.py:1406:startListening\n/share/server/build-server/lib/python2.7/site-packages/twisted/internet/protocol.py:77:doStart\n/share/server/chevah/server/commons/factory.py:207:startFactory\n/share/server/chevah/server/commons/ssl.py:1135:_configureSSL\n/share/server/chevah/server/commons/ssl.py:351:__init__\n", "avatar": {"peer": {"protocol": "TCP", "port": 0, "family": "IPv4", "address": "0.0.0.0"}, "uuid": "Process", "name": "Process"}}

c-{"type": "process-component", "name": "Process", "uuid": "Process"})])

======================================================================
ERROR: test suite for <module 'chevah.server.tests.elevated.functional' from '/share/server/chevah/server/tests/elevated/functional/__init__.py'>
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/share/server/build-server/lib/python2.7/site-packages/nose/suite.py", line 227, in run
    self.tearDown()
  File "/share/server/build-server/lib/python2.7/site-packages/nose/suite.py", line 356, in tearDown
    self.teardownContext(ancestor)
  File "/share/server/build-server/lib/python2.7/site-packages/nose/suite.py", line 376, in teardownContext
    try_run(context, names)
  File "/share/server/build-server/lib/python2.7/site-packages/nose/util.py", line 507, in try_run
    return func()
  File "/share/server/chevah/server/tests/__init__.py", line 78, in teardown_package
    mk.fs.checkCleanTemporaryFolders()
  File "/share/server/build-server/lib/python2.7/site-packages/chevah/compat/testing/filesystem.py", line 58, in checkCleanTemporaryFolders
    self.deleteFolder(temp, recursive=True)
  File "/share/server/build-server/lib/python2.7/site-packages/chevah/compat/unix_filesystem.py", line 226, in deleteFolder
    return self._rmtree(path_encoded)
  File "/share/server/build-server/lib/python2.7/site-packages/chevah/compat/posix_filesystem.py", line 440, in _rmtree
    shutil.rmtree(path, ignore_errors=False, onerror=on_error)
  File "/share/server/build-server/lib/python2.7/shutil.py", line 279, in rmtree
    onerror(os.rmdir, path, sys.exc_info())
  File "/share/server/build-server/lib/python2.7/shutil.py", line 277, in rmtree
    os.rmdir(path)
OSError: [Errno 1] Operation not permitted: '/tmp/f90d036c-b855-4113-887a-7b1aca3ab1f0-Cp\xc8\x9b'

----------------------------------------------------------------------
Ran 18 tests in 21.999s

FAILED (errors=2)
Max RSS: 133028
Exit code is: 1
cd /share/server
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant