Skip to content

PBM test recreate database with different primary shard during oplog …

Sign in for the full log view
GitHub Actions / JUnit Test Report failed Dec 10, 2024 in 0s

45 tests run, 36 passed, 8 skipped, 1 failed.

Annotations

Check failure on line 102 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 0 == 10
 +  where 0 = 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 0x7f1d11016d50>

    @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)
        client.drop_database("test1")
        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 0 == 10
E        +  where 0 = 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:102: AssertionError