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-1367 check sharded timeseries #192

Merged
merged 2 commits into from
Aug 13, 2024
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions pbm-functional/pytest/cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,7 @@ def make_backup(self, type):
if snapshot['name'] == name:
if snapshot['status'] == 'done':
Cluster.log("Backup found: " + str(snapshot))
time.sleep(1) #wait for releasing locks
return name
break
elif snapshot['status'] == 'error':
Expand Down
1 change: 0 additions & 1 deletion pbm-functional/pytest/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
version: "3"
services:
test:
build:
Expand Down
31 changes: 31 additions & 0 deletions pbm-functional/pytest/test_timeseries.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,34 @@
assert pymongo.MongoClient(cluster.connection)["test"].command("collstats", "test1").get("sharded", False)
assert pymongo.MongoClient(cluster.connection)["test"].command("collstats", "test2").get("sharded", False)
Cluster.log("Finished successfully")

@pytest.mark.timeout(600,func_only=True)
def test_logical_PBM_T261(start_cluster,cluster):
cluster.check_pbm_status()
assert pymongo.MongoClient(cluster.connection)["test"].command("collstats", "test1").get("sharded", False)
assert pymongo.MongoClient(cluster.connection)["test"].command("collstats", "test2").get("sharded", False)
result=cluster.exec_pbm_cli('backup -t logical --wait')
assert result.rc != 0, result.stdout

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

View workflow job for this annotation

GitHub Actions / JUnit Test Report

test_timeseries.test_logical_PBM_T261

AssertionError: Starting backup '2024-08-13T09:57:45Z'.... Waiting for '2024-08-13T09:57:45Z' backup................... done assert 0 != 0 + where 0 = CommandResult(backend=<testinfra.backend.docker.DockerBackend object at 0x7f46d6797ed0>, exit_status=0, command=b'pbm ...backup '2024-08-13T09:57:45Z'....\nWaiting for '2024-08-13T09:57:45Z' backup................... done\n\n", _stderr=b'').rc
Raw output
start_cluster = True, cluster = <cluster.Cluster object at 0x7f46d674db10>

    @pytest.mark.timeout(600,func_only=True)
    def test_logical_PBM_T261(start_cluster,cluster):
        cluster.check_pbm_status()
        assert pymongo.MongoClient(cluster.connection)["test"].command("collstats", "test1").get("sharded", False)
        assert pymongo.MongoClient(cluster.connection)["test"].command("collstats", "test2").get("sharded", False)
        result=cluster.exec_pbm_cli('backup -t logical --wait')
>       assert result.rc != 0, result.stdout
E       AssertionError: Starting backup '2024-08-13T09:57:45Z'....
E         Waiting for '2024-08-13T09:57:45Z' backup................... done
E         
E         
E       assert 0 != 0
E        +  where 0 = CommandResult(backend=<testinfra.backend.docker.DockerBackend object at 0x7f46d6797ed0>, exit_status=0, command=b'pbm ...backup '2024-08-13T09:57:45Z'....\nWaiting for '2024-08-13T09:57:45Z' backup................... done\n\n", _stderr=b'').rc

test_timeseries.py:87: AssertionError
assert 'check for timeseries: cannot backup following sharded timeseries: test.test1, test.test2' in result.stderr
Cluster.log("Finished successfully")

@pytest.mark.timeout(600,func_only=True)
def test_incremental_PBM_T262(start_cluster,cluster):
cluster.check_pbm_status()
assert pymongo.MongoClient(cluster.connection)["test"].command("collstats", "test1").get("sharded", False)
assert pymongo.MongoClient(cluster.connection)["test"].command("collstats", "test2").get("sharded", False)
for i in range(10):
pymongo.MongoClient(cluster.connection)["test"]["test1"].insert_one({"timestamp": datetime.now(), "data": i})
time.sleep(0.1)
base_backup=cluster.make_backup("incremental --base")
for i in range(10):
pymongo.MongoClient(cluster.connection)["test"]["test2"].insert_one({"timestamp": datetime.now(), "data": i})
time.sleep(0.1)
backup=cluster.make_backup("incremental")
pymongo.MongoClient(cluster.connection).drop_database('test')
cluster.make_restore(backup,restart_cluster=True,check_pbm_status=True)
assert pymongo.MongoClient(cluster.connection)["test"]["test1"].count_documents({}) == 10
assert pymongo.MongoClient(cluster.connection)["test"]["test2"].count_documents({}) == 10
assert pymongo.MongoClient(cluster.connection)["test"].command("collstats", "test1").get("sharded", False)
assert pymongo.MongoClient(cluster.connection)["test"].command("collstats", "test2").get("sharded", False)
Cluster.log("Finished successfully")
Loading