Пример #1
0
    def test_shard_create(self):
        with mock.patch.object(self.transport, 'send',
                               autospec=True) as send_method:
            resp = response.Response(None, None)
            send_method.return_value = resp

            req = request.Request()
            core.shard_create(self.transport, req,
                              'test_shard', {'uri': 'sqlite://',
                                             'weight': 0})
Пример #2
0
    def ensure_exists(self):
        """Ensures shard exists

        This method is not race safe,
        the shard could've been deleted
        right after it was called.
        """
        req, trans = self.client._request_and_transport()

        data = {"uri": self.uri, "weight": self.weight, "options": self.options}

        core.shard_create(trans, req, self.name, data)
Пример #3
0
    def ensure_exists(self):
        """Ensures shard exists

        This method is not race safe,
        the shard could've been deleted
        right after it was called.
        """
        req, trans = self.client._request_and_transport()

        data = {
            'uri': self.uri,
            'weight': self.weight,
            'options': self.options
        }

        core.shard_create(trans, req, self.name, data)