Exemple #1
0
    def test_launch(self):
        subject = SystemTest(Configuration('test/src/system/system-manual.yml'))
        subject.launch_system()

        print 'getting manager...'
        manager = subject.create_manager()
        l = InventoryListener()
        manager.add_listener(l)
        print 'sending inventory request...'
        manager.send_request(InventoryRequest(), component_filter=component_id('AGENT'))
        time.sleep(30)
        print 'inventory: '+ repr(l)
        print 'inventory: '+ repr(l.inventory)
        self.show_inventory()
Exemple #2
0
def main():
    log = logging.getLogger('test')
    config = read_test_configuration()
#    _step('config:\n' + pformat(config.as_dict()))
    _step('read config file')
    test = SystemTest(config)
    running = False
    try:
        _step('first see if there is already a running cluster')
        _exists()
        test.reconnect_system()
        running = True
    except:
        log.warn('did not reconnect', exc_info=True)
        _exists()
        _step('failed to connect to running cluster, launching new one instead')
        try:
            test.launch_system()
            running = True
        except Exception,e:
            log.error('test failed', exc_info=True)
Exemple #3
0
def main():
    config = Configuration('resources/manual-system-launch.yml')
    test = SystemTest(config)
    try:
        test.reconnect_system()
    except:
        pass ## will fail to connect to cloudinitd, but should reconnect rabbit anyway

    inventory = test.get_inventory()
    inventory_time = time.time()
    _step('inventory: ' + ', '.join(inventory.keys()))

    _step('performing base preload')
    test.init_system()

    config = test.get_preload_template()
    nrange = test.get_preload_range(config)
    for n in nrange:
        _step("starting device %d"%n)
        test.init_device(config,n)
    _step('all done')
Exemple #4
0
def main():
    start_time = time.time()
    log = logging.getLogger('test')
    config = read_test_configuration()
    #    _step('config:\n' + pformat(config.as_dict()))
    _step('read config file')
    test = SystemTest(config)

    try:
        _step('connecting to agent')
        test.reconnect_system(cloudinitd=False, filter=agent_id('server'))
        test.system = None

        _step('taking inventory')
        inventory = test.get_inventory()
        _step('inventory: ' + ', '.join(inventory.keys()))

        _step('performing base preload')
        preload_start_time = time.time()
        test.init_system()
        preload_time = time.time()
        _step("preload took %.2f seconds" % (preload_time-preload_start_time))

        config = test.get_preload_template()
        nrange = test.get_preload_range(config)
        for n in nrange:
            _step("starting device %d"%n)
            device_begin = time.time()
            test.init_device(config,n, catch_up_frequency=1000) # some tests do not run logging_transform
            elapsed = time.time() - device_begin
            _step("completed device %d launch in %f seconds" % (n,elapsed))
            time.sleep(120)
            _rates(test.get_message_rates())

        _step('performing test')
        results = test.perform_test()
        _step('*** test completed! ***')
        if results:
            _step('results: ' + str(results))
    except Exception,e:
        log.error('test failed', exc_info=True)
Exemple #5
0
def main():
    start_time = time.time()
    log = logging.getLogger('test')
    config = read_test_configuration()
    _step('read config file')
    test = SystemTest(config)

    try:
        _step('launching system')
        test.launch_system()
        launch_time = time.time()
        _step("launch took %.2f seconds" % (launch_time-start_time))

        _step('taking inventory')
        inventory = test.get_inventory()
        inventory_time = time.time()
        _step('inventory: ' + ', '.join(inventory.keys()))
        _step('performing base preload')
        test.init_system()
        preload_time = time.time()
        _step("preload took %.2f seconds" % (preload_time-launch_time))

        config = test.get_preload_template()
        nrange = test.get_preload_range(config)
        for n in nrange:
            _step("starting device %d"%n)
            device_begin = time.time()
            test.init_device(config,n, catch_up_frequency=50)
            elapsed = time.time() - device_begin
            _step("completed device %d launch in %f seconds" % (n,elapsed))
            _rates(test.get_message_rates(), n)

        _step('performing test')
        results = test.perform_test()
        _step('*** test completed! ***')
        if results:
            _step('results: ' + str(results))
    except Exception,e:
        log.error('test failed @ %s', time.ctime(), exc_info=True)