Skip to content

[PBM-1228] Support multiple storages #308

[PBM-1228] Support multiple storages

[PBM-1228] Support multiple storages #308

GitHub Actions / JUnit Test Report failed Jun 13, 2024 in 0s

16 tests run, 15 passed, 0 skipped, 1 failed.

Annotations

Check failure on line 88 in psmdb-testing/pbm-functional/pytest/test_PBM-1090.py

See this annotation in the file changed.

@github-actions github-actions / JUnit Test Report

test_PBM-1090.test_logical_PBM_T204

AssertionError: Backup failedpanic: errors: *target must be interface or implement error

goroutine 1 [running]:
errors.As({0x14eb360, 0xc000196130}, {0xe5c540, 0xc000196138})
	/usr/local/go/src/errors/wrap.go:111 +0x206
github.com/pkg/errors.As(...)
	/percona-backup-mongodb/vendor/github.com/pkg/errors/go113.go:31
github.com/percona/percona-backup-mongodb/pbm/errors.As(...)
	/percona-backup-mongodb/pbm/errors/errors.go:33
main.runBackup({0x14f3818, 0xc00012f2f0}, {0x14f8ad0, 0xc000128640}, {0x14fb6d0, 0xc0005b2740}, 0xc000221500, {0x7ffc96163de9, 0x4})
	/percona-backup-mongodb/cmd/pbm/backup.go:107 +0x2b7
main.main()
	/percona-backup-mongodb/cmd/pbm/main.go:488 +0xabd9
Raw output
start_cluster = True, cluster = <cluster.Cluster object at 0x7feacc840cb0>

    @pytest.mark.timeout(300,func_only=True)
    def test_logical_PBM_T204(start_cluster,cluster):
        cluster.check_pbm_status()
    
        client = pymongo.MongoClient(cluster.connection)
        db = client.test
        collection = db.test
        Cluster.log("Create collection, unique index and insert data")
        collection.insert_one({"a": 1, "b": 1, "c": 1})
        collection.create_index([("a",1),("b",1),("c",1)], name='test_index', unique = True)
        res = pymongo.MongoClient(cluster.connection)["test"]["test"].find({})
        Cluster.log('Collection:')
        for r in res:
            Cluster.log(r)
    
        def upsert_1():
            Cluster.log("Starting background upsert 1")
            while upsert:
                query = {"a": 1}
                update = {"$set": {"a": 1, "b": 1, "c": 1}}
                pymongo.MongoClient(cluster.connection)['test']['test'].delete_one(query)
                try:
                    doc = pymongo.MongoClient(cluster.connection)['test']['test'].find_one_and_update(query,update,upsert=True,return_document=pymongo.collection.ReturnDocument.AFTER)
                    #Cluster.log(doc)
                except pymongo.errors.DuplicateKeyError:
                    pass
            Cluster.log("Stopping background upsert 1")
    
        def upsert_2():
            Cluster.log("Starting background upsert 2")
            while upsert:
                query = {"b": 1}
                update = {"$set": {"a": 2, "b": 1, "c": 1}}
                pymongo.MongoClient(cluster.connection)['test']['test'].delete_one(query)
                try:
                    doc = pymongo.MongoClient(cluster.connection)['test']['test'].find_one_and_update(query,update,upsert=True,return_document=pymongo.collection.ReturnDocument.AFTER)
                    #Cluster.log(doc)
                except pymongo.errors.DuplicateKeyError:
                    pass
            Cluster.log("Stopping background upsert 2")
    
        upsert=True
        t1 = threading.Thread(target=upsert_1)
        t2 = threading.Thread(target=upsert_2)
        t1.start()
        t2.start()
    
>       backup = cluster.make_backup("logical")

test_PBM-1090.py:88: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <cluster.Cluster object at 0x7feacc840cb0>, type = 'logical'

    def make_backup(self, type):
        n = testinfra.get_host("docker://" + self.pbm_cli)
        timeout = time.time() + 120
        while True:
            running = self.get_status()['running']
            Cluster.log("Current operation: " + str(running))
            if not running:
                if type:
                    start = n.run(
                        'pbm backup --out=json --type=' + type)
                else:
                    start = n.run('pbm backup --out=json')
                if start.rc == 0:
                    name = json.loads(start.stdout)['name']
                    Cluster.log("Backup started")
                    break
                elif "resync" in start.stdout:
                    Cluster.log("Resync in progress, retrying: " + start.stdout)
                else:
>                   assert False, "Backup failed" + start.stdout + start.stderr
E                   AssertionError: Backup failedpanic: errors: *target must be interface or implement error
E                   
E                   goroutine 1 [running]:
E                   errors.As({0x14eb360, 0xc000196130}, {0xe5c540, 0xc000196138})
E                   	/usr/local/go/src/errors/wrap.go:111 +0x206
E                   github.com/pkg/errors.As(...)
E                   	/percona-backup-mongodb/vendor/github.com/pkg/errors/go113.go:31
E                   github.com/percona/percona-backup-mongodb/pbm/errors.As(...)
E                   	/percona-backup-mongodb/pbm/errors/errors.go:33
E                   main.runBackup({0x14f3818, 0xc00012f2f0}, {0x14f8ad0, 0xc000128640}, {0x14fb6d0, 0xc0005b2740}, 0xc000221500, {0x7ffc96163de9, 0x4})
E                   	/percona-backup-mongodb/cmd/pbm/backup.go:107 +0x2b7
E                   main.main()
E                   	/percona-backup-mongodb/cmd/pbm/main.go:488 +0xabd9

cluster.py:392: AssertionError