Beispiel #1
0
    def test_execute_interrupted(self, mri_mock):
        output = dict(records={}, tests={})
        quorum = mock.Mock()
        quorum.execute.return_value = {'the-agent': {'status': 'interrupted'}}
        execution = {
            'tests': [{
                'title': 'tcp',
                'class': 'iperf'
            }, {
                'title': 'udp',
                'class': 'netperf'
            }]
        }
        agents = {'the-agent': {'id': 'the-agent', 'mode': 'alone'}}

        server.execute(output, quorum, execution, agents)

        expected_records = {
            'UUID': {
                'agent': 'the-agent',
                'concurrency': 1,
                'executor': 'iperf',
                'id': 'UUID',
                'node': None,
                'status': 'interrupted',
                'test': 'tcp',
                'type': 'agent'
            }
        }
        expected_tests = {'tcp': {'title': 'tcp', 'class': 'iperf'}}

        self.assertEqual(expected_records, output['records'])
        self.assertEqual(expected_tests, output['tests'])
Beispiel #2
0
    def _run(self, agent_id, item):
        self.quorum.join({agent_id})
        agents = dict([(agent_id, dict(id=agent_id, mode='alone'))])

        test = {'class': 'shell'}
        test.update(item)

        execution = {'tests': [test]}
        output = dict(records={}, agents={}, tests={})
        server.execute(output, self.quorum, execution, agents)

        return list(output['records'].values())[0]
Beispiel #3
0
    def _run(self, agent_id, item):
        self.quorum.join({agent_id})
        agents = dict([(agent_id, dict(id=agent_id, mode='alone'))])

        test = {'class': 'shell'}
        test.update(item)

        execution = {'tests': [test]}
        output = dict(records={}, agents={}, tests={})
        server.execute(output, self.quorum, execution, agents)

        return list(output['records'].values())[0]
Beispiel #4
0
    def _run(self, agent_id, item):
        self.quorum.join({agent_id})
        agents = dict([(agent_id, dict(id=agent_id, mode='alone'))])

        test = {'class': 'shell'}
        test.update(item)

        execution = {'tests': [test]}
        execution_result = server.execute(self.quorum, execution, agents)

        return list(execution_result.values())[0]
Beispiel #5
0
    def _run(self, agent_id, item):
        self.quorum.join({agent_id})
        agents = dict([(agent_id, dict(id=agent_id, mode='alone'))])

        test = {'class': 'shell'}
        test.update(item)

        execution = {'tests': [test]}
        execution_result = server.execute(self.quorum, execution, agents)

        return list(execution_result.values())[0]
Beispiel #6
0
    def _run(self, agent_id, item):
        agents = dict([(agent_id, dict(id=agent_id, mode='alone'))])

        test = {'class': 'shell'}
        test.update(item)

        execution = {'tests': [test]}
        execution_result = server.execute(self.quorum, execution, agents)

        results_per_iteration = execution_result[0]['results_per_iteration']
        results_per_agent = results_per_iteration[0]['results_per_agent']
        return dict((s['agent']['id'], s) for s in results_per_agent)
Beispiel #7
0
    def _run(self, agent_id, item):
        agents = dict([(agent_id, dict(id=agent_id, mode='alone'))])

        test = {'class': 'shell'}
        test.update(item)

        execution = {'tests': [test]}
        execution_result = server.execute(self.quorum, execution, agents)

        results_per_iteration = execution_result[0]['results_per_iteration']
        results_per_agent = results_per_iteration[0]['results_per_agent']
        return dict((s['agent']['id'], s) for s in results_per_agent)
Beispiel #8
0
    def test_execute(self, mri_mock):
        output = dict(records={}, tests={})
        quorum = mock.Mock()
        quorum.execute.return_value = {'the-agent': {'status': 'ok'}}
        execution = {'tests': [{'title': 'tcp', 'class': 'iperf'}]}
        agents = {'the-agent': {'id': 'the-agent', 'mode': 'alone'}}

        server.execute(output, quorum, execution, agents)

        expected_records = {
            'UUID': {
                'agent': 'the-agent', 'concurrency': 1, 'executor': 'iperf',
                'id': 'UUID', 'node': None, 'status': 'ok', 'test': 'tcp',
                'type': 'agent'
            }
        }
        expected_tests = {
            'tcp': {'title': 'tcp', 'class': 'iperf'}
        }

        self.assertEqual(expected_records, output['records'])
        self.assertEqual(expected_tests, output['tests'])