Skip to content

PBM. Avoid dropping data in the middle of PITR for selective restore,…

Sign in for the full log view
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 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 0x7fe8676b4a10>

    @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

Check failure on line 51 in pbm-functional/pytest/test_timeseries.py

See this annotation in the file changed.

@github-actions github-actions / JUnit Test Report

test_timeseries.test_logical_PBM_T261

failed on teardown with "AssertionError: Unexpected exit code 1 for CommandResult(backend=<testinfra.backend.docker.DockerBackend object at 0x7fe868a0ecd0>, exit_status=1, command=b'pbm config --set pitr.enabled=false --out json', _stdout=b'{"error":"another operation in progress","operation":{"node":"rs101:27017","opid":"6759abf6b43eb67eb27cf714","replset":"rs1","type":"backup"}}\n', _stderr=b'')
assert 1 == 0
 +  where 1 = CommandResult(backend=<testinfra.backend.docker.DockerBackend object at 0x7fe868a0ecd0>, exit_status=1, command=b'pbm ...,"operation":{"node":"rs101:27017","opid":"6759abf6b43eb67eb27cf714","replset":"rs1","type":"backup"}}\n', _stderr=b'').rc"
Raw output
cluster = <cluster.Cluster object at 0x7fe8675ab350>
request = <SubRequest 'start_cluster' for <Function test_logical_PBM_T261>>

    @pytest.fixture(scope="function")
    def start_cluster(cluster,request):
        try:
            cluster.destroy()
            os.chmod("/backups",0o777)
            os.system("rm -rf /backups/*")
            cluster.create()
            cluster.setup_pbm()
            client=pymongo.MongoClient(cluster.connection)
            mongod_version=client.server_info()["version"]
            if version.parse(mongod_version) < version.parse("6.0.0"):
                pytest.skip("Unsupported version for sharded timeseries")
            client.admin.command("enableSharding", "test")
            client.test.create_collection('test1',timeseries={'timeField':'timestamp','metaField': 'data'})
            client.test.create_collection('test2',timeseries={'timeField':'timestamp','metaField': 'data'})
            client.admin.command("shardCollection", "test.test1", key={"timestamp": 1})
            client.test["test2"].create_index([("data",pymongo.HASHED )])
            client.admin.command("shardCollection", "test.test2", key={"data": "hashed"})
            yield True
    
        finally:
            if request.config.getoption("--verbose"):
                cluster.get_logs()
>           cluster.destroy(cleanup_backups=True)

test_timeseries.py:51: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
cluster.py:494: in destroy
    self.disable_pitr()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <cluster.Cluster object at 0x7fe8675ab350>

    def disable_pitr(self):
        n = testinfra.get_host("docker://" + self.pbm_cli)
>       result = n.check_output(
            "pbm config --set pitr.enabled=false --out json")
E       AssertionError: Unexpected exit code 1 for CommandResult(backend=<testinfra.backend.docker.DockerBackend object at 0x7fe868a0ecd0>, exit_status=1, command=b'pbm config --set pitr.enabled=false --out json', _stdout=b'{"error":"another operation in progress","operation":{"node":"rs101:27017","opid":"6759abf6b43eb67eb27cf714","replset":"rs1","type":"backup"}}\n', _stderr=b'')
E       assert 1 == 0
E        +  where 1 = CommandResult(backend=<testinfra.backend.docker.DockerBackend object at 0x7fe868a0ecd0>, exit_status=1, command=b'pbm ...,"operation":{"node":"rs101:27017","opid":"6759abf6b43eb67eb27cf714","replset":"rs1","type":"backup"}}\n', _stderr=b'').rc

cluster.py:570: AssertionError