|
|
@ -274,7 +274,6 @@ class TestAutoBackupS3(unittest.TestCase):
|
|
|
|
node.wait_for_upload(1)
|
|
|
|
node.wait_for_upload(1)
|
|
|
|
j = node.query('SELECT count(*) FROM foo', level='strong')
|
|
|
|
j = node.query('SELECT count(*) FROM foo', level='strong')
|
|
|
|
self.assertEqual(j, d_("{'results': [{'values': [[0]], 'types': ['integer'], 'columns': ['count(*)']}]}"))
|
|
|
|
self.assertEqual(j, d_("{'results': [{'values': [[0]], 'types': ['integer'], 'columns': ['count(*)']}]}"))
|
|
|
|
node.wait_for_upload(2)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Download the backup file from S3 and check it.
|
|
|
|
# Download the backup file from S3 and check it.
|
|
|
|
backup_data = download_s3_object(access_key_id, secret_access_key_id,
|
|
|
|
backup_data = download_s3_object(access_key_id, secret_access_key_id,
|
|
|
@ -391,7 +390,6 @@ class TestAutoBackupS3(unittest.TestCase):
|
|
|
|
leader = Node(RQLITED_PATH, '0', auto_backup=cfg)
|
|
|
|
leader = Node(RQLITED_PATH, '0', auto_backup=cfg)
|
|
|
|
leader.start()
|
|
|
|
leader.start()
|
|
|
|
leader.wait_for_leader()
|
|
|
|
leader.wait_for_leader()
|
|
|
|
leader.wait_for_upload(1)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
follower = Node(RQLITED_PATH, '1', auto_backup=cfg)
|
|
|
|
follower = Node(RQLITED_PATH, '1', auto_backup=cfg)
|
|
|
|
follower.start(join=leader.RaftAddr())
|
|
|
|
follower.start(join=leader.RaftAddr())
|
|
|
@ -400,7 +398,7 @@ class TestAutoBackupS3(unittest.TestCase):
|
|
|
|
# Then create a table and insert a row. Wait for a backup to happen.
|
|
|
|
# Then create a table and insert a row. Wait for a backup to happen.
|
|
|
|
leader.execute('CREATE TABLE foo (id INTEGER NOT NULL PRIMARY KEY, name TEXT)')
|
|
|
|
leader.execute('CREATE TABLE foo (id INTEGER NOT NULL PRIMARY KEY, name TEXT)')
|
|
|
|
leader.wait_for_all_applied()
|
|
|
|
leader.wait_for_all_applied()
|
|
|
|
leader.wait_for_upload(2)
|
|
|
|
leader.wait_for_upload(1)
|
|
|
|
|
|
|
|
|
|
|
|
# Confirm that the follower has performed no backups.
|
|
|
|
# Confirm that the follower has performed no backups.
|
|
|
|
time.sleep(5)
|
|
|
|
time.sleep(5)
|
|
|
@ -413,7 +411,7 @@ class TestAutoBackupS3(unittest.TestCase):
|
|
|
|
|
|
|
|
|
|
|
|
@unittest.skipUnless(env_present('RQLITE_S3_ACCESS_KEY'), "S3 credentials not available")
|
|
|
|
@unittest.skipUnless(env_present('RQLITE_S3_ACCESS_KEY'), "S3 credentials not available")
|
|
|
|
def test_no_upload_restart(self):
|
|
|
|
def test_no_upload_restart(self):
|
|
|
|
'''Test that restarting a node that already upload doesn't upload again'''
|
|
|
|
'''Test that restarting a node that already uploaded doesn't upload again'''
|
|
|
|
node = None
|
|
|
|
node = None
|
|
|
|
cfg = None
|
|
|
|
cfg = None
|
|
|
|
path = None
|
|
|
|
path = None
|
|
|
@ -489,16 +487,14 @@ class TestAutoBackupS3(unittest.TestCase):
|
|
|
|
}
|
|
|
|
}
|
|
|
|
cfg = write_random_file(json.dumps(auto_backup_cfg))
|
|
|
|
cfg = write_random_file(json.dumps(auto_backup_cfg))
|
|
|
|
|
|
|
|
|
|
|
|
# Create a cluster with automatic backups enabled. An initial
|
|
|
|
# Create a cluster with automatic backups enabled.
|
|
|
|
# backup will happen because there is no data in the cloud.
|
|
|
|
|
|
|
|
n0 = Node(RQLITED_PATH, '0', auto_backup=cfg)
|
|
|
|
n0 = Node(RQLITED_PATH, '0', auto_backup=cfg)
|
|
|
|
n0.start()
|
|
|
|
n0.start()
|
|
|
|
n0.wait_for_leader()
|
|
|
|
n0.wait_for_leader()
|
|
|
|
n0.wait_for_upload(1)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Then create a table and insert a row. Wait for another backup to happen.
|
|
|
|
# Then create a table and insert a row. Wait for another backup to happen.
|
|
|
|
n0.execute('CREATE TABLE foo (id INTEGER NOT NULL PRIMARY KEY, name TEXT)')
|
|
|
|
n0.execute('CREATE TABLE foo (id INTEGER NOT NULL PRIMARY KEY, name TEXT)')
|
|
|
|
n0.wait_for_upload(2)
|
|
|
|
n0.wait_for_upload(1)
|
|
|
|
|
|
|
|
|
|
|
|
# Create a cluster with two more followers
|
|
|
|
# Create a cluster with two more followers
|
|
|
|
n1 = Node(RQLITED_PATH, '1', auto_backup=cfg)
|
|
|
|
n1 = Node(RQLITED_PATH, '1', auto_backup=cfg)
|
|
|
|