Exemplo n.º 1
0
def main():
    """Execute Main program."""

    options = parse_command_line().parse_args()
    configure_logging(options.log_level, options.evg_client_log_level)
    evg_api = evg_client.EvergreenApiV2(
        api_headers=evg_client.get_evergreen_headers())

    LOGGER.info("Getting the patch version builds")
    burn_in_builds = get_burn_in_builds(evg_api, options.project, options.days)

    LOGGER.info("Getting the build tasks")
    burn_in_tasks = get_burn_in_tasks(evg_api, burn_in_builds)

    LOGGER.info("Getting the task tests")
    burn_in_tests = get_tests_from_tasks(evg_api, burn_in_tasks)

    comment = (
        "Metrics for patch builds running burn_in_tests in {} for the last {} days -"
        " generated on {}Z").format(options.project, options.days,
                                    datetime.datetime.utcnow().isoformat())

    report = Report(burn_in_builds,
                    burn_in_tasks,
                    burn_in_tests,
                    comment=comment)
    report_result = report.generate_report()
    write_json_file(report_result, options.report_file)
    LOGGER.info("%s", report_result)
Exemplo n.º 2
0
 def test_get_evergreen_headers(self):
     api_key = "mykey"
     user = "******"
     evg_config = {"api_key": api_key, "user": user}
     with patch(EVERGREEN + ".read_evg_config", return_value=evg_config):
         api_headers = evergreen.get_evergreen_headers()
         self.assertEqual(api_key, api_headers["api-key"])
         self.assertEqual(user, api_headers["api-user"])
Exemplo n.º 3
0
 def test_get_evergreen_headers(self):
     api_key = "mykey"
     user = "******"
     evg_config = {"api_key": api_key, "user": user}
     with patch(EVERGREEN + ".read_evg_config", return_value=evg_config):
         api_headers = evergreen.get_evergreen_headers()
         self.assertEqual(api_key, api_headers["api-key"])
         self.assertEqual(user, api_headers["api-user"])
Exemplo n.º 4
0
 def test_get_evergreen_headers_no_api_key(self):
     data_key = "data1"
     data_val = "val1"
     user = "******"
     evg_config = {"user": user, data_key: data_val}
     with patch(EVERGREEN + ".read_evg_config", return_value=evg_config):
         api_headers = evergreen.get_evergreen_headers()
         self.assertEqual(user, api_headers["api-user"])
         self.assertNotIn("api-key", api_headers)
         self.assertNotIn(data_key, api_headers)
Exemplo n.º 5
0
 def test_get_evergreen_headers_no_api_key(self):
     data_key = "data1"
     data_val = "val1"
     user = "******"
     evg_config = {"user": user, data_key: data_val}
     with patch(EVERGREEN + ".read_evg_config", return_value=evg_config):
         api_headers = evergreen.get_evergreen_headers()
         self.assertEqual(user, api_headers["api-user"])
         self.assertNotIn("api-key", api_headers)
         self.assertNotIn(data_key, api_headers)
Exemplo n.º 6
0
def main():
    """Execute Main program."""

    options = parse_command_line().parse_args()
    configure_logging(options.log_level, options.evg_client_log_level)
    evg_api = evg_client.EvergreenApiV2(api_headers=evg_client.get_evergreen_headers())

    LOGGER.info("Getting the patch version builds")
    burn_in_builds = get_burn_in_builds(evg_api, options.project, options.days)

    LOGGER.info("Getting the build tasks")
    burn_in_tasks = get_burn_in_tasks(evg_api, burn_in_builds)

    LOGGER.info("Getting the task tests")
    burn_in_tests = get_tests_from_tasks(evg_api, burn_in_tasks)

    comment = ("Metrics for patch builds running burn_in_tests in {} for the last {} days -"
               " generated on {}Z").format(options.project, options.days,
                                           datetime.datetime.utcnow().isoformat())

    report = Report(burn_in_builds, burn_in_tasks, burn_in_tests, comment=comment)
    report_result = report.generate_report()
    write_json_file(report_result, options.report_file)
    LOGGER.info("%s", report_result)
Exemplo n.º 7
0
 def test_get_evergreen_headers_no_data(self):
     evg_config = {}
     with patch(EVERGREEN + ".read_evg_config", return_value=evg_config):
         api_headers = evergreen.get_evergreen_headers()
         self.assertDictEqual(evg_config, api_headers)
Exemplo n.º 8
0
 def test_get_evergreen_headers_none(self):
     with patch(EVERGREEN + ".read_evg_config", return_value=None):
         api_headers = evergreen.get_evergreen_headers()
         self.assertDictEqual({}, api_headers)
Exemplo n.º 9
0
 def test_get_evergreen_headers_no_data(self):
     evg_config = {}
     with patch(EVERGREEN + ".read_evg_config", return_value=evg_config):
         api_headers = evergreen.get_evergreen_headers()
         self.assertDictEqual(evg_config, api_headers)
Exemplo n.º 10
0
 def test_get_evergreen_headers_none(self):
     with patch(EVERGREEN + ".read_evg_config", return_value=None):
         api_headers = evergreen.get_evergreen_headers()
         self.assertDictEqual({}, api_headers)