@@ -461,6 +461,79 @@ def _crush_location_checker(ctx, ident, container, uid, gid, **kwargs):
461461 _cephadm .command_deploy_from (ctx )
462462 _deploy_daemon .assert_called ()
463463
464+ def test_rgw_exit_timeout (self , funkypatch ):
465+ """
466+ test that rgw exit timeout secs is set properly
467+ """
468+ funkypatch .patch ('cephadm.logger' )
469+ funkypatch .patch ('cephadm.FileLock' )
470+ _deploy_daemon = funkypatch .patch ('cephadm.deploy_daemon' )
471+ funkypatch .patch ('cephadm.make_var_run' )
472+ funkypatch .patch ('cephadmlib.file_utils.make_run_dir' )
473+ funkypatch .patch ('os.mkdir' )
474+ _migrate_sysctl = funkypatch .patch ('cephadm.migrate_sysctl_dir' )
475+ funkypatch .patch (
476+ 'cephadm.check_unit' ,
477+ dest = lambda * args , ** kwargs : (None , 'running' , None ),
478+ )
479+ funkypatch .patch (
480+ 'cephadm.get_unit_name' ,
481+ dest = lambda * args , ** kwargs : 'mon-unit-name' ,
482+ )
483+ funkypatch .patch (
484+ 'cephadm.extract_uid_gid' , dest = lambda * args , ** kwargs : (0 , 0 )
485+ )
486+ _get_container = funkypatch .patch ('cephadm.get_container' )
487+ funkypatch .patch (
488+ 'cephadm.apply_deploy_config_to_ctx' , dest = lambda d , c : None
489+ )
490+ _fetch_configs = funkypatch .patch (
491+ 'cephadmlib.context_getters.fetch_configs'
492+ )
493+ funkypatch .patch (
494+ 'cephadm.read_configuration_source' , dest = lambda c : {}
495+ )
496+ funkypatch .patch ('cephadm.fetch_custom_config_files' )
497+
498+ ctx = _cephadm .CephadmContext ()
499+ ctx .name = 'rgw.foo.test.abcdef'
500+ ctx .fsid = 'b66e5288-d8ea-11ef-b953-525400f9646d'
501+ ctx .reconfig = False
502+ ctx .container_engine = mock_docker ()
503+ ctx .allow_ptrace = True
504+ ctx .config_json = '-'
505+ ctx .osd_fsid = '0'
506+ ctx .tcp_ports = '3300 6789'
507+ _fetch_configs .return_value = {
508+ 'rgw_exit_timeout_secs' : 200
509+ }
510+
511+ _get_container .return_value = _cephadm .CephContainer .for_daemon (
512+ ctx ,
513+ ident = _cephadm .DaemonIdentity (
514+ fsid = 'b66e5288-d8ea-11ef-b953-525400f9646d' ,
515+ daemon_type = 'rgw' ,
516+ daemon_id = 'foo.test.abcdef' ,
517+ ),
518+ entrypoint = '' ,
519+ args = [],
520+ container_args = [],
521+ volume_mounts = {},
522+ bind_mounts = [],
523+ envs = [],
524+ privileged = False ,
525+ ptrace = False ,
526+ host_network = True ,
527+ )
528+
529+ def _exit_timeout_secs_checker (ctx , ident , container , uid , gid , ** kwargs ):
530+ argval = ' ' .join (container .args )
531+ assert '--stop-timeout=200' in argval
532+
533+ _deploy_daemon .side_effect = _exit_timeout_secs_checker
534+ _cephadm .command_deploy_from (ctx )
535+ _deploy_daemon .assert_called ()
536+
464537 @mock .patch ('cephadm.logger' )
465538 @mock .patch ('cephadm.fetch_custom_config_files' )
466539 def test_write_custom_conf_files (self , _get_config , _logger , cephadm_fs ):
0 commit comments