Skip to content

PBM. Avoid dropping data in the middle of PITR for selective restore, detailed test for this case T281 #201

PBM. Avoid dropping data in the middle of PITR for selective restore, detailed test for this case T281

PBM. Avoid dropping data in the middle of PITR for selective restore, detailed test for this case T281 #201

GitHub Actions / JUnit Test Report failed Dec 11, 2024 in 0s

45 tests run, 35 passed, 8 skipped, 2 failed.

Annotations

Check failure on line 79 in pbm-functional/pytest/test_azurite.py

See this annotation in the file changed.

@github-actions github-actions / JUnit Test Report

test_azurite.test_logical_pitr

AssertionError
Raw output
start_cluster = True, cluster = <cluster.Cluster object at 0x7fe01c6ee6d0>

    @pytest.mark.timeout(500, func_only=True)
    def test_logical_pitr(start_cluster,cluster):
>       cluster.check_pbm_status()

test_azurite.py:79: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <cluster.Cluster object at 0x7fe01c6ee6d0>

    def check_pbm_status(self):
        n = testinfra.get_host("docker://" + self.pbm_cli)
        result = n.check_output('pbm status --out=json')
        parsed_result = json.loads(result)
        Cluster.log("PBM status: \n" + str(parsed_result['cluster']))
        #Cluster.log(json.dumps(parsed_result['cluster'], indent=4))
        hosts = []
        for replicaset in parsed_result['cluster']:
            for host in replicaset['nodes']:
                if host['role'] != "A":
                    hosts.append(host)
>                   assert host['ok'] == True
E                   AssertionError

cluster.py:737: AssertionError

Check failure on line 101 in pbm-functional/pytest/test_sharded.py

See this annotation in the file changed.

@github-actions github-actions / JUnit Test Report

test_sharded.test_logical_selective_PBM_T218

AssertionError: assert 20 == 10
 +  where 20 = count_documents({})
 +    where count_documents = Collection(Database(MongoClient(host=['mongos:27017'], document_class=dict, tz_aware=False, connect=True), 'test1'), 'test_coll11').count_documents
Raw output
start_cluster = True, cluster = <cluster.Cluster object at 0x7fe01c76d5d0>

    @pytest.mark.timeout(300, func_only=True)
    def test_logical_selective_PBM_T218(start_cluster, cluster):
        cluster.check_pbm_status()
        client = pymongo.MongoClient(cluster.connection)
        client.admin.command("enableSharding", "test2")
        client.admin.command("shardCollection", "test2.test_coll21", key={"_id": "hashed"})
        for i in range(10):
            client["test1"]["test_coll11"].insert_one({"key": i, "data": i})
            client["test2"]["test_coll21"].insert_one({"key": i, "data": i})
            client["test2"]["test_coll22"].insert_one({"key": i, "data": i})
        client["test1"]["test_coll11"].create_index(["key"], name="test_coll11_index_old")
        client["test2"]["test_coll21"].create_index(["key"], name="test_coll21_index_old")
        backup_full = cluster.make_backup("logical")
        backup_partial = cluster.make_backup("logical --ns=test1.test_coll11,test2.*")
        cluster.enable_pitr(pitr_extra_args="--set pitr.oplogSpanMin=0.1")
        time.sleep(5)
        for i in range(10):
            client["test1"]["test_coll11"].insert_one({"key": i + 10, "data": i + 10})
        client["test1"]["test_coll11"].create_index("data", name="test_coll11_index_new")
        client["test2"]["test_coll22"].create_index("data", name="test_coll22_index_new")
        time.sleep(10)
        pitr = datetime.utcnow().strftime("%Y-%m-%dT%H:%M:%S")
        pitr = " --time=" + pitr
        Cluster.log("Time for PITR is: " + pitr)
        cluster.disable_pitr()
        time.sleep(10)
        client.drop_database("test1")
        client.drop_database("test2")
        backup_partial = " --base-snapshot=" + backup_partial + pitr
        backup_full = (
            " --base-snapshot=" + backup_full + pitr + " --ns=test1.test_coll11,test2.*"
        )
        cluster.make_restore(backup_partial, check_pbm_status=True)
>       assert client["test1"]["test_coll11"].count_documents({}) == 10
E       AssertionError: assert 20 == 10
E        +  where 20 = count_documents({})
E        +    where count_documents = Collection(Database(MongoClient(host=['mongos:27017'], document_class=dict, tz_aware=False, connect=True), 'test1'), 'test_coll11').count_documents

test_sharded.py:101: AssertionError