Skip to content

Commit 071f108

Browse files
committed
Merge branch 'master' into abs-backup-path
2 parents 7a341bf + 70d2f27 commit 071f108

File tree

5 files changed

+18
-162
lines changed

5 files changed

+18
-162
lines changed

testgres/connection.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -104,13 +104,13 @@ def rollback(self):
104104
def execute(self, query, *args):
105105
self.cursor.execute(query, args)
106106
try:
107-
res = self.cursor.fetchall()
108107
# pg8000 might return tuples
109-
if isinstance(res, tuple):
110-
res = [tuple(t) for t in res]
111-
108+
res = [tuple(t) for t in self.cursor.fetchall()]
112109
return res
113-
except Exception:
110+
except ProgrammingError:
111+
return None
112+
except Exception as e:
113+
print("Error executing query: {}\n {}".format(repr(e), query))
114114
return None
115115

116116
def close(self):

testgres/plugins/__init__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
from pg_probackup2.app import ProbackupApp, ProbackupException
33
from pg_probackup2.init_helpers import init_params
44
from pg_probackup2.storage.fs_backup import FSTestBackupDir
5-
from pg_probackup2.storage.s3_backup import S3TestBackupDir
65

76
__all__ = [
8-
"ProbackupApp", "ProbackupException", "init_params", "FSTestBackupDir", "S3TestBackupDir", "GDBobj"
7+
"ProbackupApp", "ProbackupException", "init_params", "FSTestBackupDir", "GDBobj"
98
]

testgres/plugins/pg_probackup2/pg_probackup2/app.py

Lines changed: 11 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import os
55
import re
66
import subprocess
7-
import sys
87
import threading
98
import time
109
import unittest
@@ -37,6 +36,10 @@ def __str__(self):
3736
return '\n ERROR: {0}\n CMD: {1}'.format(repr(self.message), self.cmd)
3837

3938

39+
# Local backup control
40+
fs_backup_class = FSTestBackupDir
41+
42+
4043
class ProbackupApp:
4144

4245
def __init__(self, test_class: unittest.TestCase,
@@ -189,15 +192,13 @@ def set_backup(self, instance, backup_id=False,
189192

190193
return self.run(cmd + options, old_binary=old_binary, expect_error=expect_error)
191194

192-
def del_instance(self, instance, old_binary=False, expect_error=False):
193-
194-
return self.run([
195-
'del-instance',
196-
'--instance={0}'.format(instance),
197-
],
198-
old_binary=old_binary,
199-
expect_error=expect_error
200-
)
195+
def del_instance(self, instance, options=None, old_binary=False, expect_error=False):
196+
if options is None:
197+
options = []
198+
cmd = ['del-instance', '--instance={0}'.format(instance)] + options
199+
return self.run(cmd,
200+
old_binary=old_binary,
201+
expect_error=expect_error)
201202

202203
def backup_node(
203204
self, instance, node, data_dir=False,
@@ -747,16 +748,5 @@ def load_backup_class(fs_type):
747748

748749
return getattr(module, class_name)
749750

750-
751-
# Local or S3 backup
752-
fs_backup_class = FSTestBackupDir
753-
if os.environ.get('PG_PROBACKUP_S3_TEST', os.environ.get('PROBACKUP_S3_TYPE_FULL_TEST')):
754-
root = os.path.realpath(os.path.join(os.path.dirname(__file__), '../..'))
755-
if root not in sys.path:
756-
sys.path.append(root)
757-
from pg_probackup2.storage.s3_backup import S3TestBackupDir
758-
759-
fs_backup_class = S3TestBackupDir
760-
761751
def build_backup_dir(self, backup='backup'):
762752
return fs_backup_class(rel_path=self.rel_path, backup=backup)

testgres/plugins/pg_probackup2/pg_probackup2/init_helpers.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ def __init__(self):
5252
parts[0] = re.match(r'\d+', parts[0]).group()
5353
self.pg_config_version = reduce(lambda v, x: v * 100 + int(x), parts, 0)
5454

55+
os.environ['LANGUAGE'] = 'en' # set default locale language to en. All messages will use this locale
5556
test_env = os.environ.copy()
5657
envs_list = [
5758
'LANGUAGE',

testgres/plugins/pg_probackup2/pg_probackup2/storage/s3_backup.py

Lines changed: 0 additions & 134 deletions
This file was deleted.

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy