Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PBM-1422 test selective restore with name remapping #233

Merged
merged 2 commits into from
Nov 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
151 changes: 151 additions & 0 deletions pbm-functional/pytest/test_rename_replicaset.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
import pytest
import pymongo
import bson
import testinfra
import time
import os
import docker
import concurrent.futures
import random
import json

from datetime import datetime
from cluster import Cluster
from packaging import version

@pytest.fixture(scope="package")
def config():
return { "_id": "rs1", "members": [{"host":"rs101"},{"host": "rs102"},{"host": "rs103" }]}

@pytest.fixture(scope="package")
def cluster(config):
return Cluster(config)

@pytest.fixture(scope="function")
def start_cluster(cluster,request):
try:
cluster.destroy()
cluster.create()
cluster.setup_pbm()
os.chmod("/backups",0o777)
os.system("rm -rf /backups/*")
result = cluster.exec_pbm_cli("config --set storage.type=filesystem --set storage.filesystem.path=/backups --set backup.compression=none --out json")
assert result.rc == 0
Cluster.log("Setup PBM with fs storage:\n" + result.stdout)
client=pymongo.MongoClient(cluster.connection)
for i in range(10):
client["test"]["test"].insert_one({"key": i, "data": i})
client["test"]["inserts"].insert_one({"key": i, "data": i})
client["test"]["replaces"].insert_one({"key": i, "data": i})
client["test"]["updates"].insert_one({"key": i, "data": i})
client["test"]["deletes"].insert_one({"key": i, "data": i})
client["test"]["indexes"].insert_one({"key": i, "data": i})
client["test"]["indexes"].create_index(["key"],name="old_index")
yield True
finally:
if request.config.getoption("--verbose"):
cluster.get_logs()
cluster.destroy(cleanup_backups=True)

@pytest.mark.timeout(300,func_only=True)
@pytest.mark.parametrize('collection',['inserts','replaces','updates','deletes','indexes'])
def test_logical_pitr_crud_PBM_T270(start_cluster,cluster,collection):
cluster.check_pbm_status()
cluster.make_backup("logical")
cluster.enable_pitr(pitr_extra_args="--set pitr.oplogSpanMin=0.1")
time.sleep(5)
for i in range(10):
client = pymongo.MongoClient(cluster.connection)
client["test"]["inserts"].insert_one({"key": i+10, "data": i+10})
client["test"]["replaces"].replace_one({"key": i}, {"key": i+10, "data": i+10})
client["test"]["updates"].update_one({"key": i}, {"$inc": { "data": 10 }})
client["test"]["deletes"].delete_one({"key": i})
client["test"]["indexes"].drop_index("old_index")
client["test"]["indexes"].create_index("data",name="new_index")
time.sleep(5)
pitr = datetime.utcnow().strftime("%Y-%m-%dT%H:%M:%S")
pitr=" --time=" + pitr
Cluster.log("Time for PITR is: " + pitr)
time.sleep(10)
cluster.disable_pitr()
time.sleep(5)
backup_to_fail=pitr + " --ns-from=test." + collection + " --ns-to=test.test"
result=cluster.exec_pbm_cli("restore" + backup_to_fail + " --wait")
assert result.rc != 0
assert "cloning namespace (--ns-to) is already in use" in result.stderr

Check failure on line 75 in pbm-functional/pytest/test_rename_replicaset.py

View workflow job for this annotation

GitHub Actions / JUnit Test Report

test_rename_replicaset.test_logical_pitr_crud_PBM_T270[inserts]

AssertionError: assert 'cloning namespace (--ns-to) is already in use' in 'Error: parse --ns-from and --ns-to options: cloning with restore to the point-in-time is not possible\n' + where 'Error: parse --ns-from and --ns-to options: cloning with restore to the point-in-time is not possible\n' = CommandResult(backend=<testinfra.backend.docker.DockerBackend object at 0x7f3e73ca4590>, exit_status=1, command=b'pbm ...'', _stderr=b'Error: parse --ns-from and --ns-to options: cloning with restore to the point-in-time is not possible\n').stderr
Raw output
start_cluster = True, cluster = <cluster.Cluster object at 0x7f3e6ea05f50>
collection = 'inserts'

    @pytest.mark.timeout(300,func_only=True)
    @pytest.mark.parametrize('collection',['inserts','replaces','updates','deletes','indexes'])
    def test_logical_pitr_crud_PBM_T270(start_cluster,cluster,collection):
        cluster.check_pbm_status()
        cluster.make_backup("logical")
        cluster.enable_pitr(pitr_extra_args="--set pitr.oplogSpanMin=0.1")
        time.sleep(5)
        for i in range(10):
            client = pymongo.MongoClient(cluster.connection)
            client["test"]["inserts"].insert_one({"key": i+10, "data": i+10})
            client["test"]["replaces"].replace_one({"key": i}, {"key": i+10, "data": i+10})
            client["test"]["updates"].update_one({"key": i}, {"$inc": { "data": 10 }})
            client["test"]["deletes"].delete_one({"key": i})
        client["test"]["indexes"].drop_index("old_index")
        client["test"]["indexes"].create_index("data",name="new_index")
        time.sleep(5)
        pitr = datetime.utcnow().strftime("%Y-%m-%dT%H:%M:%S")
        pitr=" --time=" + pitr
        Cluster.log("Time for PITR is: " + pitr)
        time.sleep(10)
        cluster.disable_pitr()
        time.sleep(5)
        backup_to_fail=pitr + " --ns-from=test." + collection + " --ns-to=test.test"
        result=cluster.exec_pbm_cli("restore" + backup_to_fail + " --wait")
        assert result.rc != 0
>       assert "cloning namespace (--ns-to) is already in use" in result.stderr
E       AssertionError: assert 'cloning namespace (--ns-to) is already in use' in 'Error: parse --ns-from and --ns-to options: cloning with restore to the point-in-time is not possible\n'
E        +  where 'Error: parse --ns-from and --ns-to options: cloning with restore to the point-in-time is not possible\n' = CommandResult(backend=<testinfra.backend.docker.DockerBackend object at 0x7f3e73ca4590>, exit_status=1, command=b'pbm ...'', _stderr=b'Error: parse --ns-from and --ns-to options: cloning with restore to the point-in-time is not possible\n').stderr

test_rename_replicaset.py:75: AssertionError

Check failure on line 75 in pbm-functional/pytest/test_rename_replicaset.py

View workflow job for this annotation

GitHub Actions / JUnit Test Report

test_rename_replicaset.test_logical_pitr_crud_PBM_T270[replaces]

AssertionError: assert 'cloning namespace (--ns-to) is already in use' in 'Error: parse --ns-from and --ns-to options: cloning with restore to the point-in-time is not possible\n' + where 'Error: parse --ns-from and --ns-to options: cloning with restore to the point-in-time is not possible\n' = CommandResult(backend=<testinfra.backend.docker.DockerBackend object at 0x7f3e73ca4590>, exit_status=1, command=b'pbm ...'', _stderr=b'Error: parse --ns-from and --ns-to options: cloning with restore to the point-in-time is not possible\n').stderr
Raw output
start_cluster = True, cluster = <cluster.Cluster object at 0x7f3e6ea05f50>
collection = 'replaces'

    @pytest.mark.timeout(300,func_only=True)
    @pytest.mark.parametrize('collection',['inserts','replaces','updates','deletes','indexes'])
    def test_logical_pitr_crud_PBM_T270(start_cluster,cluster,collection):
        cluster.check_pbm_status()
        cluster.make_backup("logical")
        cluster.enable_pitr(pitr_extra_args="--set pitr.oplogSpanMin=0.1")
        time.sleep(5)
        for i in range(10):
            client = pymongo.MongoClient(cluster.connection)
            client["test"]["inserts"].insert_one({"key": i+10, "data": i+10})
            client["test"]["replaces"].replace_one({"key": i}, {"key": i+10, "data": i+10})
            client["test"]["updates"].update_one({"key": i}, {"$inc": { "data": 10 }})
            client["test"]["deletes"].delete_one({"key": i})
        client["test"]["indexes"].drop_index("old_index")
        client["test"]["indexes"].create_index("data",name="new_index")
        time.sleep(5)
        pitr = datetime.utcnow().strftime("%Y-%m-%dT%H:%M:%S")
        pitr=" --time=" + pitr
        Cluster.log("Time for PITR is: " + pitr)
        time.sleep(10)
        cluster.disable_pitr()
        time.sleep(5)
        backup_to_fail=pitr + " --ns-from=test." + collection + " --ns-to=test.test"
        result=cluster.exec_pbm_cli("restore" + backup_to_fail + " --wait")
        assert result.rc != 0
>       assert "cloning namespace (--ns-to) is already in use" in result.stderr
E       AssertionError: assert 'cloning namespace (--ns-to) is already in use' in 'Error: parse --ns-from and --ns-to options: cloning with restore to the point-in-time is not possible\n'
E        +  where 'Error: parse --ns-from and --ns-to options: cloning with restore to the point-in-time is not possible\n' = CommandResult(backend=<testinfra.backend.docker.DockerBackend object at 0x7f3e73ca4590>, exit_status=1, command=b'pbm ...'', _stderr=b'Error: parse --ns-from and --ns-to options: cloning with restore to the point-in-time is not possible\n').stderr

test_rename_replicaset.py:75: AssertionError

Check failure on line 75 in pbm-functional/pytest/test_rename_replicaset.py

View workflow job for this annotation

GitHub Actions / JUnit Test Report

test_rename_replicaset.test_logical_pitr_crud_PBM_T270[updates]

AssertionError: assert 'cloning namespace (--ns-to) is already in use' in 'Error: parse --ns-from and --ns-to options: cloning with restore to the point-in-time is not possible\n' + where 'Error: parse --ns-from and --ns-to options: cloning with restore to the point-in-time is not possible\n' = CommandResult(backend=<testinfra.backend.docker.DockerBackend object at 0x7f3e73ca4590>, exit_status=1, command=b'pbm ...'', _stderr=b'Error: parse --ns-from and --ns-to options: cloning with restore to the point-in-time is not possible\n').stderr
Raw output
start_cluster = True, cluster = <cluster.Cluster object at 0x7f3e6ea05f50>
collection = 'updates'

    @pytest.mark.timeout(300,func_only=True)
    @pytest.mark.parametrize('collection',['inserts','replaces','updates','deletes','indexes'])
    def test_logical_pitr_crud_PBM_T270(start_cluster,cluster,collection):
        cluster.check_pbm_status()
        cluster.make_backup("logical")
        cluster.enable_pitr(pitr_extra_args="--set pitr.oplogSpanMin=0.1")
        time.sleep(5)
        for i in range(10):
            client = pymongo.MongoClient(cluster.connection)
            client["test"]["inserts"].insert_one({"key": i+10, "data": i+10})
            client["test"]["replaces"].replace_one({"key": i}, {"key": i+10, "data": i+10})
            client["test"]["updates"].update_one({"key": i}, {"$inc": { "data": 10 }})
            client["test"]["deletes"].delete_one({"key": i})
        client["test"]["indexes"].drop_index("old_index")
        client["test"]["indexes"].create_index("data",name="new_index")
        time.sleep(5)
        pitr = datetime.utcnow().strftime("%Y-%m-%dT%H:%M:%S")
        pitr=" --time=" + pitr
        Cluster.log("Time for PITR is: " + pitr)
        time.sleep(10)
        cluster.disable_pitr()
        time.sleep(5)
        backup_to_fail=pitr + " --ns-from=test." + collection + " --ns-to=test.test"
        result=cluster.exec_pbm_cli("restore" + backup_to_fail + " --wait")
        assert result.rc != 0
>       assert "cloning namespace (--ns-to) is already in use" in result.stderr
E       AssertionError: assert 'cloning namespace (--ns-to) is already in use' in 'Error: parse --ns-from and --ns-to options: cloning with restore to the point-in-time is not possible\n'
E        +  where 'Error: parse --ns-from and --ns-to options: cloning with restore to the point-in-time is not possible\n' = CommandResult(backend=<testinfra.backend.docker.DockerBackend object at 0x7f3e73ca4590>, exit_status=1, command=b'pbm ...'', _stderr=b'Error: parse --ns-from and --ns-to options: cloning with restore to the point-in-time is not possible\n').stderr

test_rename_replicaset.py:75: AssertionError

Check failure on line 75 in pbm-functional/pytest/test_rename_replicaset.py

View workflow job for this annotation

GitHub Actions / JUnit Test Report

test_rename_replicaset.test_logical_pitr_crud_PBM_T270[deletes]

AssertionError: assert 'cloning namespace (--ns-to) is already in use' in 'Error: parse --ns-from and --ns-to options: cloning with restore to the point-in-time is not possible\n' + where 'Error: parse --ns-from and --ns-to options: cloning with restore to the point-in-time is not possible\n' = CommandResult(backend=<testinfra.backend.docker.DockerBackend object at 0x7f3e73ca4590>, exit_status=1, command=b'pbm ...'', _stderr=b'Error: parse --ns-from and --ns-to options: cloning with restore to the point-in-time is not possible\n').stderr
Raw output
start_cluster = True, cluster = <cluster.Cluster object at 0x7f3e6ea05f50>
collection = 'deletes'

    @pytest.mark.timeout(300,func_only=True)
    @pytest.mark.parametrize('collection',['inserts','replaces','updates','deletes','indexes'])
    def test_logical_pitr_crud_PBM_T270(start_cluster,cluster,collection):
        cluster.check_pbm_status()
        cluster.make_backup("logical")
        cluster.enable_pitr(pitr_extra_args="--set pitr.oplogSpanMin=0.1")
        time.sleep(5)
        for i in range(10):
            client = pymongo.MongoClient(cluster.connection)
            client["test"]["inserts"].insert_one({"key": i+10, "data": i+10})
            client["test"]["replaces"].replace_one({"key": i}, {"key": i+10, "data": i+10})
            client["test"]["updates"].update_one({"key": i}, {"$inc": { "data": 10 }})
            client["test"]["deletes"].delete_one({"key": i})
        client["test"]["indexes"].drop_index("old_index")
        client["test"]["indexes"].create_index("data",name="new_index")
        time.sleep(5)
        pitr = datetime.utcnow().strftime("%Y-%m-%dT%H:%M:%S")
        pitr=" --time=" + pitr
        Cluster.log("Time for PITR is: " + pitr)
        time.sleep(10)
        cluster.disable_pitr()
        time.sleep(5)
        backup_to_fail=pitr + " --ns-from=test." + collection + " --ns-to=test.test"
        result=cluster.exec_pbm_cli("restore" + backup_to_fail + " --wait")
        assert result.rc != 0
>       assert "cloning namespace (--ns-to) is already in use" in result.stderr
E       AssertionError: assert 'cloning namespace (--ns-to) is already in use' in 'Error: parse --ns-from and --ns-to options: cloning with restore to the point-in-time is not possible\n'
E        +  where 'Error: parse --ns-from and --ns-to options: cloning with restore to the point-in-time is not possible\n' = CommandResult(backend=<testinfra.backend.docker.DockerBackend object at 0x7f3e73ca4590>, exit_status=1, command=b'pbm ...'', _stderr=b'Error: parse --ns-from and --ns-to options: cloning with restore to the point-in-time is not possible\n').stderr

test_rename_replicaset.py:75: AssertionError

Check failure on line 75 in pbm-functional/pytest/test_rename_replicaset.py

View workflow job for this annotation

GitHub Actions / JUnit Test Report

test_rename_replicaset.test_logical_pitr_crud_PBM_T270[indexes]

AssertionError: assert 'cloning namespace (--ns-to) is already in use' in 'Error: parse --ns-from and --ns-to options: cloning with restore to the point-in-time is not possible\n' + where 'Error: parse --ns-from and --ns-to options: cloning with restore to the point-in-time is not possible\n' = CommandResult(backend=<testinfra.backend.docker.DockerBackend object at 0x7f3e73ca4590>, exit_status=1, command=b'pbm ...'', _stderr=b'Error: parse --ns-from and --ns-to options: cloning with restore to the point-in-time is not possible\n').stderr
Raw output
start_cluster = True, cluster = <cluster.Cluster object at 0x7f3e6ea05f50>
collection = 'indexes'

    @pytest.mark.timeout(300,func_only=True)
    @pytest.mark.parametrize('collection',['inserts','replaces','updates','deletes','indexes'])
    def test_logical_pitr_crud_PBM_T270(start_cluster,cluster,collection):
        cluster.check_pbm_status()
        cluster.make_backup("logical")
        cluster.enable_pitr(pitr_extra_args="--set pitr.oplogSpanMin=0.1")
        time.sleep(5)
        for i in range(10):
            client = pymongo.MongoClient(cluster.connection)
            client["test"]["inserts"].insert_one({"key": i+10, "data": i+10})
            client["test"]["replaces"].replace_one({"key": i}, {"key": i+10, "data": i+10})
            client["test"]["updates"].update_one({"key": i}, {"$inc": { "data": 10 }})
            client["test"]["deletes"].delete_one({"key": i})
        client["test"]["indexes"].drop_index("old_index")
        client["test"]["indexes"].create_index("data",name="new_index")
        time.sleep(5)
        pitr = datetime.utcnow().strftime("%Y-%m-%dT%H:%M:%S")
        pitr=" --time=" + pitr
        Cluster.log("Time for PITR is: " + pitr)
        time.sleep(10)
        cluster.disable_pitr()
        time.sleep(5)
        backup_to_fail=pitr + " --ns-from=test." + collection + " --ns-to=test.test"
        result=cluster.exec_pbm_cli("restore" + backup_to_fail + " --wait")
        assert result.rc != 0
>       assert "cloning namespace (--ns-to) is already in use" in result.stderr
E       AssertionError: assert 'cloning namespace (--ns-to) is already in use' in 'Error: parse --ns-from and --ns-to options: cloning with restore to the point-in-time is not possible\n'
E        +  where 'Error: parse --ns-from and --ns-to options: cloning with restore to the point-in-time is not possible\n' = CommandResult(backend=<testinfra.backend.docker.DockerBackend object at 0x7f3e73ca4590>, exit_status=1, command=b'pbm ...'', _stderr=b'Error: parse --ns-from and --ns-to options: cloning with restore to the point-in-time is not possible\n').stderr

test_rename_replicaset.py:75: AssertionError
backup=pitr + " --ns-from=test." + collection + " --ns-to=restored." + collection
cluster.make_restore(backup)
client = pymongo.MongoClient(cluster.connection)
assert client["test"]["inserts"].count_documents({})==20
assert client["test"]["replaces"].count_documents({})==10
assert client["test"]["updates"].count_documents({})==10
assert client["test"]["deletes"].count_documents({})==0
if collection=='inserts':
assert client["restored"]["inserts"].count_documents({})==20
for i in range(20):
assert client["restored"]["inserts"].find_one({"key": i, "data": i})
elif collection=='replaces':
assert client["restored"]["replaces"].count_documents({})==10
for i in range(10):
assert client["restored"]["replaces"].find_one({"key": i+10, "data": i+10})
elif collection=='updates':
assert client["restored"]["updates"].count_documents({})==10
for i in range(10):
assert client["restored"]["updates"].find_one({"key": i, "data": i+10})
elif collection=='deletes':
assert client["restored"]["deletes"].count_documents({})==0
else:
assert client["restored"]["indexes"].count_documents({})==10
assert 'new_index' in client["restored"]["indexes"].index_information()
assert 'old_index' not in client["restored"]["indexes"].index_information()
Cluster.log("Finished successfully")

@pytest.mark.timeout(300,func_only=True)
@pytest.mark.parametrize('collection',['inserts','replaces','updates','deletes'])
def test_logical_pitr_with_txn_PBM_T271(start_cluster,cluster,collection):
cluster.check_pbm_status()
cluster.make_backup("logical")
cluster.enable_pitr(pitr_extra_args="--set pitr.oplogSpanMin=0.1")
time.sleep(5)
for i in range(10):
client = pymongo.MongoClient(cluster.connection)
with client.start_session() as session:
with session.start_transaction():
client["test"]["inserts"].insert_one({"key": i+10, "data": i+10}, session=session)
client["test"]["replaces"].replace_one({"key": i}, {"key": i+10, "data": i+10}, session=session)
client["test"]["updates"].update_one({"key": i}, {"$inc": { "data": 10 }}, session=session)
client["test"]["deletes"].delete_one({"key": i}, session=session)
session.commit_transaction()
time.sleep(5)
pitr = datetime.utcnow().strftime("%Y-%m-%dT%H:%M:%S")
pitr=" --time=" + pitr
Cluster.log("Time for PITR is: " + pitr)
time.sleep(10)
cluster.disable_pitr()
time.sleep(5)
backup_to_fail=pitr + " --ns-from=test." + collection + " --ns-to=test.test"
result=cluster.exec_pbm_cli("restore" + backup_to_fail + " --wait")
assert result.rc != 0
assert "cloning namespace (--ns-to) is already in use" in result.stderr

Check failure on line 129 in pbm-functional/pytest/test_rename_replicaset.py

View workflow job for this annotation

GitHub Actions / JUnit Test Report

test_rename_replicaset.test_logical_pitr_with_txn_PBM_T271[inserts]

AssertionError: assert 'cloning namespace (--ns-to) is already in use' in 'Error: parse --ns-from and --ns-to options: cloning with restore to the point-in-time is not possible\n' + where 'Error: parse --ns-from and --ns-to options: cloning with restore to the point-in-time is not possible\n' = CommandResult(backend=<testinfra.backend.docker.DockerBackend object at 0x7f3e73ca4590>, exit_status=1, command=b'pbm ...'', _stderr=b'Error: parse --ns-from and --ns-to options: cloning with restore to the point-in-time is not possible\n').stderr
Raw output
start_cluster = True, cluster = <cluster.Cluster object at 0x7f3e6ea05f50>
collection = 'inserts'

    @pytest.mark.timeout(300,func_only=True)
    @pytest.mark.parametrize('collection',['inserts','replaces','updates','deletes'])
    def test_logical_pitr_with_txn_PBM_T271(start_cluster,cluster,collection):
        cluster.check_pbm_status()
        cluster.make_backup("logical")
        cluster.enable_pitr(pitr_extra_args="--set pitr.oplogSpanMin=0.1")
        time.sleep(5)
        for i in range(10):
            client = pymongo.MongoClient(cluster.connection)
            with client.start_session() as session:
                with session.start_transaction():
                    client["test"]["inserts"].insert_one({"key": i+10, "data": i+10}, session=session)
                    client["test"]["replaces"].replace_one({"key": i}, {"key": i+10, "data": i+10}, session=session)
                    client["test"]["updates"].update_one({"key": i}, {"$inc": { "data": 10 }}, session=session)
                    client["test"]["deletes"].delete_one({"key": i}, session=session)
                session.commit_transaction()
        time.sleep(5)
        pitr = datetime.utcnow().strftime("%Y-%m-%dT%H:%M:%S")
        pitr=" --time=" + pitr
        Cluster.log("Time for PITR is: " + pitr)
        time.sleep(10)
        cluster.disable_pitr()
        time.sleep(5)
        backup_to_fail=pitr + " --ns-from=test." + collection + " --ns-to=test.test"
        result=cluster.exec_pbm_cli("restore" + backup_to_fail + " --wait")
        assert result.rc != 0
>       assert "cloning namespace (--ns-to) is already in use" in result.stderr
E       AssertionError: assert 'cloning namespace (--ns-to) is already in use' in 'Error: parse --ns-from and --ns-to options: cloning with restore to the point-in-time is not possible\n'
E        +  where 'Error: parse --ns-from and --ns-to options: cloning with restore to the point-in-time is not possible\n' = CommandResult(backend=<testinfra.backend.docker.DockerBackend object at 0x7f3e73ca4590>, exit_status=1, command=b'pbm ...'', _stderr=b'Error: parse --ns-from and --ns-to options: cloning with restore to the point-in-time is not possible\n').stderr

test_rename_replicaset.py:129: AssertionError

Check failure on line 129 in pbm-functional/pytest/test_rename_replicaset.py

View workflow job for this annotation

GitHub Actions / JUnit Test Report

test_rename_replicaset.test_logical_pitr_with_txn_PBM_T271[replaces]

AssertionError: assert 'cloning namespace (--ns-to) is already in use' in 'Error: parse --ns-from and --ns-to options: cloning with restore to the point-in-time is not possible\n' + where 'Error: parse --ns-from and --ns-to options: cloning with restore to the point-in-time is not possible\n' = CommandResult(backend=<testinfra.backend.docker.DockerBackend object at 0x7f3e73ca4590>, exit_status=1, command=b'pbm ...'', _stderr=b'Error: parse --ns-from and --ns-to options: cloning with restore to the point-in-time is not possible\n').stderr
Raw output
start_cluster = True, cluster = <cluster.Cluster object at 0x7f3e6ea05f50>
collection = 'replaces'

    @pytest.mark.timeout(300,func_only=True)
    @pytest.mark.parametrize('collection',['inserts','replaces','updates','deletes'])
    def test_logical_pitr_with_txn_PBM_T271(start_cluster,cluster,collection):
        cluster.check_pbm_status()
        cluster.make_backup("logical")
        cluster.enable_pitr(pitr_extra_args="--set pitr.oplogSpanMin=0.1")
        time.sleep(5)
        for i in range(10):
            client = pymongo.MongoClient(cluster.connection)
            with client.start_session() as session:
                with session.start_transaction():
                    client["test"]["inserts"].insert_one({"key": i+10, "data": i+10}, session=session)
                    client["test"]["replaces"].replace_one({"key": i}, {"key": i+10, "data": i+10}, session=session)
                    client["test"]["updates"].update_one({"key": i}, {"$inc": { "data": 10 }}, session=session)
                    client["test"]["deletes"].delete_one({"key": i}, session=session)
                session.commit_transaction()
        time.sleep(5)
        pitr = datetime.utcnow().strftime("%Y-%m-%dT%H:%M:%S")
        pitr=" --time=" + pitr
        Cluster.log("Time for PITR is: " + pitr)
        time.sleep(10)
        cluster.disable_pitr()
        time.sleep(5)
        backup_to_fail=pitr + " --ns-from=test." + collection + " --ns-to=test.test"
        result=cluster.exec_pbm_cli("restore" + backup_to_fail + " --wait")
        assert result.rc != 0
>       assert "cloning namespace (--ns-to) is already in use" in result.stderr
E       AssertionError: assert 'cloning namespace (--ns-to) is already in use' in 'Error: parse --ns-from and --ns-to options: cloning with restore to the point-in-time is not possible\n'
E        +  where 'Error: parse --ns-from and --ns-to options: cloning with restore to the point-in-time is not possible\n' = CommandResult(backend=<testinfra.backend.docker.DockerBackend object at 0x7f3e73ca4590>, exit_status=1, command=b'pbm ...'', _stderr=b'Error: parse --ns-from and --ns-to options: cloning with restore to the point-in-time is not possible\n').stderr

test_rename_replicaset.py:129: AssertionError

Check failure on line 129 in pbm-functional/pytest/test_rename_replicaset.py

View workflow job for this annotation

GitHub Actions / JUnit Test Report

test_rename_replicaset.test_logical_pitr_with_txn_PBM_T271[updates]

AssertionError: assert 'cloning namespace (--ns-to) is already in use' in 'Error: parse --ns-from and --ns-to options: cloning with restore to the point-in-time is not possible\n' + where 'Error: parse --ns-from and --ns-to options: cloning with restore to the point-in-time is not possible\n' = CommandResult(backend=<testinfra.backend.docker.DockerBackend object at 0x7f3e73ca4590>, exit_status=1, command=b'pbm ...'', _stderr=b'Error: parse --ns-from and --ns-to options: cloning with restore to the point-in-time is not possible\n').stderr
Raw output
start_cluster = True, cluster = <cluster.Cluster object at 0x7f3e6ea05f50>
collection = 'updates'

    @pytest.mark.timeout(300,func_only=True)
    @pytest.mark.parametrize('collection',['inserts','replaces','updates','deletes'])
    def test_logical_pitr_with_txn_PBM_T271(start_cluster,cluster,collection):
        cluster.check_pbm_status()
        cluster.make_backup("logical")
        cluster.enable_pitr(pitr_extra_args="--set pitr.oplogSpanMin=0.1")
        time.sleep(5)
        for i in range(10):
            client = pymongo.MongoClient(cluster.connection)
            with client.start_session() as session:
                with session.start_transaction():
                    client["test"]["inserts"].insert_one({"key": i+10, "data": i+10}, session=session)
                    client["test"]["replaces"].replace_one({"key": i}, {"key": i+10, "data": i+10}, session=session)
                    client["test"]["updates"].update_one({"key": i}, {"$inc": { "data": 10 }}, session=session)
                    client["test"]["deletes"].delete_one({"key": i}, session=session)
                session.commit_transaction()
        time.sleep(5)
        pitr = datetime.utcnow().strftime("%Y-%m-%dT%H:%M:%S")
        pitr=" --time=" + pitr
        Cluster.log("Time for PITR is: " + pitr)
        time.sleep(10)
        cluster.disable_pitr()
        time.sleep(5)
        backup_to_fail=pitr + " --ns-from=test." + collection + " --ns-to=test.test"
        result=cluster.exec_pbm_cli("restore" + backup_to_fail + " --wait")
        assert result.rc != 0
>       assert "cloning namespace (--ns-to) is already in use" in result.stderr
E       AssertionError: assert 'cloning namespace (--ns-to) is already in use' in 'Error: parse --ns-from and --ns-to options: cloning with restore to the point-in-time is not possible\n'
E        +  where 'Error: parse --ns-from and --ns-to options: cloning with restore to the point-in-time is not possible\n' = CommandResult(backend=<testinfra.backend.docker.DockerBackend object at 0x7f3e73ca4590>, exit_status=1, command=b'pbm ...'', _stderr=b'Error: parse --ns-from and --ns-to options: cloning with restore to the point-in-time is not possible\n').stderr

test_rename_replicaset.py:129: AssertionError

Check failure on line 129 in pbm-functional/pytest/test_rename_replicaset.py

View workflow job for this annotation

GitHub Actions / JUnit Test Report

test_rename_replicaset.test_logical_pitr_with_txn_PBM_T271[deletes]

AssertionError: assert 'cloning namespace (--ns-to) is already in use' in 'Error: parse --ns-from and --ns-to options: cloning with restore to the point-in-time is not possible\n' + where 'Error: parse --ns-from and --ns-to options: cloning with restore to the point-in-time is not possible\n' = CommandResult(backend=<testinfra.backend.docker.DockerBackend object at 0x7f3e73ca4590>, exit_status=1, command=b'pbm ...'', _stderr=b'Error: parse --ns-from and --ns-to options: cloning with restore to the point-in-time is not possible\n').stderr
Raw output
start_cluster = True, cluster = <cluster.Cluster object at 0x7f3e6ea05f50>
collection = 'deletes'

    @pytest.mark.timeout(300,func_only=True)
    @pytest.mark.parametrize('collection',['inserts','replaces','updates','deletes'])
    def test_logical_pitr_with_txn_PBM_T271(start_cluster,cluster,collection):
        cluster.check_pbm_status()
        cluster.make_backup("logical")
        cluster.enable_pitr(pitr_extra_args="--set pitr.oplogSpanMin=0.1")
        time.sleep(5)
        for i in range(10):
            client = pymongo.MongoClient(cluster.connection)
            with client.start_session() as session:
                with session.start_transaction():
                    client["test"]["inserts"].insert_one({"key": i+10, "data": i+10}, session=session)
                    client["test"]["replaces"].replace_one({"key": i}, {"key": i+10, "data": i+10}, session=session)
                    client["test"]["updates"].update_one({"key": i}, {"$inc": { "data": 10 }}, session=session)
                    client["test"]["deletes"].delete_one({"key": i}, session=session)
                session.commit_transaction()
        time.sleep(5)
        pitr = datetime.utcnow().strftime("%Y-%m-%dT%H:%M:%S")
        pitr=" --time=" + pitr
        Cluster.log("Time for PITR is: " + pitr)
        time.sleep(10)
        cluster.disable_pitr()
        time.sleep(5)
        backup_to_fail=pitr + " --ns-from=test." + collection + " --ns-to=test.test"
        result=cluster.exec_pbm_cli("restore" + backup_to_fail + " --wait")
        assert result.rc != 0
>       assert "cloning namespace (--ns-to) is already in use" in result.stderr
E       AssertionError: assert 'cloning namespace (--ns-to) is already in use' in 'Error: parse --ns-from and --ns-to options: cloning with restore to the point-in-time is not possible\n'
E        +  where 'Error: parse --ns-from and --ns-to options: cloning with restore to the point-in-time is not possible\n' = CommandResult(backend=<testinfra.backend.docker.DockerBackend object at 0x7f3e73ca4590>, exit_status=1, command=b'pbm ...'', _stderr=b'Error: parse --ns-from and --ns-to options: cloning with restore to the point-in-time is not possible\n').stderr

test_rename_replicaset.py:129: AssertionError
backup=pitr + " --ns-from=test." + collection + " --ns-to=restored." + collection
cluster.make_restore(backup)
client = pymongo.MongoClient(cluster.connection)
assert client["test"]["inserts"].count_documents({})==20
assert client["test"]["replaces"].count_documents({})==10
assert client["test"]["updates"].count_documents({})==10
assert client["test"]["deletes"].count_documents({})==0
if collection=='inserts':
assert client["restored"]["inserts"].count_documents({})==20
for i in range(20):
assert client["restored"]["inserts"].find_one({"key": i, "data": i})
elif collection=='replaces':
assert client["restored"]["replaces"].count_documents({})==10
for i in range(10):
assert client["restored"]["replaces"].find_one({"key": i+10, "data": i+10})
elif collection=='updates':
assert client["restored"]["updates"].count_documents({})==10
for i in range(10):
assert client["restored"]["updates"].find_one({"key": i, "data": i+10})
else:
assert client["restored"]["deletes"].count_documents({})==0
Cluster.log("Finished successfully")
Loading