testgres-pg-probackup2 0.0.2__tar.gz → 0.0.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {testgres_pg_probackup2-0.0.2 → testgres_pg_probackup2-0.0.3}/PKG-INFO +1 -1
- {testgres_pg_probackup2-0.0.2 → testgres_pg_probackup2-0.0.3}/pg_probackup2/app.py +27 -6
- {testgres_pg_probackup2-0.0.2 → testgres_pg_probackup2-0.0.3}/pg_probackup2/init_helpers.py +6 -0
- {testgres_pg_probackup2-0.0.2 → testgres_pg_probackup2-0.0.3}/setup.py +1 -1
- {testgres_pg_probackup2-0.0.2 → testgres_pg_probackup2-0.0.3}/testgres_pg_probackup2.egg-info/PKG-INFO +1 -1
- {testgres_pg_probackup2-0.0.2 → testgres_pg_probackup2-0.0.3}/README.md +0 -0
- {testgres_pg_probackup2-0.0.2 → testgres_pg_probackup2-0.0.3}/pg_probackup2/__init__.py +0 -0
- {testgres_pg_probackup2-0.0.2 → testgres_pg_probackup2-0.0.3}/pg_probackup2/gdb.py +0 -0
- {testgres_pg_probackup2-0.0.2 → testgres_pg_probackup2-0.0.3}/pg_probackup2/storage/__init__.py +0 -0
- {testgres_pg_probackup2-0.0.2 → testgres_pg_probackup2-0.0.3}/pg_probackup2/storage/fs_backup.py +0 -0
- {testgres_pg_probackup2-0.0.2 → testgres_pg_probackup2-0.0.3}/setup.cfg +0 -0
- {testgres_pg_probackup2-0.0.2 → testgres_pg_probackup2-0.0.3}/testgres_pg_probackup2.egg-info/SOURCES.txt +0 -0
- {testgres_pg_probackup2-0.0.2 → testgres_pg_probackup2-0.0.3}/testgres_pg_probackup2.egg-info/dependency_links.txt +0 -0
- {testgres_pg_probackup2-0.0.2 → testgres_pg_probackup2-0.0.3}/testgres_pg_probackup2.egg-info/requires.txt +0 -0
- {testgres_pg_probackup2-0.0.2 → testgres_pg_probackup2-0.0.3}/testgres_pg_probackup2.egg-info/top_level.txt +0 -0
|
@@ -56,6 +56,7 @@ class ProbackupApp:
|
|
|
56
56
|
self.verbose = init_params.verbose
|
|
57
57
|
self.archive_compress = init_params.archive_compress
|
|
58
58
|
self.test_class.output = None
|
|
59
|
+
self.execution_time = None
|
|
59
60
|
|
|
60
61
|
def run(self, command, gdb=False, old_binary=False, return_id=True, env=None,
|
|
61
62
|
skip_log_directory=False, expect_error=False, use_backup_dir=True):
|
|
@@ -113,16 +114,17 @@ class ProbackupApp:
|
|
|
113
114
|
cmdline = ['gdbserver'] + ['localhost:' + str(gdb_port)] + cmdline
|
|
114
115
|
print("pg_probackup gdb suspended, waiting gdb connection on localhost:{0}".format(gdb_port))
|
|
115
116
|
|
|
117
|
+
start_time = time.time()
|
|
116
118
|
self.test_class.output = subprocess.check_output(
|
|
117
119
|
cmdline,
|
|
118
120
|
stderr=subprocess.STDOUT,
|
|
119
121
|
env=env
|
|
120
122
|
).decode('utf-8', errors='replace')
|
|
123
|
+
end_time = time.time()
|
|
124
|
+
self.execution_time = end_time - start_time
|
|
125
|
+
|
|
121
126
|
if command[0] == 'backup' and return_id:
|
|
122
|
-
|
|
123
|
-
for line in self.test_class.output.splitlines():
|
|
124
|
-
if 'INFO: Backup' and 'completed' in line:
|
|
125
|
-
result = line.split()[2]
|
|
127
|
+
result = self.get_backup_id()
|
|
126
128
|
else:
|
|
127
129
|
result = self.test_class.output
|
|
128
130
|
if expect_error is True:
|
|
@@ -139,6 +141,19 @@ class ProbackupApp:
|
|
|
139
141
|
else:
|
|
140
142
|
raise ProbackupException(self.test_class.output, self.test_class.cmd)
|
|
141
143
|
|
|
144
|
+
def get_backup_id(self):
|
|
145
|
+
if init_params.major_version > 2:
|
|
146
|
+
pattern = re.compile(r"Backup (.*) completed successfully.")
|
|
147
|
+
for line in self.test_class.output.splitlines():
|
|
148
|
+
match = pattern.search(line)
|
|
149
|
+
if match:
|
|
150
|
+
return match.group(1)
|
|
151
|
+
else:
|
|
152
|
+
for line in self.test_class.output.splitlines():
|
|
153
|
+
if 'INFO: Backup' and 'completed' in line:
|
|
154
|
+
return line.split()[2]
|
|
155
|
+
return None
|
|
156
|
+
|
|
142
157
|
def init(self, options=None, old_binary=False, skip_log_directory=False, expect_error=False, use_backup_dir=True):
|
|
143
158
|
if options is None:
|
|
144
159
|
options = []
|
|
@@ -149,13 +164,19 @@ class ProbackupApp:
|
|
|
149
164
|
use_backup_dir=use_backup_dir
|
|
150
165
|
)
|
|
151
166
|
|
|
152
|
-
def add_instance(self, instance, node, old_binary=False, options=None, expect_error=False):
|
|
167
|
+
def add_instance(self, instance, node, old_binary=False, options=None, expect_error=False, datname=False):
|
|
153
168
|
if options is None:
|
|
154
169
|
options = []
|
|
170
|
+
|
|
171
|
+
if not datname:
|
|
172
|
+
datname = 'postgres'
|
|
173
|
+
|
|
155
174
|
cmd = [
|
|
156
175
|
'add-instance',
|
|
157
176
|
'--instance={0}'.format(instance),
|
|
158
|
-
'-D', node.data_dir
|
|
177
|
+
'-D', node.data_dir,
|
|
178
|
+
'--pgport', '%i' % node.port,
|
|
179
|
+
'--pgdatabase', datname
|
|
159
180
|
]
|
|
160
181
|
|
|
161
182
|
# don`t forget to kill old_binary after remote ssh release
|
|
@@ -204,6 +204,12 @@ class Init(object):
|
|
|
204
204
|
os.environ["PGAPPNAME"] = "pg_probackup"
|
|
205
205
|
self.delete_logs = delete_logs
|
|
206
206
|
|
|
207
|
+
if self.probackup_version.split('.')[0].isdigit():
|
|
208
|
+
self.major_version = int(self.probackup_version.split('.')[0])
|
|
209
|
+
else:
|
|
210
|
+
print('Can\'t process pg_probackup version \"{}\": the major version is expected to be a number'.format(self.probackup_version))
|
|
211
|
+
sys.exit(1)
|
|
212
|
+
|
|
207
213
|
def test_env(self):
|
|
208
214
|
return self._test_env.copy()
|
|
209
215
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{testgres_pg_probackup2-0.0.2 → testgres_pg_probackup2-0.0.3}/pg_probackup2/storage/__init__.py
RENAMED
|
File without changes
|
{testgres_pg_probackup2-0.0.2 → testgres_pg_probackup2-0.0.3}/pg_probackup2/storage/fs_backup.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|