Details
-
Bug
-
Status: Resolved
-
Low
-
Resolution: Fixed
-
None
-
Correctness
-
Low
-
Low Hanging Fruit
-
User Report
-
All
-
None
-
Description
Error Message failed on teardown with "TypeError: not all arguments converted during string formatting" Stacktrace request = <SubRequest 'fixture_dtest_setup' for <Function test_basic_snapshot_and_restore>> dtest_config = <dtest_config.DTestConfig object at 0x7f27a8053520> fixture_dtest_setup_overrides = <dtest_setup_overrides.DTestSetupOverrides object at 0x7f27a43a6550> fixture_logging_setup = None, fixture_dtest_cluster_name = 'test' fixture_dtest_create_cluster_func = <function DTestSetup.create_ccm_cluster at 0x7f27a81a2790> @pytest.fixture(scope='function', autouse=False) def fixture_dtest_setup(request, dtest_config, fixture_dtest_setup_overrides, fixture_logging_setup, fixture_dtest_cluster_name, fixture_dtest_create_cluster_func): if running_in_docker(): cleanup_docker_environment_before_test_execution() # do all of our setup operations to get the enviornment ready for the actual test # to run (e.g. bring up a cluster with the necessary config, populate variables, etc) initial_environment = copy.deepcopy(os.environ) dtest_setup = DTestSetup(dtest_config=dtest_config, setup_overrides=fixture_dtest_setup_overrides, cluster_name=fixture_dtest_cluster_name) dtest_setup.initialize_cluster(fixture_dtest_create_cluster_func) if not dtest_config.disable_active_log_watching: dtest_setup.begin_active_log_watch() # at this point we're done with our setup operations in this fixture # yield to allow the actual test to run yield dtest_setup # phew! we're back after executing the test, now we need to do # all of our teardown and cleanup operations reset_environment_vars(initial_environment) dtest_setup.jvm_args = [] for con in dtest_setup.connections: con.cluster.shutdown() dtest_setup.connections = [] failed = False try: if not dtest_setup.allow_log_errors: errors = check_logs_for_errors(dtest_setup) if len(errors) > 0: failed = True pytest.fail('Unexpected error found in node logs (see stdout for full details). Errors: [{errors}]' .format(errors=str.join(", ", errors)), pytrace=False) finally: try: # save the logs for inspection if failed or not dtest_config.delete_logs: > copy_logs(request, dtest_setup.cluster) conftest.py:371: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ conftest.py:291: in copy_logs shutil.copyfile(file, os.path.join(logdir, target_name)) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ src = '/home/cassandra/cassandra/build/run-python-dtest.PRhg7u/dtest-pqe8_k2h/test/node1/logs/gc.log' dst = 'logs/1708958581606_test_basic_snapshot_and_restore/node1_gc.log' def copyfile(src, dst, *, follow_symlinks=True): """Copy data from src to dst in the most efficient way possible. If follow_symlinks is not set and src is a symbolic link, a new symlink will be created instead of copying the file it points to. """ sys.audit("shutil.copyfile", src, dst) if _samefile(src, dst): raise SameFileError("{!r} and {!r} are the same file".format(src, dst)) file_size = 0 for i, fn in enumerate([src, dst]): try: st = _stat(fn) except OSError: # File most likely does not exist pass else: # XXX What about other special files? (sockets, devices...) if stat.S_ISFIFO(st.st_mode): fn = fn.path if isinstance(fn, os.DirEntry) else fn raise SpecialFileError("`%s` is a named pipe" % fn) if _WINDOWS and i == 0: file_size = st.st_size if not follow_symlinks and _islink(src): os.symlink(os.readlink(src), dst) else: > with open(src, 'rb') as fsrc, open(dst, 'wb') as fdst: E FileNotFoundError: [Errno 2] No such file or directory: '/home/cassandra/cassandra/build/run-python-dtest.PRhg7u/dtest-pqe8_k2h/test/node1/logs/gc.log' /usr/lib/python3.8/shutil.py:264: FileNotFoundError During handling of the above exception, another exception occurred: request = <SubRequest 'fixture_dtest_setup' for <Function test_basic_snapshot_and_restore>> dtest_config = <dtest_config.DTestConfig object at 0x7f27a8053520> fixture_dtest_setup_overrides = <dtest_setup_overrides.DTestSetupOverrides object at 0x7f27a43a6550> fixture_logging_setup = None, fixture_dtest_cluster_name = 'test' fixture_dtest_create_cluster_func = <function DTestSetup.create_ccm_cluster at 0x7f27a81a2790> @pytest.fixture(scope='function', autouse=False) def fixture_dtest_setup(request, dtest_config, fixture_dtest_setup_overrides, fixture_logging_setup, fixture_dtest_cluster_name, fixture_dtest_create_cluster_func): if running_in_docker(): cleanup_docker_environment_before_test_execution() # do all of our setup operations to get the enviornment ready for the actual test # to run (e.g. bring up a cluster with the necessary config, populate variables, etc) initial_environment = copy.deepcopy(os.environ) dtest_setup = DTestSetup(dtest_config=dtest_config, setup_overrides=fixture_dtest_setup_overrides, cluster_name=fixture_dtest_cluster_name) dtest_setup.initialize_cluster(fixture_dtest_create_cluster_func) if not dtest_config.disable_active_log_watching: dtest_setup.begin_active_log_watch() # at this point we're done with our setup operations in this fixture # yield to allow the actual test to run yield dtest_setup # phew! we're back after executing the test, now we need to do # all of our teardown and cleanup operations reset_environment_vars(initial_environment) dtest_setup.jvm_args = [] for con in dtest_setup.connections: con.cluster.shutdown() dtest_setup.connections = [] failed = False try: if not dtest_setup.allow_log_errors: errors = check_logs_for_errors(dtest_setup) if len(errors) > 0: failed = True pytest.fail('Unexpected error found in node logs (see stdout for full details). Errors: [{errors}]' .format(errors=str.join(", ", errors)), pytrace=False) finally: try: # save the logs for inspection if failed or not dtest_config.delete_logs: copy_logs(request, dtest_setup.cluster) except Exception as e: > logger.error("Error saving log:", str(e)) conftest.py:373: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /usr/lib/python3.8/logging/__init__.py:1475: in error self._log(ERROR, msg, args, **kwargs) /usr/lib/python3.8/logging/__init__.py:1589: in _log self.handle(record) /usr/lib/python3.8/logging/__init__.py:1599: in handle self.callHandlers(record) /usr/lib/python3.8/logging/__init__.py:1661: in callHandlers hdlr.handle(record) /usr/lib/python3.8/logging/__init__.py:954: in handle self.emit(record) /usr/lib/python3.8/logging/__init__.py:1093: in emit self.handleError(record) /usr/lib/python3.8/logging/__init__.py:1085: in emit msg = self.format(record) /usr/lib/python3.8/logging/__init__.py:929: in format return fmt.format(record) /usr/lib/python3.8/logging/__init__.py:668: in format record.message = record.getMessage() _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <LogRecord: conftest, 40, /home/cassandra/cassandra-dtest/conftest.py, 373, "Error saving log:"> def getMessage(self): """ Return the message for this LogRecord. Return the message for this LogRecord after merging any user-supplied arguments with the message. """ msg = str(self.msg) if self.args: > msg = msg % self.args E TypeError: not all arguments converted during string formatting /usr/lib/python3.8/logging/__init__.py:373: TypeError