mirror of
https://github.com/postgrespro/pg_probackup.git
synced 2024-11-28 09:33:54 +02:00
tests minor fixes
This commit is contained in:
parent
49a8575456
commit
88b2742972
@ -2,8 +2,6 @@ import unittest
|
||||
import os
|
||||
from time import sleep
|
||||
from .helpers.ptrack_helpers import ProbackupTest, ProbackupException
|
||||
from testgres import stop_all, clean_all
|
||||
import shutil
|
||||
|
||||
|
||||
class BackupTest(ProbackupTest, unittest.TestCase):
|
||||
|
@ -1,9 +1,7 @@
|
||||
import unittest
|
||||
import os
|
||||
from .helpers.ptrack_helpers import ProbackupTest, ProbackupException
|
||||
from testgres import stop_all, clean_all
|
||||
import subprocess
|
||||
import shutil
|
||||
|
||||
|
||||
class DeleteTest(ProbackupTest, unittest.TestCase):
|
||||
|
@ -2,9 +2,7 @@ import unittest
|
||||
import os
|
||||
from .helpers.ptrack_helpers import ProbackupTest, ProbackupException
|
||||
from datetime import datetime, timedelta
|
||||
from testgres import stop_all, clean_all
|
||||
import subprocess
|
||||
import shutil
|
||||
|
||||
|
||||
class FalsePositive(ProbackupTest, unittest.TestCase):
|
||||
|
@ -1,10 +1,6 @@
|
||||
import unittest
|
||||
from sys import exit
|
||||
import os
|
||||
from os import path
|
||||
import unittest
|
||||
from .helpers.ptrack_helpers import dir_files, ProbackupTest, ProbackupException
|
||||
from testgres import stop_all, clean_all
|
||||
import shutil
|
||||
|
||||
|
||||
class InitTest(ProbackupTest, unittest.TestCase):
|
||||
@ -67,7 +63,7 @@ class InitTest(ProbackupTest, unittest.TestCase):
|
||||
backup_dir = os.path.join(self.tmp_path, self.module_name, fname, 'backup')
|
||||
node = self.make_simple_node(base_dir="{0}/{1}/node".format(self.module_name, fname))
|
||||
try:
|
||||
self.run_pb(["init", "-B", path.relpath("%s/backup" % node.base_dir, self.dir_path)])
|
||||
self.run_pb(["init", "-B", os.path.relpath("%s/backup" % node.base_dir, self.dir_path)])
|
||||
self.assertEqual(1, 0, 'Expecting Error due to initialization with non-absolute path in --backup-path. Output: {0} \n CMD: {1}'.format(
|
||||
repr(self.output), self.cmd))
|
||||
except ProbackupException as e:
|
||||
|
@ -1,8 +1,6 @@
|
||||
import unittest
|
||||
import os
|
||||
from .helpers.ptrack_helpers import ProbackupTest, ProbackupException
|
||||
from testgres import stop_all, clean_all
|
||||
import shutil
|
||||
|
||||
|
||||
class OptionTest(ProbackupTest, unittest.TestCase):
|
||||
|
@ -2,9 +2,7 @@ import os
|
||||
import unittest
|
||||
from .helpers.ptrack_helpers import ProbackupTest, ProbackupException, idx_ptrack
|
||||
from datetime import datetime, timedelta
|
||||
from testgres import stop_all, clean_all
|
||||
import subprocess
|
||||
import shutil
|
||||
|
||||
|
||||
class CheckSystemID(ProbackupTest, unittest.TestCase):
|
||||
|
@ -2,9 +2,7 @@ import os
|
||||
import unittest
|
||||
from .helpers.ptrack_helpers import ProbackupTest, ProbackupException, idx_ptrack
|
||||
from datetime import datetime, timedelta
|
||||
from testgres import stop_all, clean_all
|
||||
import subprocess
|
||||
import shutil
|
||||
|
||||
|
||||
class ArchiveCheck(ProbackupTest, unittest.TestCase):
|
||||
|
@ -1,8 +1,6 @@
|
||||
import os
|
||||
import unittest
|
||||
from testgres import stop_all, clean_all
|
||||
from .helpers.ptrack_helpers import ProbackupTest, idx_ptrack
|
||||
import shutil
|
||||
|
||||
|
||||
class SimpleTest(ProbackupTest, unittest.TestCase):
|
||||
|
@ -1,8 +1,6 @@
|
||||
import os
|
||||
import unittest
|
||||
from testgres import stop_all, clean_all
|
||||
from .helpers.ptrack_helpers import ProbackupTest, idx_ptrack
|
||||
import shutil
|
||||
|
||||
|
||||
class SimpleTest(ProbackupTest, unittest.TestCase):
|
||||
|
@ -1,8 +1,6 @@
|
||||
import os
|
||||
import unittest
|
||||
from testgres import clean_all, stop_all
|
||||
from .helpers.ptrack_helpers import ProbackupTest, idx_ptrack
|
||||
import shutil
|
||||
|
||||
|
||||
class SimpleTest(ProbackupTest, unittest.TestCase):
|
||||
@ -10,11 +8,6 @@ class SimpleTest(ProbackupTest, unittest.TestCase):
|
||||
super(SimpleTest, self).__init__(*args, **kwargs)
|
||||
self.module_name = 'ptrack_move_to_tablespace'
|
||||
|
||||
# @classmethod
|
||||
# def tearDownClass(cls):
|
||||
# clean_all()
|
||||
# shutil.rmtree(os.path.join(self.tmp_path, self.module_name), ignore_errors=True)
|
||||
|
||||
# @unittest.skip("skip")
|
||||
# @unittest.expectedFailure
|
||||
def test_ptrack_recovery(self):
|
||||
|
@ -1,9 +1,7 @@
|
||||
import os
|
||||
import unittest
|
||||
from sys import exit
|
||||
from testgres import clean_all, stop_all
|
||||
from .helpers.ptrack_helpers import ProbackupTest, idx_ptrack
|
||||
import shutil
|
||||
|
||||
|
||||
class SimpleTest(ProbackupTest, unittest.TestCase):
|
||||
|
@ -1,8 +1,6 @@
|
||||
import os
|
||||
import unittest
|
||||
from testgres import stop_all, clean_all
|
||||
from .helpers.ptrack_helpers import ProbackupTest, idx_ptrack
|
||||
import shutil
|
||||
|
||||
|
||||
class SimpleTest(ProbackupTest, unittest.TestCase):
|
||||
@ -10,11 +8,6 @@ class SimpleTest(ProbackupTest, unittest.TestCase):
|
||||
super(SimpleTest, self).__init__(*args, **kwargs)
|
||||
self.module_name = 'ptrack_vacuum'
|
||||
|
||||
# @classmethod
|
||||
# def tearDownClass(cls):
|
||||
# clean_all()
|
||||
# shutil.rmtree(os.path.join(self.tmp_path, self.module_name), ignore_errors=True)
|
||||
|
||||
# @unittest.skip("skip")
|
||||
# @unittest.expectedFailure
|
||||
def test_ptrack_vacuum(self):
|
||||
|
@ -1,8 +1,6 @@
|
||||
import os
|
||||
import unittest
|
||||
from testgres import stop_all, clean_all
|
||||
from .helpers.ptrack_helpers import ProbackupTest, idx_ptrack
|
||||
import shutil
|
||||
|
||||
|
||||
class SimpleTest(ProbackupTest, unittest.TestCase):
|
||||
@ -10,11 +8,6 @@ class SimpleTest(ProbackupTest, unittest.TestCase):
|
||||
super(SimpleTest, self).__init__(*args, **kwargs)
|
||||
self.module_name = 'ptrack_vacuum_bits_frozen'
|
||||
|
||||
# @classmethod
|
||||
# def tearDownClass(cls):
|
||||
# clean_all()
|
||||
# shutil.rmtree(os.path.join(self.tmp_path, self.module_name), ignore_errors=True)
|
||||
|
||||
# @unittest.skip("skip")
|
||||
# @unittest.expectedFailure
|
||||
def test_ptrack_vacuum_bits_frozen(self):
|
||||
|
@ -1,8 +1,6 @@
|
||||
import os
|
||||
import unittest
|
||||
from testgres import stop_all, clean_all
|
||||
from .helpers.ptrack_helpers import ProbackupTest, idx_ptrack
|
||||
import shutil
|
||||
|
||||
|
||||
class SimpleTest(ProbackupTest, unittest.TestCase):
|
||||
@ -10,11 +8,6 @@ class SimpleTest(ProbackupTest, unittest.TestCase):
|
||||
super(SimpleTest, self).__init__(*args, **kwargs)
|
||||
self.module_name = 'ptrack_vacuum_bits_visibility'
|
||||
|
||||
# @classmethod
|
||||
# def tearDownClass(cls):
|
||||
# clean_all()
|
||||
# shutil.rmtree(os.path.join(self.tmp_path, self.module_name), ignore_errors=True)
|
||||
|
||||
# @unittest.skip("skip")
|
||||
# @unittest.expectedFailure
|
||||
def test_ptrack_vacuum_bits_visibility(self):
|
||||
|
@ -1,8 +1,6 @@
|
||||
import os
|
||||
import unittest
|
||||
from testgres import stop_all, clean_all
|
||||
from .helpers.ptrack_helpers import ProbackupTest, idx_ptrack
|
||||
import shutil
|
||||
|
||||
|
||||
class SimpleTest(ProbackupTest, unittest.TestCase):
|
||||
|
@ -1,8 +1,6 @@
|
||||
import os
|
||||
import unittest
|
||||
from testgres import stop_all, clean_all
|
||||
from .helpers.ptrack_helpers import ProbackupTest, idx_ptrack
|
||||
import shutil
|
||||
|
||||
|
||||
class SimpleTest(ProbackupTest, unittest.TestCase):
|
||||
@ -10,11 +8,6 @@ class SimpleTest(ProbackupTest, unittest.TestCase):
|
||||
super(SimpleTest, self).__init__(*args, **kwargs)
|
||||
self.module_name = 'ptrack_vacuum_truncate'
|
||||
|
||||
# @classmethod
|
||||
# def tearDownClass(self):
|
||||
# clean_all()
|
||||
# shutil.rmtree(os.path.join(self.tmp_path, self.module_name), ignore_errors=True)
|
||||
|
||||
# @unittest.skip("skip")
|
||||
# @unittest.expectedFailure
|
||||
def test_ptrack_vacuum_truncate(self):
|
||||
|
@ -1,12 +1,8 @@
|
||||
import unittest
|
||||
import os
|
||||
import unittest
|
||||
from .helpers.ptrack_helpers import ProbackupTest, ProbackupException, idx_ptrack
|
||||
from datetime import datetime, timedelta
|
||||
from testgres import stop_all, clean_all
|
||||
import subprocess
|
||||
from sys import exit
|
||||
import time
|
||||
import shutil
|
||||
|
||||
|
||||
class ReplicaTest(ProbackupTest, unittest.TestCase):
|
||||
@ -15,11 +11,6 @@ class ReplicaTest(ProbackupTest, unittest.TestCase):
|
||||
super(ReplicaTest, self).__init__(*args, **kwargs)
|
||||
self.module_name = 'replica'
|
||||
|
||||
# @classmethod
|
||||
# def tearDownClass(cls):
|
||||
# clean_all()
|
||||
# shutil.rmtree(os.path.join(self.tmp_path, self.module_name), ignore_errors=True)
|
||||
|
||||
# @unittest.skip("skip")
|
||||
# @unittest.expectedFailure
|
||||
def test_replica_stream_full_backup(self):
|
||||
|
@ -1,10 +1,8 @@
|
||||
import unittest
|
||||
import os
|
||||
import unittest
|
||||
from .helpers.ptrack_helpers import ProbackupTest, ProbackupException
|
||||
from testgres import stop_all, clean_all
|
||||
import subprocess
|
||||
from datetime import datetime
|
||||
from sys import exit
|
||||
|
||||
|
||||
class RestoreTest(ProbackupTest, unittest.TestCase):
|
||||
|
@ -1,10 +1,7 @@
|
||||
import unittest
|
||||
import os
|
||||
import unittest
|
||||
from datetime import datetime, timedelta
|
||||
from os import path, listdir
|
||||
from .helpers.ptrack_helpers import ProbackupTest
|
||||
from testgres import stop_all, clean_all
|
||||
import shutil
|
||||
|
||||
|
||||
class RetentionTest(ProbackupTest, unittest.TestCase):
|
||||
@ -52,7 +49,7 @@ class RetentionTest(ProbackupTest, unittest.TestCase):
|
||||
min_wal = line[31:-1]
|
||||
elif line.startswith("INFO: removed max WAL segment"):
|
||||
max_wal = line[31:-1]
|
||||
for wal_name in listdir(os.path.join(backup_dir, 'wal', 'node')):
|
||||
for wal_name in os.listdir(os.path.join(backup_dir, 'wal', 'node')):
|
||||
if not wal_name.endswith(".backup"):
|
||||
#wal_name_b = wal_name.encode('ascii')
|
||||
self.assertEqual(wal_name[8:] > min_wal[8:], True)
|
||||
@ -85,12 +82,12 @@ class RetentionTest(ProbackupTest, unittest.TestCase):
|
||||
# Make backup to be keeped
|
||||
self.backup_node(backup_dir, 'node', node)
|
||||
|
||||
backups = path.join(backup_dir, 'backups', 'node')
|
||||
backups = os.path.join(backup_dir, 'backups', 'node')
|
||||
days_delta = 5
|
||||
for backup in listdir(backups):
|
||||
for backup in os.listdir(backups):
|
||||
if backup == 'pg_probackup.conf':
|
||||
continue
|
||||
with open(path.join(backups, backup, "backup.control"), "a") as conf:
|
||||
with open(os.path.join(backups, backup, "backup.control"), "a") as conf:
|
||||
conf.write("recovery_time='{:%Y-%m-%d %H:%M:%S}'\n".format(
|
||||
datetime.now() - timedelta(days=days_delta)))
|
||||
days_delta -= 1
|
||||
|
@ -1,9 +1,6 @@
|
||||
import unittest
|
||||
import os
|
||||
from os import path
|
||||
import unittest
|
||||
from .helpers.ptrack_helpers import ProbackupTest
|
||||
from testgres import stop_all, clean_all
|
||||
import shutil
|
||||
|
||||
|
||||
class OptionTest(ProbackupTest, unittest.TestCase):
|
||||
@ -55,7 +52,7 @@ class OptionTest(ProbackupTest, unittest.TestCase):
|
||||
backup_id = self.backup_node(backup_dir, 'node', node)
|
||||
|
||||
# delete file which belong to backup
|
||||
file = path.join(backup_dir, "backups", "node", backup_id, "database", "postgresql.conf")
|
||||
file = os.path.join(backup_dir, "backups", "node", backup_id, "database", "postgresql.conf")
|
||||
os.remove(file)
|
||||
|
||||
self.validate_pb(backup_dir, 'node', backup_id)
|
||||
|
@ -1,10 +1,8 @@
|
||||
import unittest
|
||||
import os
|
||||
import unittest
|
||||
from .helpers.ptrack_helpers import ProbackupTest, ProbackupException
|
||||
from datetime import datetime, timedelta
|
||||
from testgres import stop_all, clean_all
|
||||
import subprocess
|
||||
from sys import exit
|
||||
|
||||
|
||||
class ValidateTest(ProbackupTest, unittest.TestCase):
|
||||
|
Loading…
Reference in New Issue
Block a user