Skip to content

Commit b4e17e1

Browse files
committed
[create_archive_push] archive_push_command in testgres_pg_probackup added
1 parent 70d2f27 commit b4e17e1

File tree

1 file changed

+23
-0
lines changed
  • testgres/plugins/pg_probackup2/pg_probackup2

1 file changed

+23
-0
lines changed

testgres/plugins/pg_probackup2/pg_probackup2/app.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -748,5 +748,28 @@ def load_backup_class(fs_type):
748748

749749
return getattr(module, class_name)
750750

751+
def archive_push(self, instance, node, wal_file_name, wal_file_path=None, options=None, expect_error=False):
752+
if options is None:
753+
options = []
754+
cmd = [
755+
'archive-push',
756+
'--instance={0}'.format(instance),
757+
'--wal-file-name={0}'.format(wal_file_name),
758+
]
759+
if wal_file_path is None:
760+
cmd = cmd + ['--wal-file-path={0}'.format(os.path.join(node.data_dir, 'pg_wal'))]
761+
return self.run(cmd + options, expect_error=expect_error)
762+
763+
764+
# Local or S3 backup
765+
fs_backup_class = FSTestBackupDir
766+
if os.environ.get('PG_PROBACKUP_S3_TEST', os.environ.get('PROBACKUP_S3_TYPE_FULL_TEST')):
767+
root = os.path.realpath(os.path.join(os.path.dirname(__file__), '../..'))
768+
if root not in sys.path:
769+
sys.path.append(root)
770+
from pg_probackup2.storage.s3_backup import S3TestBackupDir
771+
772+
fs_backup_class = S3TestBackupDir
773+
751774
def build_backup_dir(self, backup='backup'):
752775
return fs_backup_class(rel_path=self.rel_path, backup=backup)

0 commit comments

Comments
 (0)