def test_test_runs_with_metdata(self, api_mock, write_mock, session_mock):
     out = mock.MagicMock()
     write_subunit.sql2subunit('fake_id', out)
     self.assertEqual(write_mock.call_count, 1)
     args = write_mock.call_args_list[0][0]
     self.assertEqual(timestamp_a, args[1])
     self.assertEqual(timestamp_b, args[2])
     self.assertEqual('success', args[3])
     self.assertEqual('fake_test_id', args[4])
     self.assertEqual({'key': 'value'}, args[5])
Exemple #2
0
def main():
    shell.parse_args([])
    shell.CONF.set_override('connection', DB_URI, group='database')
    session = api.get_session()
    run_ids = get_run_ids(session)
    session.close()
    preseed_path = os.path.join(TEMPEST_PATH, 'preseed-streams')
    os.mkdir(preseed_path)
    for run in run_ids:
        with open(os.path.join(preseed_path, run + '.subunit'), 'w') as fd:
            write_subunit.sql2subunit(run, fd)
def main():
    shell.parse_args([])
    shell.CONF.set_override('connection', DB_URI, group='database')
    session = api.get_session()
    run_ids = get_run_ids(session)
    session.close()
    preseed_path = os.path.join(TEMPEST_PATH, 'preseed-streams')
    os.mkdir(preseed_path)
    for run in run_ids:
        with open(os.path.join(preseed_path, run + '.subunit'), 'w') as fd:
            write_subunit.sql2subunit(run, fd)
def main():
    shell.parse_args([])
    shell.CONF.set_override('connection', DB_URI, group='database')
    session = api.get_session()
    runs = api.get_recent_successful_runs_by_run_metadata(
        'build_name', 'gate-tempest-dsvm-neutron-full',
        num_runs=10, session=session)
    session.close()
    preseed_path = os.path.join(TEMPEST_PATH, 'preseed-streams')
    if not os.path.isdir(preseed_path):
        os.mkdir(preseed_path)
    for run in runs:
        with open(os.path.join(preseed_path, run.uuid + '.subunit'), 'w') as fd:
            write_subunit.sql2subunit(run.uuid, fd)
Exemple #5
0
def main():
    shell.parse_args([])
    shell.CONF.set_override('connection', DB_URI, group='database')
    session = api.get_session()
    runs = api.get_recent_successful_runs_by_run_metadata(
        'build_name',
        'gate-tempest-dsvm-neutron-full',
        num_runs=10,
        session=session)
    session.close()
    preseed_path = os.path.join(TEMPEST_PATH, 'preseed-streams')
    if not os.path.isdir(preseed_path):
        os.mkdir(preseed_path)
    for run in runs:
        with open(os.path.join(preseed_path, run.uuid + '.subunit'),
                  'w') as fd:
            write_subunit.sql2subunit(run.uuid, fd)
Exemple #6
0
def main():
    shell.parse_args([])
    shell.CONF.set_override('connection', DB_URI, group='database')

    preseed_path = os.path.join(TEMPEST_PATH, 'preseed-streams')
    os.mkdir(preseed_path)
    try:
        session = api.get_session()
        run_ids = api.get_recent_successful_runs(num_runs=10, session=session)
        session.close()
        for run in run_ids:
            with open(os.path.join(preseed_path, run + '.subunit'), 'w') as fd:
                write_subunit.sql2subunit(run, fd)
    except:
        # copy the static preseed files if failed to get preseeds from logstash
        src_dir = "/opt/nodepool-scripts/"
        for file in os.listdir(src_dir):
            if file.endswith(".subunit"):
                file_path = os.path.join(src_dir, file)
                shutil.copy(file_path, preseed_path)