aboutsummaryrefslogtreecommitdiffstats
path: root/tests/conftest.py
blob: 8e812d6623560d16d4f9ea19d1381218d0f63ae1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
##############################################################################
# Copyright (c) 2016 ZTE Corp and others.
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################

from os import path

import pytest


@pytest.fixture(scope='session')
def data_root():
    return path.join(path.dirname(__file__), 'data')


@pytest.fixture(scope='session')
def benchmarks_root(data_root):
    return path.join(data_root, 'benchmarks')


@pytest.fixture(scope='session')
def metrics():
    return {
        "ssl_rsa": {
            "rsa_sign": [500],
            "rsa_verify": [600]
        }
    }


@pytest.fixture(scope='session')
def metric_spec():
    return {
        "name": "ssl_rsa",
        "workloads": [
            {"name": "rsa_sign"},
            {"name": "rsa_verify"}
        ]
    }


@pytest.fixture(scope='session')
def section_spec(metric_spec):
    return {
        "name": "ssl",
        "description": "cryptography and SSL/TLS performance",
        "metrics": [metric_spec]
    }


@pytest.fixture(scope='session')
def qpi_spec(section_spec):
    return {
        "name": "compute",
        "description": "QTIP Performance Index of compute",
        "sections": [section_spec]
    }


@pytest.fixture(scope='session')
def rsa_sign_baseline():
    return {'name': 'rsa_sign', 'baseline': '500'}


@pytest.fixture(scope='session')
def rsa_verify_baseline():
    return {"name": "rsa_verify", "baseline": 600}


@pytest.fixture(scope='session')
def metric_baseline(rsa_sign_baseline, rsa_verify_baseline):
    return {
        "name": "ssl_rsa",
        "workloads": [rsa_sign_baseline, rsa_verify_baseline]
    }


@pytest.fixture(scope='session')
def section_baseline(metric_baseline):
    return {
        "name": "ssl",
        "metrics": [metric_baseline]
    }


@pytest.fixture(scope='session')
def qpi_baseline(section_baseline):
    return {
        "name": "compute-baseline",
        "description": "The baseline for compute QPI",
        "score": 2048,
        "sections": [section_baseline]
    }


@pytest.fixture(scope='session')
def metric_result():
    return {'score': 1.0,
            'name': 'ssl_rsa',
            'description': 'metric',
            'workloads': [{'description': 'workload', 'name': 'rsa_sign',
                           'score': 1.0, 'result': 500},
                          {'description': 'workload', 'name': 'rsa_verify',
                           'score': 1.0, 'result': 600}]}


@pytest.fixture(scope='session')
def section_result(metric_result):
    return {'score': 1.0,
            'name': 'ssl',
            'description': 'cryptography and SSL/TLS performance',
            'metrics': [metric_result]}


@pytest.fixture(scope='session')
def info():
    return {
        "system_info": {
            "kernel": "4.4.0-72-generic x86_64 (64 bit)",
            "product": "EC600G3",
            "os": "Ubuntu 16.04 xenial",
            "cpu": "2 Deca core Intel Xeon E5-2650 v3s (-HT-MCP-SMP-)",
            "disk": "1200.3GB (25.1% used)",
            "memory": "30769.7/128524.1MB"
        }
    }


@pytest.fixture(scope='session')
def spec():
    """ refers to resources/QPI/compute.yaml """
    return {
        "sections": [{
            "name": "ssl",
            "description": "cryptography and SSL/TLS performance",
            "metrics": [{
                "workloads": [
                    {"name": "rsa_sign",
                     "description": "rsa x bits sign per second"},
                    {"name": "rsa_verify",
                     "description": "rsa x bits verify per second"}]
            }]
        }]
    }


@pytest.fixture(scope='session')
def qpi_result(section_result, info):
    return {'score': 2048,
            'name': 'compute',
            'description': 'QTIP Performance Index of compute',
            'system_info': info,
            'sections': [section_result],
            'spec': "https://git.opnfv.org/qtip/tree/resources/QPI/compute.yaml",
            'baseline': "https://git.opnfv.org/qtip/tree/resources/QPI/compute-baseline.json",
            }


@pytest.fixture(scope='session')
def aggregated_report(qpi_result):
    return {
        'score': 2017,
        'name': 'compute',
        'description': 'POD compute QPI',
        'nodes': [qpi_result]
    }