Example #1
0
def make_entry(rt_name, results_all):
    user = getpass.getuser()
    hostname = socket.gethostname()
    date = dtu.format_datetime_as_YYYY_MM_DD(datetime.now())
    import platform

    cpu = platform.processor()
    try:
        branch = git_cmd("git rev-parse --abbrev-ref HEAD")
        commit = git_cmd("git rev-parse --verify HEAD")
    except dtu.CmdException:
        dtu.logger.info("no repo detected")
        branch = "not-available"
        commit = "not-available"
    current = ResultDBEntry(
        regression_test_name=rt_name,
        date=date,
        host=hostname,
        cpu=cpu,
        user=user,
        results=results_all,
        branch=branch,
        commit=commit,
    )
    return current
Example #2
0
def get_test_db():
    results = {
        "analyzer": {
            "log1": {
                "value2": 1,
                "composite": {
                    "a": 2,
                    "b": {
                        "c": 3
                    }
                },
            }
        }
    }
    current = ResultDBEntry(regression_test_name="",
                            date="",
                            host="",
                            cpu="",
                            user="",
                            results=results,
                            branch="",
                            commit="")

    rdb = ResultDB(current=current, entries=[])
    return rdb
Example #3
0
def get_test_db():
    results = {"analyzer": {"log1": {"value2": 2, "value3": 3, "changed": 98, "same": 10,}}}
    current = ResultDBEntry(
        regression_test_name="", date="", host="", cpu="", user="", results=results, branch="", commit=""
    )
    results_old = {"analyzer": {"log1": {"value2": 2, "value3": 3, "same": 10, "changed": 100,}}}
    old = ResultDBEntry(
        regression_test_name="",
        date=parse_date_spec("2017-01-01"),
        host="",
        cpu="",
        user="",
        results=results_old,
        branch="",
        commit="commit-id",
    )
    rdb = ResultDB(current=current, entries=[old])
    return rdb
Example #4
0
def get_test_db():
    results = {
        'analyzer': {
            'log1': {
                'value2': 2,
                'value3': 3,
                'changed': 98,
                'same': 10,
            }
        }
    }
    current = ResultDBEntry(regression_test_name='',
                            date='',
                            host='',
                            cpu='',
                            user='',
                            results=results,
                            branch='',
                            commit='')
    results_old = {
        'analyzer': {
            'log1': {
                'value2': 2,
                'value3': 3,
                'same': 10,
                'changed': 100,
            }
        }
    }
    old = ResultDBEntry(regression_test_name='',
                        date=parse_date_spec('2017-01-01'),
                        host='',
                        cpu='',
                        user='',
                        results=results_old,
                        branch='',
                        commit='commit-id')
    rdb = ResultDB(current=current, entries=[old])
    return rdb
Example #5
0
def get_test_db():
    results = {'analyzer': {
    'log1': {
        'value2': 1,
        'composite': {'a':2, 'b':{'c':3}},
    }}}
    current = ResultDBEntry(regression_test_name='',
                            date='',
                           host='',
                           cpu='',
                           user='',
                           results=results,
                           branch='',
                           commit='')

    rdb = ResultDB(current=current, entries=[])
    return rdb
Example #6
0
def make_entry(rt_name, results_all):
    user = getpass.getuser()
    hostname = socket.gethostname()
    date = dtu.format_datetime_as_YYYY_MM_DD(datetime.now())
    import platform
    cpu = platform.processor()
    branch = git_cmd('git rev-parse --abbrev-ref HEAD')
    commit = git_cmd('git rev-parse --verify HEAD')
    current = ResultDBEntry(regression_test_name=rt_name,
                            date=date,
                            host=hostname,
                            cpu=cpu,
                            user=user,
                            results=results_all,
                            branch=branch,
                            commit=commit)
    return current
Example #7
0
def rdbe_from_yaml(**parameters):
    return ResultDBEntry(**parameters)
Example #8
0
def yaml_from_rdbe(r: ResultDBEntry) -> str:
    d = {}
    d["description"] = "The result of running a unit test"
    d["constructor"] = "easy_regression.rdbe_from_yaml"
    d["parameters"] = r._asdict()
    return dtu.yaml_dump_pretty(d)