Exemplo n.º 1
0
def main():
    cmd = 'cd %s/tests && ./run.sh' % DOCTOR_REPO
    start_time = time.time()

    ret = functest_utils.execute_command(cmd, logger, exit_on_error=False)

    stop_time = time.time()
    duration = round(stop_time - start_time, 1)
    if ret == 0:
        logger.info("doctor OK")
        test_status = 'OK'
    else:
        logger.info("doctor FAILED")
        test_status = 'NOK'

    details = {
        'timestart': start_time,
        'duration': duration,
        'status': test_status,
    }
    pod_name = functest_utils.get_pod_name(logger)
    scenario = functest_utils.get_scenario(logger)
    version = functest_utils.get_version(logger)
    build_tag = functest_utils.get_build_tag(logger)

    status = "FAIL"
    if details['status'] == "OK":
        status = "PASS"

    logger.info("Pushing Doctor results: TEST_DB_URL=%(db)s pod_name=%(pod)s "
                "version=%(v)s scenario=%(s)s criteria=%(c)s details=%(d)s" % {
                    'db': TEST_DB_URL,
                    'pod': pod_name,
                    'v': version,
                    's': scenario,
                    'c': status,
                    'b': build_tag,
                    'd': details,
                })
    functest_utils.push_results_to_db("doctor",
                                      "doctor-notification",
                                      logger,
                                      start_time,
                                      stop_time,
                                      status,
                                      details)
Exemplo n.º 2
0
def main():
    cmd = 'cd %s/tests && ./run.sh' % DOCTOR_REPO
    start_time = time.time()

    ret = functest_utils.execute_command(cmd, logger, exit_on_error=False)

    stop_time = time.time()
    duration = round(stop_time - start_time, 1)
    if ret:
        logger.info("doctor OK")
        test_status = 'OK'
    else:
        logger.info("doctor FAILED")
        test_status = 'NOK'

    details = {
        'timestart': start_time,
        'duration': duration,
        'status': test_status,
    }
    pod_name = functest_utils.get_pod_name(logger)
    scenario = functest_utils.get_scenario(logger)
    version = functest_utils.get_version(logger)
    build_tag = functest_utils.get_build_tag(logger)

    status = "failed"
    if details['status'] == "OK":
        status = "passed"

    logger.info("Pushing Doctor results: TEST_DB_URL=%(db)s pod_name=%(pod)s "
                "version=%(v)s scenario=%(s)s criteria=%(c)s details=%(d)s" % {
                    'db': TEST_DB_URL,
                    'pod': pod_name,
                    'v': version,
                    's': scenario,
                    'c': status,
                    'b': build_tag,
                    'd': details,
                })
    functest_utils.push_results_to_db("doctor",
                                      "doctor-notification",
                                      logger,
                                      start_time,
                                      stop_time,
                                      status,
                                      details)
Exemplo n.º 3
0
def main():
    cmd = ('%s/tests/run.sh' % COPPER_REPO)
    start_time = time.time()

    ret = functest_utils.execute_command(cmd, logger, exit_on_error=False)

    stop_time = time.time()
    duration = round(stop_time - start_time, 1)
    if ret == 0:
        logger.info("COPPER PASSED")
        test_status = 'PASS'
    else:
        logger.info("COPPER FAILED")
        test_status = 'FAIL'

    details = {
        'timestart': start_time,
        'duration': duration,
        'status': test_status,
    }
    pod_name = functest_utils.get_pod_name(logger)
    scenario = functest_utils.get_scenario(logger)
    version = functest_utils.get_version(logger)
    build_tag = functest_utils.get_build_tag(logger)

    logger.info("Pushing COPPER results: TEST_DB_URL=%(db)s pod_name=%(pod)s "
                "version=%(v)s scenario=%(s)s criteria=%(c)s details=%(d)s" % {
                    'db': TEST_DB_URL,
                    'pod': pod_name,
                    'v': version,
                    's': scenario,
                    'c': details['status'],
                    'b': build_tag,
                    'd': details,
                })
    functest_utils.push_results_to_db("COPPER",
                                      "COPPER-notification",
                                      logger,
                                      start_time,
                                      stop_time,
                                      details['status'],
                                      details)
 def test_get_version_unknown(self):
     CONST.__setattr__('BUILD_TAG', 'unknown_build_tag')
     self.assertEqual(functest_utils.get_version(), "unknown")
 def test_get_version_with_dummy_build_tag(self):
     CONST.__setattr__('BUILD_TAG', 'whatever')
     self.assertEqual(functest_utils.get_version(), 'unknown')
 def test_get_version_weekly_job(self):
     CONST.__setattr__('BUILD_TAG', self.build_tag_week)
     self.assertEqual(functest_utils.get_version(), self.version)
Exemplo n.º 7
0
 def test_get_version_unknown(self, mock_get_build_tag):
     mock_get_build_tag.return_value = "unknown_build_tag"
     self.assertEqual(functest_utils.get_version(), "unknown")
Exemplo n.º 8
0
 def test_get_version_with_dummy_build_tag(self, mock_get_build_tag):
     mock_get_build_tag.return_value = 'whatever'
     self.assertEqual(functest_utils.get_version(), 'unknown')
Exemplo n.º 9
0
 def test_get_version_weekly_job(self, mock_get_build_tag):
     mock_get_build_tag.return_value = self.build_tag_week
     self.assertEqual(functest_utils.get_version(), self.version)
Exemplo n.º 10
0
 def test_get_version_default(self, mock_get_build_tag):
     mock_get_build_tag.return_value = self.build_tag
     self.assertEqual(functest_utils.get_version(), self.version)