def test_create_cmd_args_aof_without_rdb_preamble(self): port = 8000 aof_std_env = StandardEnv(redisBinaryPath=REDIS_BINARY, outputFilesFormat='%s-test', useAof=True, useRdbPreamble=False, port=8000) role = 'master' cmd_args = aof_std_env.createCmdArgs(role) assert [ REDIS_BINARY, '--port', '{}'.format(port), '--logfile', aof_std_env._getFileName(role, '.log'), '--dbfilename', aof_std_env._getFileName(role, '.rdb'), '--appendonly', 'yes', '--appendfilename', aof_std_env._getFileName(role, '.aof'), '--aof-use-rdb-preamble', 'no' ] == cmd_args
def test_create_cmd_args_default(self): std_env = StandardEnv(redisBinaryPath=REDIS_BINARY, outputFilesFormat='%s-test') role = 'master' cmd_args = std_env.createCmdArgs(role) assert [ REDIS_BINARY, '--port', '6379', '--logfile', std_env._getFileName(role, '.log'), '--dbfilename', std_env._getFileName(role, '.rdb') ] == cmd_args
def test_create_cmd_args_tls(self): port = 8000 tls_std_env = StandardEnv(redisBinaryPath=REDIS_BINARY, outputFilesFormat='%s-test', useTLS=True, tlsCertFile=os.path.join(self.test_dir, tlsCertFile), tlsKeyFile=os.path.join(self.test_dir, tlsKeyFile), tlsCaCertFile=os.path.join(self.test_dir, tlsCaCertFile), port=8000) role = 'master' cmd_args = tls_std_env.createCmdArgs(role) assert [REDIS_BINARY, '--port', '0', '--tls-port', '{}'.format(port), '--logfile', tls_std_env._getFileName(role, '.log'), '--dbfilename', tls_std_env._getFileName(role, '.rdb'), '--tls-cert-file', os.path.join(self.test_dir, tlsCertFile), '--tls-key-file', os.path.join(self.test_dir, tlsKeyFile), '--tls-ca-cert-file', os.path.join(self.test_dir, tlsCaCertFile)] == cmd_args
def test_create_cmd_args_modules_one_module_array(self): port = 8000 temp = tempfile.TemporaryFile() directory_name = tempfile.mkdtemp() temp_file = tempfile.NamedTemporaryFile(dir=directory_name) module_std_env = StandardEnv(redisBinaryPath=REDIS_BINARY, outputFilesFormat='%s-test', port=port, modulePath=[temp_file.name], moduleArgs=["P1 V1 P2 V2"]) role = 'master' cmd_args = module_std_env.createCmdArgs(role) assert [ REDIS_BINARY, '--port', '{}'.format(port), '--loadmodule', temp_file.name, 'P1', 'V1', 'P2', 'V2', '--logfile', module_std_env._getFileName(role, '.log'), '--dbfilename', module_std_env._getFileName(role, '.rdb') ] == cmd_args shutil.rmtree(directory_name)