Skip to content

Commit

Permalink
PBM-1171 backups should fail on preflight checks
Browse files Browse the repository at this point in the history
  • Loading branch information
olexandr-havryliak committed Sep 15, 2023
1 parent ef20064 commit 66d5d41
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pbm-functional/pytest/test_PBM-1171.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,10 @@ def test_physical_mixed_env(start_cluster,cluster):
Cluster.ce_to_psmdb("rscfg02")
Cluster.ce_to_psmdb("rscfg03")

#one shard - CE, backup should fail
#one shard - CE, backup should fail on preflight check
Cluster.psmdb_to_ce("rs101")

Check failure on line 72 in pbm-functional/pytest/test_PBM-1171.py

View workflow job for this annotation

GitHub Actions / JUnit Test Report

test_PBM-1171.test_physical_mixed_env

AssertionError: Unexpected exit code 1 for CommandResult(command=b"mongo --quiet --eval 'db.hello().secondary'", exit_status=1, stdout=b"Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed: SocketException: Error connecting to 127.0.0.1:27017 :: caused by :: Connection refused :\nconnect@src/mongo/shell/mongo.js:372:17\n@(connect):3:6\nexception: connect failed\nexiting with code 1\n", stderr=None) assert 1 == 0 + where 1 = CommandResult(command=b"mongo --quiet --eval 'db.hello().secondary'", exit_status=1, stdout=b"Error: couldn't connect ...onnect@src/mongo/shell/mongo.js:372:17\n@(connect):3:6\nexception: connect failed\nexiting with code 1\n", stderr=None).rc
Raw output
start_cluster = True, cluster = <cluster.Cluster object at 0x7fc70fa4f6d0>

    @pytest.mark.testcase(test_case_key="T248", test_step_key=1)
    @pytest.mark.timeout(600,func_only=True)
    def test_physical_mixed_env(start_cluster,cluster):
        cluster.check_pbm_status()
        pymongo.MongoClient(cluster.connection)["test"]["test"].insert_many(documents)
    
        #primary cfgsrv - CE, else - PSMDB, backup should pass
        Cluster.psmdb_to_ce("rscfg01")
        cluster.check_pbm_status()
        assert cluster.exec_pbm_cli("backup -t physical --wait").rc == 0
        Cluster.ce_to_psmdb("rscfg01")
    
        #primary cfgsrv - PSMDB, else - CE, backup should pass
        Cluster.psmdb_to_ce("rscfg02")
        Cluster.psmdb_to_ce("rscfg03")
        cluster.check_pbm_status()
        assert cluster.exec_pbm_cli("backup -t physical --wait").rc == 0
        Cluster.ce_to_psmdb("rscfg02")
        Cluster.ce_to_psmdb("rscfg03")
    
        #one shard - CE, backup should fail on preflight check
>       Cluster.psmdb_to_ce("rs101")

test_PBM-1171.py:72: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

host = 'rs101'

    @staticmethod
    def psmdb_to_ce(host):
        n=testinfra.get_host("docker://" + host)
        state=n.check_output("mongo --quiet --eval 'db.hello().secondary'")
        Cluster.log("Is mongodb on " + host + " secondary? - " + state)
        n.check_output('supervisorctl stop mongod')
        n.check_output('supervisorctl start mongod-ce')
        Cluster.log("Node " + host + " is now running mongodb CE")
        n.check_output('supervisorctl restart pbm-agent')
        timeout = time.time() + 30
        while True:
>           newstate=n.check_output("mongo --quiet --eval 'db.hello().secondary'")
E           AssertionError: Unexpected exit code 1 for CommandResult(command=b"mongo --quiet --eval 'db.hello().secondary'", exit_status=1, stdout=b"Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed: SocketException: Error connecting to 127.0.0.1:27017 :: caused by :: Connection refused :\nconnect@src/mongo/shell/mongo.js:372:17\n@(connect):3:6\nexception: connect failed\nexiting with code 1\n", stderr=None)
E           assert 1 == 0
E            +  where 1 = CommandResult(command=b"mongo --quiet --eval 'db.hello().secondary'", exit_status=1, stdout=b"Error: couldn't connect ...onnect@src/mongo/shell/mongo.js:372:17\n@(connect):3:6\nexception: connect failed\nexiting with code 1\n", stderr=None).rc

cluster.py:928: AssertionError
Cluster.psmdb_to_ce("rs102")
Cluster.psmdb_to_ce("rs103")
cluster.check_pbm_status()
assert cluster.exec_pbm_cli("backup -t physical --wait").rc == 1
assert cluster.exec_pbm_cli("backup -t physical").rc == 1
assert cluster.exec_pbm_cli("backup -t physical -o json").rc == 1

0 comments on commit 66d5d41

Please sign in to comment.