예제 #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)