Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/remote_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -832,7 +832,7 @@ def _create_exec_env_list(exec_env: typing.Dict) -> typing.List[str]:
assert type(envvar[1]) == str # noqa: E721
qvalue = __class__._quote_envvar(envvar[1])
assert type(qvalue) == str # noqa: E721
result.append(envvar[0] + "=" + qvalue)
result.append("export " + envvar[0] + "=" + qvalue)
continue

return result
Expand Down
38 changes: 38 additions & 0 deletions tests/test_os_ops_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,44 @@ def test_exec_command_with_exec_env(self, os_ops: OsOperations):
assert type(response) == bytes # noqa: E721
assert response == b'\n'

def test_exec_command_with_exec_env__2(self, os_ops: OsOperations):
assert isinstance(os_ops, OsOperations)

RunConditions.skip_if_windows()

C_ENV_NAME = "TESTGRES_TEST__EXEC_ENV_20250414"

tmp_file_content = "echo ${{{}}}".format(C_ENV_NAME)

logging.info("content is [{}]".format(tmp_file_content))

tmp_file = os_ops.mkstemp()
assert type(tmp_file) == str # noqa: E721
assert tmp_file != ""

logging.info("file is [{}]".format(tmp_file))
assert os_ops.path_exists(tmp_file)

os_ops.write(tmp_file, tmp_file_content)

cmd = ["sh", tmp_file]

exec_env = {C_ENV_NAME: "Hello!"}

response = os_ops.exec_command(cmd, exec_env=exec_env)
assert response is not None
assert type(response) == bytes # noqa: E721
assert response == b'Hello!\n'

response = os_ops.exec_command(cmd)
assert response is not None
assert type(response) == bytes # noqa: E721
assert response == b'\n'

os_ops.remove_file(tmp_file)
assert not os_ops.path_exists(tmp_file)
return

def test_exec_command_with_cwd(self, os_ops: OsOperations):
assert isinstance(os_ops, OsOperations)

Expand Down