Esempio n. 1
0
        def morph(name, cluster_info):
            cluster_info2 = {}

            for node_id, (ips, port) in cluster_info.iteritems():
                cluster_info2[node_id] = (ips, port)

            return compat.ArakoonClient(
                compat.ArakoonClientConfig(name, cluster_info2))
Esempio n. 2
0
    def setUpNursery(self, name, config_template):
        '''Launch an Arakoon nursery keeper daemon process

        :param name: Cluster name
        :type name: `str`
        :param config_template: Configuration file template
        :type config_template: `str`

        :return: Client configuration tuple, config path and base path
        :rtype: `((str, dict<str, (str, int)>), str, str)`
        '''

        client_config, config_path, base = self.setUpArakoon(
            name, config_template)

        #pylint: disable=W0142
        compat_client_config = compat.ArakoonClientConfig(*client_config)

        # Give server some time to get up
        ok = False
        for _ in xrange(5):
            LOGGER.info('Attempting hello call')
            try:
                client_ = compat.ArakoonClient(compat_client_config)
                client_.hello('testsuite', compat_client_config.getClusterId())
                client_.dropConnections() #pylint: disable=W0212
            except: #pylint: disable=W0702
                LOGGER.exception('Call failed, sleeping')
            else:
                LOGGER.debug('Call succeeded')
                ok = True
                break

        if not ok:
            raise RuntimeError('Unable to start Arakoon server')

        subprocess.check_call([
            'arakoon', '-config', config_path, '--nursery-init',
            client_config[0]
        ], close_fds=True, cwd=base)

        time.sleep(5)

        return client_config, config_path, base
Esempio n. 3
0
 def _create_client(self):
     client = compat.ArakoonClient(self.client_config)
     client.hello('testsuite', self.client_config.getClusterId())
     return client
Esempio n. 4
0
    def test_hello(self):
        '''Test validation of the argument of the `hello` method'''

        client = compat.ArakoonClient(None)

        self.assertRaises(compat.ArakoonInvalidArguments, client.hello, 123)