Skip to content

Commit

Permalink
PBM-1057 check PITR on PSA infrastructure
Browse files Browse the repository at this point in the history
  • Loading branch information
olexandr-havryliak committed Aug 26, 2024
1 parent 015d0a5 commit 5b4a071
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 3 deletions.
7 changes: 4 additions & 3 deletions pbm-functional/pytest/cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -547,12 +547,13 @@ def enable_pitr(self,**kwargs):
result = n.check_output(
"pbm config --set pitr.enabled=true --set pitr.compression=none --out json " + pitr_extra_args)
Cluster.log("Enabling PITR: " + result)
timeout = time.time() + 600
timeout = time.time() + 150
while True:
if self.check_pitr():
break
if time.time() > timeout:
assert False
status=self.get_status()['pitr']
assert False, status
time.sleep(1)

# disables PITR
Expand All @@ -561,7 +562,7 @@ def disable_pitr(self):
result = n.check_output(
"pbm config --set pitr.enabled=false --out json")
Cluster.log("Disabling PITR: " + result)
timeout = time.time() + 600
timeout = time.time() + 150
while True:
if not self.check_pitr():
break
Expand Down
28 changes: 28 additions & 0 deletions pbm-functional/pytest/test_PBM-979.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,34 @@ def test_logical_PBM_T233(start_cluster,cluster):
assert pymongo.MongoClient(cluster.connection)["test"]["test"].count_documents({}) == len(documents)
Cluster.log("Finished successfully")

@pytest.mark.timeout(600,func_only=True)
def test_logical_pitr_PBM_T263(start_cluster,cluster):
time.sleep(5) # wait for delayed node
cluster.check_pbm_status()
pymongo.MongoClient(cluster.connection)["test"]["test"].insert_many(documents)
backup=cluster.make_backup("logical")
#check if the backup was taken from the hidden node
logs=cluster.exec_pbm_cli("logs -n rs1/rs103:27017 -e backup -o json").stdout
assert backup in logs
Cluster.log("Logs from hidden node:\n" + logs)
cluster.enable_pitr(pitr_extra_args="--set pitr.oplogSpanMin=0.5")

Check failure on line 92 in pbm-functional/pytest/test_PBM-979.py

View workflow job for this annotation

GitHub Actions / JUnit Test Report

test_PBM-979.test_logical_pitr_PBM_T263

AssertionError: {'conf': True, 'run': False, 'nodes': None, 'error': '2024-08-26T13:50:20.000+0000 E [rs1/rs101:27017] [pitr] reconciling ready status: timeout while roconciling ready status'}
Raw output
start_cluster = True, cluster = <cluster.Cluster object at 0x7f2a2d2e4b10>

    @pytest.mark.timeout(600,func_only=True)
    def test_logical_pitr_PBM_T263(start_cluster,cluster):
        time.sleep(5) # wait for delayed node
        cluster.check_pbm_status()
        pymongo.MongoClient(cluster.connection)["test"]["test"].insert_many(documents)
        backup=cluster.make_backup("logical")
        #check if the backup was taken from the hidden node
        logs=cluster.exec_pbm_cli("logs -n rs1/rs103:27017 -e backup -o json").stdout
        assert backup in logs
        Cluster.log("Logs from hidden node:\n" + logs)
>       cluster.enable_pitr(pitr_extra_args="--set pitr.oplogSpanMin=0.5")

test_PBM-979.py:92: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <cluster.Cluster object at 0x7f2a2d2e4b10>
kwargs = {'pitr_extra_args': '--set pitr.oplogSpanMin=0.5'}
n = <testinfra.host.Host docker://rs101>
pitr_extra_args = '--set pitr.oplogSpanMin=0.5'
result = '[{"key":"pitr.enabled","value":"true"},{"key":"pitr.compression","value":"none"},{"key":"pitr.oplogSpanMin","value":"0.5"}]'
timeout = 1724680221.2632923
status = {'conf': True, 'error': '2024-08-26T13:50:20.000+0000 E [rs1/rs101:27017] [pitr] reconciling ready status: timeout while roconciling ready status', 'nodes': None, 'run': False}

    def enable_pitr(self,**kwargs):
        n = testinfra.get_host("docker://" + self.pbm_cli)
        pitr_extra_args = kwargs.get('pitr_extra_args', "")
        result = n.check_output(
            "pbm config --set pitr.enabled=true --set pitr.compression=none --out json " + pitr_extra_args)
        Cluster.log("Enabling PITR: " + result)
        timeout = time.time() + 150
        while True:
            if self.check_pitr():
                break
            if time.time() > timeout:
                status=self.get_status()['pitr']
>               assert False, status
E               AssertionError: {'conf': True, 'run': False, 'nodes': None, 'error': '2024-08-26T13:50:20.000+0000 E [rs1/rs101:27017] [pitr] reconciling ready status: timeout while roconciling ready status'}

cluster.py:556: AssertionError
pymongo.MongoClient(cluster.connection)["test"]["pitr"].insert_many(documents)
time.sleep(10)
pitr = datetime.utcnow().strftime("%Y-%m-%dT%H:%M:%S")
backup="--time=" + pitr
Cluster.log("Time for PITR is: " + pitr)
time.sleep(60)
cluster.disable_pitr()
time.sleep(10)
result=pymongo.MongoClient(cluster.connection)["test"]["test"].delete_many({})
result=pymongo.MongoClient(cluster.connection)["test"]["pitr"].delete_many({})
cluster.make_restore(backup)
time.sleep(5) # wait for delayed node
cluster.check_pbm_status()
assert pymongo.MongoClient(cluster.connection)["test"]["test"].count_documents({}) == len(documents)
assert pymongo.MongoClient(cluster.connection)["test"]["pitr"].count_documents({}) == len(documents)
Cluster.log("Finished successfully")

@pytest.mark.timeout(300,func_only=True)
def test_physical_PBM_T195(start_cluster,cluster):
time.sleep(5) # wait for delayed node
Expand Down

0 comments on commit 5b4a071

Please sign in to comment.