8000 adding key -F to pg_dump by Fenimorkin · Pull Request #32 · postgrespro/testgres · GitHub
[go: up one dir, main page]

Skip to content

adding key -F to pg_dump #32

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 13 commits into from
May 8, 2018
Prev Previous commit
Next Next commit
Fix merge conficts
  • Loading branch information
Fenimorkin committed Apr 28, 2018
commit 5f35452826872e797248e765350d899e0a59bf10
8 changes: 5 additions & 3 deletions testgres/consts.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@

# name of dump/restore formates
DUMP_DIRECTORY = "directory"

# default argument values
DEFAULT_XLOG_METHOD = "fetch"
DEFAULT_DUMP_FORMAT = "plain"

# defaults for node settings
MAX_REPLICATION_SLOTS = 10
MAX_WAL_SENDERS = 10
WAL_KEEP_SEGMENTS = 20
26 changes: 19 additions & 7 deletions testgres/node.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,23 @@
RECOVERY_CONF_FILE, \
PG_LOG_FILE, \
UTILS_LOG_FILE, \
DEFAULT_XLOG_METHOD, \
DEFAULT_DUMP_FORMAT, \
DUMP_DIRECTORY
DUMP_DIRECTORY, \
PG_PID_FILE

from .consts import \
MAX_WAL_SENDERS, \
MAX_REPLICATION_SLOTS, \
WAL_KEEP_SEGMENTS

from .decorators import \
method_decorator, \
positional_args_hack

from .defaults import \
default_dbname, \
default_username, \
generate_app_name

from .exceptions import \
CatchUpException, \
Expand Down Expand Up @@ -808,9 +822,9 @@ def dump(self, filename=None, dbname=None, username=None, format=DEFAULT_DUMP_FO

def tmpfile():
if format == DUMP_DIRECTORY:
fname = tempfile.mkdtemp()
fname = mkdtemp(prefix=TMP_DUMP)
else:
fd, fname = tempfile.mkstemp()
fd, fname = mkstemp(prefix=TMP_DUMP)
os.close(fd)
return fname

Expand All @@ -819,8 +833,6 @@ def tmpfile():
username = username or default_username()
filename = filename or tmpfile()


# yapf: disable
_params = [
get_bin_path("pg_dump"),
"-p", str(self.port),
Expand All @@ -829,7 +841,7 @@ def tmpfile():
"-U", username,
"-d", dbname,
"-F", format
]
] # yapf: disable

execute_utility(_params, self.utils_log_file)

Expand Down
2 changes: 1 addition & 1 deletion tests/test_simple.py
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ def test_dump(self):
node5.restore(filename=dump)
res = node5.execute(query_select)
self.assertListEqual(res, [(1, ), (2, )])
shutil.rmtree(dump, ignore_errors=True)
rmtree(dump, ignore_errors=True)

# take a new dump tar format
dump = node1.dump(format='tar')
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.
0