8000 Remove using paramiko by demonolock · Pull Request #89 · postgrespro/testgres · GitHub
[go: up one dir, main page]

Skip to content

Remove using paramiko #89

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

Merged
merged 4 commits into from
Oct 17, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Fixes after review
  • Loading branch information
Viktoria committed Oct 9, 2023
commit a8201c7e03cd0d00b6ad0d5679fe7a6f9bf5bc17
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ the configuration file, which means that they should be called before `append_co
### Remote mode
Testgres supports the creation of PostgreSQL nodes on a remote host. This is useful when you want to run distributed tests involving multiple nodes spread across different machines.

To use this feature, you need to use the RemoteOperations class.
To use this feature, you need to use the RemoteOperations class. This feature is only supported with Linux.
Here is an example of how you might set this up:

```python
Expand Down
8000 7 changes: 5 additions & 2 deletions testgres/operations/local_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,9 +201,12 @@ def touch(self, filename):
def read(self, filename, encoding=None, binary=False):
mode = "rb" if binary else "r"
with open(filename, mode) as file:
content = file.read()
if binary:
return file.read()
return file.read().decode(encoding or 'utf-8')
return content
if isinstance(content, bytes):
return content.decode(encoding or 'utf-8')
return content

def readlines(self, filename, num_lines=0, binary=False, encoding=None):
"""
Expand Down
3 changes: 3 additions & 0 deletions testgres/operations/remote_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ def cmdline(self):

class RemoteOperations(OsOperations):
def __init__(self, conn_params: ConnectionParams):
if os.name != "posix":
raise EnvironmentError("Remote operations are supported only on Linux!")

super().__init__(conn_params.username)
self.conn_params = conn_params
self.host = conn_params.host
Expand Down
0