Example #1
0
 def test_config_true_value(self, mocked):
     utils.TRUE_VALUES = 'hello world'.split()
     for val in 'hello world HELLO WORLD'.split():
         self.assertTrue(utils.config_true_value(val) is True)
         self.assertTrue(utils.config_true_value(True) is True)
         self.assertTrue(utils.config_true_value('foo') is False)
         self.assertTrue(utils.config_true_value(False) is False)
 def test_config_true_value(self, mocked):
     utils.TRUE_VALUES = 'hello world'.split()
     for val in 'hello world HELLO WORLD'.split():
         self.assertTrue(utils.config_true_value(val) is True)
         self.assertTrue(utils.config_true_value(True) is True)
         self.assertTrue(utils.config_true_value('foo') is False)
         self.assertTrue(utils.config_true_value(False) is False)
Example #3
0
 def __init__(self, logger, conf):
     self.logger = logger
     self.conf = conf
     self.names = []
     self.delete = config_true_value(conf.delete)
     self.gets = int(conf.num_gets)
     self.aborted = False
     self.delay = int(self.conf.delay)
Example #4
0
    def __init__(self, logger, conf, names):
        self.logger = logger
        self.aborted = False
        self.user = conf.user
        self.key = conf.key
        self.auth_url = conf.auth
        self.use_proxy = config_true_value(conf.use_proxy)
        if not self.use_proxy and direct_client is None:
            self.logger.critical("You need to have swift installed if you are "
                                 "not using the proxy")
            sys.exit(1)
        self.auth_version = conf.auth_version
        self.logger.info("Auth version: %s" % self.auth_version)
        if self.use_proxy:
            if using_http_proxy(self.auth_url):
                logger.warn("Auth is going through HTTP proxy server. This "
                            "could affect test result")
            url, token = client.get_auth(self.auth_url,
                                         self.user,
                                         self.key,
                                         auth_version=self.auth_version)
            self.token = token
            self.account = url.split('/')[-1]
            if conf.url == '':
                self.url = url
            else:
                self.url = conf.url
        else:
            self.token = 'SlapChop!'
            self.account = conf.account
            self.url = conf.url
            self.ip, self.port = self.url.split('/')[2].split(':')

        if using_http_proxy(self.url):
            logger.warn("Communication with Swift server is going through "
                        "HTTP proxy server. This could affect test result")

        self.object_size = int(conf.object_size)
        self.object_sources = conf.object_sources
        self.lower_object_size = int(conf.lower_object_size)
        self.upper_object_size = int(conf.upper_object_size)
        self.files = []
        if self.object_sources:
            self.object_sources = self.object_sources.split()
            self.files = [file(f, 'rb').read() for f in self.object_sources]

        self.put_concurrency = int(conf.put_concurrency)
        self.get_concurrency = int(conf.get_concurrency)
        self.del_concurrency = int(conf.del_concurrency)
        self.total_objects = int(conf.num_objects)
        self.total_gets = int(conf.num_gets)
        self.timeout = int(conf.timeout)
        self.devices = conf.devices.split()
        self.names = names
        self.conn_pool = ConnectionPool(
            self.url,
            max(self.put_concurrency, self.get_concurrency,
                self.del_concurrency))
Example #5
0
    def __init__(self, logger, conf, names):
        self.logger = logger
        self.aborted = False
        self.user = conf.user
        self.key = conf.key
        self.auth_url = conf.auth
        self.use_proxy = config_true_value(conf.use_proxy)
        if not self.use_proxy and direct_client is None:
            self.logger.critical("You need to have swift installed if you are "
                                 "not using the proxy")
            sys.exit(1)
        self.auth_version = conf.auth_version
        self.logger.info("Auth version: %s" % self.auth_version)
        if self.use_proxy:
            if using_http_proxy(self.auth_url):
                logger.warn("Auth is going through HTTP proxy server. This "
                            "could affect test result")
            url, token = client.get_auth(self.auth_url, self.user, self.key,
                                         auth_version=self.auth_version)
            self.token = token
            self.account = url.split('/')[-1]
            if conf.url == '':
                self.url = url
            else:
                self.url = conf.url
        else:
            self.token = 'SlapChop!'
            self.account = conf.account
            self.url = conf.url
            self.ip, self.port = self.url.split('/')[2].split(':')

        if using_http_proxy(self.url):
            logger.warn("Communication with Swift server is going through "
                        "HTTP proxy server. This could affect test result")

        self.object_size = int(conf.object_size)
        self.object_sources = conf.object_sources
        self.lower_object_size = int(conf.lower_object_size)
        self.upper_object_size = int(conf.upper_object_size)
        self.files = []
        if self.object_sources:
            self.object_sources = self.object_sources.split()
            self.files = [file(f, 'rb').read() for f in self.object_sources]

        self.put_concurrency = int(conf.put_concurrency)
        self.get_concurrency = int(conf.get_concurrency)
        self.del_concurrency = int(conf.del_concurrency)
        self.total_objects = int(conf.num_objects)
        self.total_gets = int(conf.num_gets)
        self.timeout = int(conf.timeout)
        self.devices = conf.devices.split()
        self.names = names
        self.conn_pool = ConnectionPool(self.url,
                                        max(self.put_concurrency,
                                            self.get_concurrency,
                                            self.del_concurrency))