PBM-1417. Allow multi-DB backup #180
GitHub Actions / JUnit Test Report
failed
Nov 6, 2024 in 0s
21 tests run, 17 passed, 3 skipped, 1 failed.
Annotations
Check failure on line 95 in pbm-functional/pytest/test_PBM-1228.py
github-actions / JUnit Test Report
test_PBM-1228.test_pitr_PBM_T256[base-physical]
AssertionError: assert 751 == 1500
+ where 751 = count_documents({})
+ where count_documents = Collection(Database(MongoClient(host=['mongos:27017'], document_class=dict, tz_aware=False, connect=True), 'test'), 'test').count_documents
Raw output
start_cluster = True, cluster = <cluster.Cluster object at 0x7fc00843d210>
backup_type = 'physical', base_snapshot = 'base'
@pytest.mark.timeout(900,func_only=True)
@pytest.mark.parametrize('backup_type',['logical','physical'])
@pytest.mark.parametrize('base_snapshot',['base','profile'])
def test_pitr_PBM_T256(start_cluster,cluster,backup_type,base_snapshot):
def insert_docs():
client=pymongo.MongoClient(cluster.connection)
for i in range(1500):
client['test']['test'].insert_one({"doc":i})
time.sleep(0.1)
cluster.check_pbm_status()
base_backup=cluster.make_backup(backup_type)
cluster.enable_pitr(pitr_extra_args="--set pitr.oplogSpanMin=0.5")
Cluster.log("Start inserting docs in the background")
background_insert = threading.Thread(target=insert_docs)
background_insert.start()
time.sleep(60)
Cluster.log("Check if PITR is running")
if not cluster.check_pitr():
logs=cluster.exec_pbm_cli("logs -sD -t0")
assert False, logs.stdout
Cluster.log("Setup filesystem profile")
profile=cluster.exec_pbm_cli("profile add filesystem /etc/pbm-fs-profile.conf --wait")
assert profile.rc==0, profile.stderr
assert "OK" in profile.stdout, profile.stdout
Cluster.log(profile.stdout)
Cluster.log("Perform backup on fs profile")
fs_backup=cluster.make_backup(backup_type + " --profile filesystem")
Cluster.log("Check if the backup actually was created on the filesystem storage")
assert os.path.isdir("/backups/" + fs_backup)
assert os.path.isfile("/backups/" + fs_backup + ".pbm.json")
time.sleep(60)
background_insert.join()
time.sleep(30)
assert pymongo.MongoClient(cluster.connection)["test"]["test"].count_documents({}) == 1500
pitr = datetime.utcnow().strftime("%Y-%m-%dT%H:%M:%S")
Cluster.log("Time for PITR is " + pitr)
time.sleep(60)
cluster.disable_pitr()
pymongo.MongoClient(cluster.connection).drop_database('test')
if base_snapshot == 'base':
backup="--time=" + pitr + " --base-snapshot=" + base_backup
else:
backup="--time=" + pitr + " --base-snapshot=" + fs_backup
Cluster.log("Attempt to PITR restore with the backup on the " + base_snapshot + " storage")
if backup_type == 'logical':
cluster.make_restore(backup, check_pbm_status=True)
else:
cluster.make_restore(backup, restart_cluster=True, check_pbm_status=True)
time.sleep(60)
> assert pymongo.MongoClient(cluster.connection)["test"]["test"].count_documents({}) == 1500
E AssertionError: assert 751 == 1500
E + where 751 = count_documents({})
E + where count_documents = Collection(Database(MongoClient(host=['mongos:27017'], document_class=dict, tz_aware=False, connect=True), 'test'), 'test').count_documents
test_PBM-1228.py:95: AssertionError
Loading