diff options
50 files changed, 936 insertions, 193 deletions
diff --git a/qtip/api/cmd/__init__.py b/legacy/api/cmd/__init__.py index e69de29b..e69de29b 100644 --- a/qtip/api/cmd/__init__.py +++ b/legacy/api/cmd/__init__.py diff --git a/qtip/api/cmd/server.py b/legacy/api/cmd/server.py index eea45ad3..eea45ad3 100644 --- a/qtip/api/cmd/server.py +++ b/legacy/api/cmd/server.py diff --git a/legacy/api/router/mapper.py b/legacy/api/router/mapper.py index 8839f3f5..cd21fbe1 100644 --- a/legacy/api/router/mapper.py +++ b/legacy/api/router/mapper.py @@ -1,4 +1,4 @@ -from legacy.api.handler import Job, JobList +from legacy.api.handler.job_handler import Job, JobList mappers = [ diff --git a/legacy/assets/perftest/common/sys_info_pbook.yaml b/legacy/assets/perftest/common/sys_info_pbook.yaml deleted file mode 100644 index 5c2d8f79..00000000 --- a/legacy/assets/perftest/common/sys_info_pbook.yaml +++ /dev/null @@ -1,42 +0,0 @@ - - name: Epel Release install when CentOS - shell: sudo yum install epel-release -y - when: ansible_os_family == "RedHat" - - - name: Inxi install when CentOS - shell: sudo yum install inxi -y - when: ansible_os_family == "RedHat" - - - name: Software Properties Common - shell: sudo apt-get install software-properties-common -y - when: ansible_os_family == "Debian" - - - name: adding trusty-backport main repo - shell: sudo apt-add-repository "deb http://archive.ubuntu.com/ubuntu/ trusty-backports main restricted universe multiverse" - when: ansible_os_family == "Debian" - - - name: adding trusty main repo - shell: sudo apt-add-repository "deb http://archive.ubuntu.com/ubuntu/ trusty main restricted universe multiverse" - when: ansible_os_family == "Debian" - - - name: system info collection tool install when Ubuntu - shell: sudo apt-get update && apt-get install inxi -y - when: ansible_os_family == "Debian" - - - name: Install ansible copy dependencies if remote host has selinux enabled - shell: sudo yum install libselinux-python -y - when: ansible_os_family == "RedHat" - - - name: Install ansiblle copy dependencies if remote host has selinux enaled - shell: sudo apt-get install python-selinux -y - when: ansible_os_family == "Debian" - - - name: system_info script copy - copy: src=../etc/info_collect.py dest={{home_dir.stdout}}/qtip_result/ - - - name: collecting system informaton for non-network test cases - shell: cd $HOME/qtip_result && sudo python info_collect.py c - when: not network - - - name: collecting system information for network test cases - shell: cd $HOME/qtip_result && sudo python info_collect.py n - when: network diff --git a/qtip/base/__init__.py b/qtip/base/__init__.py index e69de29b..909703ed 100644 --- a/qtip/base/__init__.py +++ b/qtip/base/__init__.py @@ -0,0 +1,19 @@ +############################################################################## +# Copyright (c) 2017 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 +############################################################################## + + +class BaseActor(object): + """abstract actor class""" + + def __init__(self, config, parent=None): + self._config = config + self._parent = parent + + def get_config(self, key, default=None): + return self._config.get(key, default) diff --git a/qtip/base/constant.py b/qtip/base/constant.py index 39572040..09c635ac 100644 --- a/qtip/base/constant.py +++ b/qtip/base/constant.py @@ -35,6 +35,7 @@ class BaseProp(object): # content DESCRIPTION = 'description' WORKLOADS = 'workloads' + TYPE = 'type' class SpecProp(BaseProp): @@ -46,29 +47,5 @@ class SpecProp(BaseProp): WORKLOADS = 'workloads' -class PlanProp(BaseProp): - # plan - INFO = 'info' - - FACILITY = 'facility' - ENGINEER = 'engineer' - - CONFIG = 'config' - - DRIVER = 'driver' - COLLECTOR = 'collector' - REPORTER = 'reporter' - - QPIS = 'QPIs' - - -class CollectorProp(BaseProp): - LOGS = 'logs' - FILENAME = 'filename' - GREP = 'grep' - REGEX = 'regex' - CAPTURE = 'capture' - - class ReporterBaseProp(BaseProp): TRANSFORMER = 'transformer' diff --git a/qtip/base/error.py b/qtip/base/error.py index 01a7f7a6..a055aa8d 100644 --- a/qtip/base/error.py +++ b/qtip/base/error.py @@ -8,22 +8,23 @@ ############################################################################## -class QtipError(Exception): +class BaseError(Exception): pass -class InvalidFormat(QtipError): - def __init__(self, filename): +class InvalidContent(BaseError): + def __init__(self, filename, excinfo=None): self.filename = filename + self.excinfo = excinfo -class NotFound(QtipError): +class NotFound(BaseError): def __init__(self, module, package='qtip'): self.package = package self.module = module -class ToBeDoneError(QtipError): +class ToBeDoneError(BaseError): """something still to be done""" def __init__(self, method, module): self.method = method diff --git a/qtip/cli/commands/cmd_metric.py b/qtip/cli/commands/cmd_metric.py index d2fbd58f..aa4df1f4 100644 --- a/qtip/cli/commands/cmd_metric.py +++ b/qtip/cli/commands/cmd_metric.py @@ -27,7 +27,7 @@ def cmd_list(ctx): pass -@cli.command('run', help='Run tests to collect Performance Metrics') +@cli.command('run', help='Run tests to run Performance Metrics') @click.argument('name') @pass_context def cmd_run(ctx, name): diff --git a/qtip/cli/commands/cmd_plan.py b/qtip/cli/commands/cmd_plan.py index 0c0a3c12..c1dd7cf6 100644 --- a/qtip/cli/commands/cmd_plan.py +++ b/qtip/cli/commands/cmd_plan.py @@ -24,11 +24,8 @@ def cli(ctx): @cli.command('init', help='Initialize Environment') -@click.option('--inst_type', prompt='Installer Type') -@click.option('--inst_ip', prompt='Installer IP') -@click.option('--ext_net', prompt='Openstack External Network') @pass_context -def init(ctx, inst_type, inst_ip, ext_net): +def init(ctx): pass diff --git a/qtip/collector/__init__.py b/qtip/collector/__init__.py index e69de29b..cc957ba4 100644 --- a/qtip/collector/__init__.py +++ b/qtip/collector/__init__.py @@ -0,0 +1,25 @@ +############################################################################## +# Copyright (c) 2017 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 qtip.base.constant import BaseProp +from qtip.collector.parser.grep import GrepParser + + +class CollectorProp(BaseProp): + TYPE = 'type' + PARSERS = 'parsers' + PATHS = 'paths' + + +def load_parser(type_name): + if type_name == GrepParser.TYPE: + return GrepParser + else: + raise Exception("Invalid parser type: {}".format(type_name)) diff --git a/qtip/collector/logfile.py b/qtip/collector/logfile.py index 19780aaa..2c2e532f 100644 --- a/qtip/collector/logfile.py +++ b/qtip/collector/logfile.py @@ -7,32 +7,49 @@ # http://www.apache.org/licenses/LICENSE-2.0 ############################################################################## -from base import BaseCollector +from itertools import chain +from six.moves import reduce +import os -from qtip.base.constant import CollectorProp as CProp +from qtip.base import BaseActor +from qtip.collector import load_parser +from qtip.collector import CollectorProp as CProp from qtip.loader.file import FileLoader -class LogfileCollector(BaseCollector): - """collect performance metrics from log files""" +class LogItem(BaseActor): + def find(self, filename, paths=None): + return self._parent.find(filename, paths) - def __init__(self, config, paths=None): + +class LogfileCollector(BaseActor): + """run performance metrics from log files""" + TYPE = 'logfile' + LOGS = 'logs' + PATHS = 'paths' + + def __init__(self, config, parent=None): super(LogfileCollector, self).__init__(config) - self.loader = FileLoader('.', paths) - - def collect(self): - captured = {} - for item in self._config[CProp.LOGS]: - captured.update(self._parse_log(item)) - return captured - - def _parse_log(self, log_item): - captured = {} - # TODO(yujunz) select parser by name - if CProp.GREP in log_item: - for rule in log_item[CProp.GREP]: - captured.update(self._grep(log_item[CProp.FILENAME], rule)) - return captured - - def _grep(self, filename, rule): - return {} + self._parent = parent # plan + # TODO(yujunz) handle exception of invalid parent + dirname = os.path.dirname(self._parent.abspath) + paths = [os.path.join(dirname, p) for p in config.get(self.PATHS, [])] + self._loader = FileLoader('.', paths) + + def run(self): + collected = [] + for log_item_config in self._config[self.LOGS]: + log_item = LogItem(log_item_config, self) + matches = [load_parser(c[CProp.TYPE])(c, log_item).run() + for c in log_item.get_config(CProp.PARSERS)] + collected = chain(collected, reduce(chain, matches)) + return reduce(merge_matchobj_to_dict, collected, {'groups': (), 'groupdict': {}}) + + def find(self, filename, paths=None): + return self._loader.find(filename, paths) + + +def merge_matchobj_to_dict(d, m): + d['groups'] = chain(d['groups'], m.groups()) + d['groupdict'].update(m.groupdict()) + return d diff --git a/tests/unit/__init__.py b/qtip/collector/parser/__init__.py index e69de29b..e69de29b 100644 --- a/tests/unit/__init__.py +++ b/qtip/collector/parser/__init__.py diff --git a/qtip/collector/parser/grep.py b/qtip/collector/parser/grep.py new file mode 100644 index 00000000..d7ada485 --- /dev/null +++ b/qtip/collector/parser/grep.py @@ -0,0 +1,33 @@ +############################################################################## +# Copyright (c) 2017 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 +############################################################################## + + +import re + + +from qtip.base.constant import BaseProp +from qtip.base import BaseActor + + +class GrepProp(BaseProp): + FILENAME = 'filename' + REGEX = 'regex' + + +class GrepParser(BaseActor): + TYPE = 'grep' + + def run(self): + filename = self._parent.get_config(GrepProp.FILENAME) + return grep_in_file(self._parent.find(filename), self._config[GrepProp.REGEX]) + + +def grep_in_file(filename, regex): + with open(filename, 'r') as f: + return filter(lambda x: x is not None, [re.search(regex, line) for line in f]) diff --git a/tests/unit/cli/__init__.py b/qtip/driver/ansible/__init__.py index e69de29b..e69de29b 100644 --- a/tests/unit/cli/__init__.py +++ b/qtip/driver/ansible/__init__.py diff --git a/qtip/driver/ansible.py b/qtip/driver/ansible/ansible.py index 04e9f9bd..cd17625d 100644 --- a/qtip/driver/ansible.py +++ b/qtip/driver/ansible/ansible.py @@ -7,7 +7,7 @@ # http://www.apache.org/licenses/LICENSE-2.0 ############################################################################## -from base import BaseDriver +from qtip.driver.base import BaseDriver class AnsibleDriver(BaseDriver): diff --git a/qtip/driver/ansible/playbook/bwn_ng.yaml b/qtip/driver/ansible/playbook/bwn_ng.yaml new file mode 100644 index 00000000..99477856 --- /dev/null +++ b/qtip/driver/ansible/playbook/bwn_ng.yaml @@ -0,0 +1,23 @@ +############################################################################## +# Copyright (c) 2017 ZTE Corporation 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 +############################################################################## +- name: Install bwm-ng when CentOS + yum: + name: bwm-ng + state: present + when: ansible_os_family == "RedHat" + +- name: Install bwm-ng when Ubuntu + apt: + name: bwm-ng + state: present + update_cache: yes + when: ansible_os_family == "Debian" + +- name: Run bwm-ng + shell: bwm-ng -o plain -c 1 > $HOME/qtip_result/bwm-dump.log
\ No newline at end of file diff --git a/qtip/driver/ansible/playbook/inxi.yaml b/qtip/driver/ansible/playbook/inxi.yaml new file mode 100644 index 00000000..f6a0311d --- /dev/null +++ b/qtip/driver/ansible/playbook/inxi.yaml @@ -0,0 +1,23 @@ +############################################################################## +# Copyright (c) 2017 ZTE Corporation 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 +############################################################################## +- name: Install Inxi when CentOS + yum: + name: inxi + state: present + when: ansible_os_family == "RedHat" + +- name: Install Inxi when Ubuntu + apt: + name: inxi + state: present + update_cache: yes + when: ansible_os_family == "Debian" + +- name: Run inxi + shell: inxi -b -c0 -n > $HOME/qtip_result/inxi.log diff --git a/qtip/driver/ansible/playbook/prepare_env.yaml b/qtip/driver/ansible/playbook/prepare_env.yaml new file mode 100644 index 00000000..0595d988 --- /dev/null +++ b/qtip/driver/ansible/playbook/prepare_env.yaml @@ -0,0 +1,42 @@ +############################################################################## +# Copyright (c) 2017 ZTE Corporation 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 +############################################################################## +- name: Epel Release install when CentOS + yum: + name: epel-release + state: present + when: ansible_os_family == "RedHat" + +- name: Software Properties Common + apt: + name: software-properties-common + state: present + when: ansible_os_family == "Debian" + +- name: Adding ubuntu backport main repo + apt_repository: + repo: deb http://archive.ubuntu.com/ubuntu/ {{ansible_distribution_release}}-backports main restricted universe multiverse + state: present + when: ansible_os_family == "Debian" + +- name: Adding ubuntu main repo + apt_repository: + repo: deb http://archive.ubuntu.com/ubuntu/ {{ansible_distribution_release}} main restricted universe multiverse + when: ansible_os_family == "Debian" + +- name: Install ansible copy dependencies if remote host has selinux enabled + yum: + name: libselinux-python + state: present + when: ansible_os_family == "RedHat" + +- name: Install ansiblle copy dependencies if remote host has selinux enaled + apt: + name: python-selinux + state: present + when: ansible_os_family == "Debian" diff --git a/qtip/collector/base.py b/qtip/driver/ansible/playbook/top.yaml index 2a25455c..8de7e3d6 100644 --- a/qtip/collector/base.py +++ b/qtip/driver/ansible/playbook/top.yaml @@ -1,14 +1,10 @@ ############################################################################## -# Copyright (c) 2016 ZTE Corp and others. +# Copyright (c) 2017 ZTE Corporation 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 ############################################################################## - - -class BaseCollector(object): - """performance metrics collector""" - def __init__(self, config): - self._config = config +- name: Collect cpu usage + shell: top -bn1 > $HOME/qtip_result/top.log diff --git a/qtip/loader/file.py b/qtip/loader/file.py index 00f94818..0ea4d5b6 100644 --- a/qtip/loader/file.py +++ b/qtip/loader/file.py @@ -25,12 +25,12 @@ class FileLoader(BaseLoader): _paths = [ROOT_DIR] def __init__(self, name, paths=None): - self._file = name - self._abspath = self._find(name, paths=paths) + self._filename = name + self.abspath = self.find(name, paths=paths) - def _find(self, name, paths=None): + def find(self, name, paths=None): """find a specification in searching paths""" - paths = self._paths if paths is None else paths + paths = [self.abspath] if paths is None else paths for p in paths: abspath = path.join(p, self.RELATIVE_PATH, name) if path.exists(abspath): @@ -47,4 +47,4 @@ class FileLoader(BaseLoader): item = cls(name, paths=paths) yield { BaseProp.NAME: name, - BaseProp.ABSPATH: item._abspath} + BaseProp.ABSPATH: item.abspath} diff --git a/qtip/loader/plan.py b/qtip/loader/plan.py index 6f1764e2..e15651a3 100644 --- a/qtip/loader/plan.py +++ b/qtip/loader/plan.py @@ -8,12 +8,21 @@ ############################################################################## -from qtip.base.constant import PlanProp +from qtip.base.constant import BaseProp +from qtip.collector import CollectorProp as CProp from qtip.collector.logfile import LogfileCollector from qtip.loader.yaml_file import YamlFileLoader from qtip.loader.qpi import QPISpec +# TODO(yujunz) more elegant way to load module dynamically +def load_collector(type_name): + if type_name == LogfileCollector.TYPE: + return LogfileCollector + else: + raise Exception("Invalid collector type: {}".format(type_name)) + + class Plan(YamlFileLoader): """ a benchmark plan is consist of configuration and a QPI list @@ -24,10 +33,26 @@ class Plan(YamlFileLoader): def __init__(self, name, paths=None): super(Plan, self).__init__(name, paths) + _config = self.content[PlanProp.CONFIG] + + self.collectors = [load_collector(c[CProp.TYPE])(c, self) + for c in _config[PlanProp.COLLECTORS]] + self.qpis = [QPISpec(qpi, paths=paths) for qpi in self.content[PlanProp.QPIS]] - self.info = self.content[PlanProp.INFO] - _config = self.content[PlanProp.CONFIG] - # TODO(yujunz) create collector by name - self.collector = LogfileCollector(_config[PlanProp.COLLECTOR], paths) + +class PlanProp(BaseProp): + # plan + INFO = 'info' + + FACILITY = 'facility' + ENGINEER = 'engineer' + + CONFIG = 'config' + + DRIVER = 'driver' + COLLECTORS = 'collectors' + REPORTER = 'reporter' + + QPIS = 'QPIs' diff --git a/qtip/loader/yaml_file.py b/qtip/loader/yaml_file.py index f1cd4614..8b78a47c 100644 --- a/qtip/loader/yaml_file.py +++ b/qtip/loader/yaml_file.py @@ -7,11 +7,10 @@ # http://www.apache.org/licenses/LICENSE-2.0 ############################################################################## -from collections import defaultdict from os import path import yaml -from qtip.base.error import InvalidFormat +from qtip.base.error import InvalidContent from qtip.base.constant import BaseProp from qtip.loader.file import FileLoader @@ -21,13 +20,11 @@ class YamlFileLoader(FileLoader): def __init__(self, name, paths=None): super(YamlFileLoader, self).__init__(name, paths) - content = defaultdict(lambda: None) + abspath = self.abspath - try: - content.update(yaml.safe_load(file(self._abspath))) - except yaml.YAMLError: - # TODO(yujunz) log yaml error - raise InvalidFormat(self._abspath) - - self.name = content[BaseProp.NAME] or path.splitext(name)[0] - self.content = content + with open(abspath, 'r') as stream: + content = yaml.safe_load(stream) + if not isinstance(content, dict): + raise InvalidContent(abspath) + self.content = content + self.name = content.get(BaseProp.NAME, path.splitext(name)[0]) diff --git a/qtip/runner/__init__.py b/qtip/runner/__init__.py index 1db8498e..79c38850 100644 --- a/qtip/runner/__init__.py +++ b/qtip/runner/__init__.py @@ -28,16 +28,16 @@ class Runner(object): if driver_name == 'random': self.driver = RandomDriver() else: - raise NotFound(driver_name, package=PkgName.DRIVER) + raise NotFound(driver_name, heystack=PkgName.DRIVER) if collector_name == 'stdout': self.collector = StdoutCollector() else: raise NotFound(collector_name, - package=PkgName.COLLECTOR) + heystack=PkgName.COLLECTOR) if reporter_name == 'console': self.reporter = ConsoleReporter() else: raise NotFound(reporter_name, - package=PkgName.REPORTER) + heystack=PkgName.REPORTER) @@ -14,7 +14,7 @@ setup-hooks = [entry_points] console_scripts = qtip = qtip.cli.entry:cli - qtip-api = qtip.api.cmd.server:main + # TODO(akhil) add qtip-api [files] packages = diff --git a/test-requirements.txt b/test-requirements.txt index 43efcfe6..a5080127 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -2,10 +2,10 @@ # of appearance. Changing the order has an impact on the overall integration # process, which may cause wedges in the gate later. +tox pytest +pytest-cov +coverage pykwalify mock pip_check_reqs -coverage -pytest-cov -tox diff --git a/tests/conftest.py b/tests/conftest.py index 7acb75e6..32042f24 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -12,6 +12,7 @@ from os import path import pytest from qtip.loader.plan import Plan +from qtip.loader.plan import PlanProp @pytest.fixture(scope='session') @@ -26,4 +27,19 @@ def benchmarks_root(data_root): @pytest.fixture(scope='session') def plan(benchmarks_root): - return Plan('fake-plan.yaml', [benchmarks_root]) + return Plan('doctor.yaml', [benchmarks_root]) + + +@pytest.fixture(scope='session') +def plan_config(plan): + return plan.content[PlanProp.CONFIG] + + +@pytest.fixture(scope='session') +def collectors_config(plan_config): + return plan_config[PlanProp.COLLECTORS] + + +@pytest.fixture(scope='session') +def logfile_config(collectors_config): + return collectors_config[0] diff --git a/tests/data/benchmarks/QPI/fake-qpi.yaml b/tests/data/benchmarks/QPI/fake_qpi.yaml index aa1097f4..aa1097f4 100644 --- a/tests/data/benchmarks/QPI/fake-qpi.yaml +++ b/tests/data/benchmarks/QPI/fake_qpi.yaml diff --git a/tests/data/benchmarks/plan/doctor.yaml b/tests/data/benchmarks/plan/doctor.yaml index 6c95077b..f8dcf08d 100644 --- a/tests/data/benchmarks/plan/doctor.yaml +++ b/tests/data/benchmarks/plan/doctor.yaml @@ -4,34 +4,30 @@ info: facility: local engineer: local config: - driver: sample - collector: - - name: logfile + collectors: + - type: logfile + paths: + - '../../external/doctor-verify-apex-sample-master' logs: - filename: doctor_consumer.log - # 2016-12-28 03:16:05,630 consumer.py 26 INFO doctor consumer notified at 1482894965.63 - grep: - - regex: 'doctor consumer notified at \d+(\.\d+)?$' - capture: notified consumer + parsers: + - type: grep + regex: 'doctor consumer notified at (?P<notified>\d+(?:\.\d+)?)$' - filename: doctor_inspector.log - # 2016-12-28 03:16:05,299 inspector.py 76 INFO event posted at 1482894965.3 - # 2016-12-28 03:16:05,299 inspector.py 56 INFO doctor mark vm(<Server: doctor_vm1>) error at 1482894965.3 - # 2016-12-28 03:16:05,506 inspector.py 66 INFO doctor mark host(overcloud-novacompute-1.ool-virtual1) down at 1482894965.51 - grep: - - regex: 'event posted at \d+(\.\d+)?$' - capture: posted event - - regex: 'doctor mark vm\(.*\) error at \d+(\.\d+)?$' - capture: marked VM error - - regex: 'doctor mark host\(.*\) down at \d+(\.\d+)?$' - capture: marked host down + parsers: + - type: grep + regex: 'event posted at (?P<event_posted>\d+(?:\.\d+)?)$' + - type: grep + regex: 'doctor mark vm\(.*\) error at (?P<vm_error>\d+(?:\.\d+)?)$' + - type: grep + regex: 'doctor mark host\(.*\) down at (?P<host_down>\d+(?:\.\d+)?)$' - filename: disable_network.log - # doctor set host down at 1482894965.164096803 - grep: - - regex: 'doctor set host down at \d+(\.\d+)?$' - capture: set host down - reporter: - name: console - # transform collected data into timeline - transformer: timeline + parsers: + - type: grep + regex: 'doctor set host down at (?P<network_down>\d+(?:\.\d+)?)$' + reporters: + - type: console + # transform collected data into timeline + transformer: timeline QPIs: - - fake-qpi.yaml + - fake_qpi.yaml diff --git a/tests/data/benchmarks/plan/fake-plan.yaml b/tests/data/benchmarks/plan/fake-plan.yaml deleted file mode 100644 index 8887f66d..00000000 --- a/tests/data/benchmarks/plan/fake-plan.yaml +++ /dev/null @@ -1,10 +0,0 @@ -name: fake plan -description: fake benchmark plan for demonstration and testing -config: - facility: local - engineer: local - driver: sample - collector: logfile - reporter: console -QPIs: - - fake-qpi.yaml diff --git a/tests/data/external/sysinfo/bwm-dump.log b/tests/data/external/sysinfo/bwm-dump.log new file mode 100644 index 00000000..7072b9c4 --- /dev/null +++ b/tests/data/external/sysinfo/bwm-dump.log @@ -0,0 +1,24 @@ +bwm-ng v0.6 (delay 0.500s); input: /proc/net/dev + iface Rx Tx Total +============================================================================== + ens2f0.211: 0.09 KB/s 0.09 KB/s 0.09 KB/s + ens2f1: 2.11 KB/s 2.11 KB/s 2.11 KB/s + lo: 0.00 KB/s 0.00 KB/s 0.00 KB/s + ens4f0.210: 0.00 KB/s 0.00 KB/s 0.00 KB/s + br-storage: 1.86 KB/s 1.86 KB/s 1.86 KB/s + p_e52381cd-0: 0.00 KB/s 0.00 KB/s 0.00 KB/s + ens4f0: 0.00 KB/s 0.00 KB/s 0.00 KB/s + ens2f1.212: 1.86 KB/s 1.86 KB/s 1.86 KB/s + br-prv: 0.00 KB/s 0.00 KB/s 0.00 KB/s + br-mgmt: 0.09 KB/s 0.09 KB/s 0.09 KB/s + ens4f1: 0.00 KB/s 0.00 KB/s 0.00 KB/s + br-fw-admin: 0.00 KB/s 0.00 KB/s 0.00 KB/s + ens2f0: 166.42 KB/s 166.42 KB/s 166.42 KB/s + p_ff798dba-0: 0.00 KB/s 0.00 KB/s 0.00 KB/s + ens1f1: 0.00 KB/s 0.00 KB/s 0.00 KB/s + br-ex: 0.00 KB/s 0.00 KB/s 0.00 KB/s + br-floating: 0.00 KB/s 0.00 KB/s 0.00 KB/s + br-aux: 0.00 KB/s 0.00 KB/s 0.00 KB/s + ens4f1.213: 0.00 KB/s 0.00 KB/s 0.00 KB/s +------------------------------------------------------------------------------ + total: 172.44 KB/s 172.44 KB/s 172.44 KB/s diff --git a/tests/data/external/sysinfo/inxi.log b/tests/data/external/sysinfo/inxi.log new file mode 100755 index 00000000..c5eb9382 --- /dev/null +++ b/tests/data/external/sysinfo/inxi.log @@ -0,0 +1,20 @@ +System: Host: node-6.zte.com.cn Kernel: 3.13.0-103-generic x86_64 (64 bit) Console: tty 6 Distro: Ubuntu 14.04 trusty +Machine: System: ZTE product: EC600G3 version: 1.00 serial: 123456789 + Mobo: ZTE model: XH20G2 serial: 702471300014 Bios: ZTE version: UBF03.09.59_SVN64446 date: 07/21/2016 +CPU(s): 2 Deca core Intel Xeon CPU E5-2650 v3s (-HT-MCP-SMP-) clocked at 2301.00 MHz +Graphics: Card: Matrox Systems MGA G200e [Pilot] ServerEngines (SEP1) + X-Vendor: N/A driver: N/A tty size: 143x43 Advanced Data: N/A for root out of X +Network: Card-1: Intel 82599 10 Gigabit Dual Port Backplane Connection driver: ixgbe + IF: ens2f0 state: up speed: 10000 Mbps duplex: full mac: 74:4a:a4:01:8b:8b + Card-2: Intel 82599 10 Gigabit Dual Port Backplane Connection driver: ixgbe + IF: ens2f1 state: up speed: 10000 Mbps duplex: full mac: 74:4a:a4:01:8b:8c + Card-3: Intel 82599 10 Gigabit Dual Port Backplane Connection driver: ixgbe + IF: ens1f0 state: down mac: 74:4a:a4:01:8b:87 + Card-4: Intel 82599 10 Gigabit Dual Port Backplane Connection driver: ixgbe + IF: ens1f1 state: up speed: 10000 Mbps duplex: full mac: 74:4a:a4:01:8b:88 + Card-5: Intel I350 Gigabit Backplane Connection driver: igb + IF: ens4f0 state: up speed: 1000 Mbps duplex: full mac: 74:4a:a4:00:dc:de + Card-6: Intel I350 Gigabit Backplane Connection driver: igb + IF: ens4f1 state: up speed: 1000 Mbps duplex: full mac: 74:4a:a4:00:dc:df +Drives: HDD Total Size: 1200.3GB (0.3% used) +Info: Processes: 446 Uptime: 12 days Memory: 1836.1/128527.0MB Runlevel: 2 Client: Shell (bash) inxi: 1.9.17 diff --git a/tests/data/external/sysinfo/top.log b/tests/data/external/sysinfo/top.log new file mode 100644 index 00000000..b2cec325 --- /dev/null +++ b/tests/data/external/sysinfo/top.log @@ -0,0 +1,452 @@ +top - 06:07:47 up 12 days, 3:31, 1 user, load average: 1.10, 1.02, 1.02 +Tasks: 445 total, 2 running, 443 sleeping, 0 stopped, 0 zombie +%Cpu(s): 0.9 us, 0.1 sy, 0.0 ni, 97.0 id, 0.0 wa, 0.0 hi, 1.9 si, 0.0 st +KiB Mem: 13161169+total, 4220448 used, 12739124+free, 212968 buffers +KiB Swap: 4194300 total, 0 used, 4194300 free. 2130872 cached Mem + + PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND + 139 root 20 0 0 0 0 R 70.9 0.0 6308:54 ksoftirqd/10 + 99 root 20 0 0 0 0 S 6.4 0.0 149:00.25 ksoftirqd/2 + 2930 root 20 0 23804 1716 1048 R 6.4 0.0 0:00.01 top +35932 root 10 -10 1571296 181420 6788 S 6.4 0.1 101:17.81 ovs-vswitchd + 1 root 20 0 33864 3216 1436 S 0.0 0.0 0:06.42 init + 2 root 20 0 0 0 0 S 0.0 0.0 0:00.20 kthreadd + 3 root 20 0 0 0 0 S 0.0 0.0 5:27.83 ksoftirqd/0 + 4 root 20 0 0 0 0 S 0.0 0.0 0:38.50 kworker/0:0 + 5 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kworker/0:0H + 8 root 20 0 0 0 0 S 0.0 0.0 74:24.50 rcu_sched + 9 root 20 0 0 0 0 S 0.0 0.0 0:56.03 rcuos/0 + 10 root 20 0 0 0 0 S 0.0 0.0 0:45.86 rcuos/1 + 11 root 20 0 0 0 0 S 0.0 0.0 0:46.93 rcuos/2 + 12 root 20 0 0 0 0 S 0.0 0.0 1:38.51 rcuos/3 + 13 root 20 0 0 0 0 S 0.0 0.0 0:42.34 rcuos/4 + 14 root 20 0 0 0 0 S 0.0 0.0 0:35.74 rcuos/5 + 15 root 20 0 0 0 0 S 0.0 0.0 0:35.59 rcuos/6 + 16 root 20 0 0 0 0 S 0.0 0.0 0:31.38 rcuos/7 + 17 root 20 0 0 0 0 S 0.0 0.0 0:48.62 rcuos/8 + 18 root 20 0 0 0 0 S 0.0 0.0 0:42.36 rcuos/9 + 19 root 20 0 0 0 0 S 0.0 0.0 0:07.89 rcuos/10 + 20 root 20 0 0 0 0 S 0.0 0.0 0:10.09 rcuos/11 + 21 root 20 0 0 0 0 S 0.0 0.0 1:13.81 rcuos/12 + 22 root 20 0 0 0 0 S 0.0 0.0 2:08.89 rcuos/13 + 23 root 20 0 0 0 0 S 0.0 0.0 1:25.84 rcuos/14 + 24 root 20 0 0 0 0 S 0.0 0.0 0:30.09 rcuos/15 + 25 root 20 0 0 0 0 S 0.0 0.0 0:26.71 rcuos/16 + 26 root 20 0 0 0 0 S 0.0 0.0 0:20.49 rcuos/17 + 27 root 20 0 0 0 0 S 0.0 0.0 0:39.43 rcuos/18 + 28 root 20 0 0 0 0 S 0.0 0.0 1:05.52 rcuos/19 + 29 root 20 0 0 0 0 S 0.0 0.0 0:15.04 rcuos/20 + 30 root 20 0 0 0 0 S 0.0 0.0 1:54.76 rcuos/21 + 31 root 20 0 0 0 0 S 0.0 0.0 1:14.99 rcuos/22 + 32 root 20 0 0 0 0 S 0.0 0.0 0:50.07 rcuos/23 + 33 root 20 0 0 0 0 S 0.0 0.0 1:10.15 rcuos/24 + 34 root 20 0 0 0 0 S 0.0 0.0 1:32.73 rcuos/25 + 35 root 20 0 0 0 0 S 0.0 0.0 0:33.40 rcuos/26 + 36 root 20 0 0 0 0 S 0.0 0.0 0:40.64 rcuos/27 + 37 root 20 0 0 0 0 S 0.0 0.0 0:13.61 rcuos/28 + 38 root 20 0 0 0 0 S 0.0 0.0 0:22.56 rcuos/29 + 39 root 20 0 0 0 0 S 0.0 0.0 0:02.76 rcuos/30 + 40 root 20 0 0 0 0 S 0.0 0.0 1:31.70 rcuos/31 + 41 root 20 0 0 0 0 S 0.0 0.0 1:05.86 rcuos/32 + 42 root 20 0 0 0 0 S 0.0 0.0 0:13.69 rcuos/33 + 43 root 20 0 0 0 0 S 0.0 0.0 0:10.67 rcuos/34 + 44 root 20 0 0 0 0 S 0.0 0.0 0:11.19 rcuos/35 + 45 root 20 0 0 0 0 S 0.0 0.0 0:07.07 rcuos/36 + 46 root 20 0 0 0 0 S 0.0 0.0 0:03.94 rcuos/37 + 47 root 20 0 0 0 0 S 0.0 0.0 0:03.07 rcuos/38 + 48 root 20 0 0 0 0 S 0.0 0.0 0:06.25 rcuos/39 + 49 root 20 0 0 0 0 S 0.0 0.0 0:00.02 rcu_bh + 50 root 20 0 0 0 0 S 0.0 0.0 0:00.00 rcuob/0 + 51 root 20 0 0 0 0 S 0.0 0.0 0:00.00 rcuob/1 + 52 root 20 0 0 0 0 S 0.0 0.0 0:00.00 rcuob/2 + 53 root 20 0 0 0 0 S 0.0 0.0 0:00.00 rcuob/3 + 54 root 20 0 0 0 0 S 0.0 0.0 0:00.00 rcuob/4 + 55 root 20 0 0 0 0 S 0.0 0.0 0:00.00 rcuob/5 + 56 root 20 0 0 0 0 S 0.0 0.0 0:00.00 rcuob/6 + 57 root 20 0 0 0 0 S 0.0 0.0 0:00.00 rcuob/7 + 58 root 20 0 0 0 0 S 0.0 0.0 0:00.00 rcuob/8 + 59 root 20 0 0 0 0 S 0.0 0.0 0:00.00 rcuob/9 + 60 root 20 0 0 0 0 S 0.0 0.0 0:00.00 rcuob/10 + 61 root 20 0 0 0 0 S 0.0 0.0 0:00.00 rcuob/11 + 62 root 20 0 0 0 0 S 0.0 0.0 0:00.00 rcuob/12 + 63 root 20 0 0 0 0 S 0.0 0.0 0:00.00 rcuob/13 + 64 root 20 0 0 0 0 S 0.0 0.0 0:00.00 rcuob/14 + 65 root 20 0 0 0 0 S 0.0 0.0 0:00.00 rcuob/15 + 66 root 20 0 0 0 0 S 0.0 0.0 0:00.00 rcuob/16 + 67 root 20 0 0 0 0 S 0.0 0.0 0:00.00 rcuob/17 + 68 root 20 0 0 0 0 S 0.0 0.0 0:00.00 rcuob/18 + 69 root 20 0 0 0 0 S 0.0 0.0 0:00.00 rcuob/19 + 70 root 20 0 0 0 0 S 0.0 0.0 0:00.00 rcuob/20 + 71 root 20 0 0 0 0 S 0.0 0.0 0:00.00 rcuob/21 + 72 root 20 0 0 0 0 S 0.0 0.0 0:00.00 rcuob/22 + 73 root 20 0 0 0 0 S 0.0 0.0 0:00.00 rcuob/23 + 74 root 20 0 0 0 0 S 0.0 0.0 0:00.00 rcuob/24 + 75 root 20 0 0 0 0 S 0.0 0.0 0:00.00 rcuob/25 + 76 root 20 0 0 0 0 S 0.0 0.0 0:00.00 rcuob/26 + 77 root 20 0 0 0 0 S 0.0 0.0 0:00.00 rcuob/27 + 78 root 20 0 0 0 0 S 0.0 0.0 0:00.00 rcuob/28 + 79 root 20 0 0 0 0 S 0.0 0.0 0:00.00 rcuob/29 + 80 root 20 0 0 0 0 S 0.0 0.0 0:00.00 rcuob/30 + 81 root 20 0 0 0 0 S 0.0 0.0 0:00.00 rcuob/31 + 82 root 20 0 0 0 0 S 0.0 0.0 0:00.00 rcuob/32 + 83 root 20 0 0 0 0 S 0.0 0.0 0:00.00 rcuob/33 + 84 root 20 0 0 0 0 S 0.0 0.0 0:00.00 rcuob/34 + 85 root 20 0 0 0 0 S 0.0 0.0 0:00.00 rcuob/35 + 86 root 20 0 0 0 0 S 0.0 0.0 0:00.00 rcuob/36 + 87 root 20 0 0 0 0 S 0.0 0.0 0:00.00 rcuob/37 + 88 root 20 0 0 0 0 S 0.0 0.0 0:00.00 rcuob/38 + 89 root 20 0 0 0 0 S 0.0 0.0 0:00.00 rcuob/39 + 90 root rt 0 0 0 0 S 0.0 0.0 0:00.68 migration/0 + 91 root rt 0 0 0 0 S 0.0 0.0 0:01.68 watchdog/0 + 92 root rt 0 0 0 0 S 0.0 0.0 0:01.96 watchdog/1 + 93 root rt 0 0 0 0 S 0.0 0.0 0:00.40 migration/1 + 94 root 20 0 0 0 0 S 0.0 0.0 1:21.55 ksoftirqd/1 + 95 root 20 0 0 0 0 S 0.0 0.0 0:03.70 kworker/1:0 + 96 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kworker/1:0H + 97 root rt 0 0 0 0 S 0.0 0.0 0:03.18 watchdog/2 + 98 root rt 0 0 0 0 S 0.0 0.0 0:00.59 migration/2 + 100 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kworker/2:0 + 101 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kworker/2:0H + 102 root rt 0 0 0 0 S 0.0 0.0 0:02.48 watchdog/3 + 103 root rt 0 0 0 0 S 0.0 0.0 0:00.65 migration/3 + 104 root 20 0 0 0 0 S 0.0 0.0 60:06.64 ksoftirqd/3 + 105 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kworker/3:0 + 106 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kworker/3:0H + 107 root rt 0 0 0 0 S 0.0 0.0 0:01.66 watchdog/4 + 108 root rt 0 0 0 0 S 0.0 0.0 0:00.34 migration/4 + 109 root 20 0 0 0 0 S 0.0 0.0 0:07.02 ksoftirqd/4 + 110 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kworker/4:0 + 111 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kworker/4:0H + 112 root rt 0 0 0 0 S 0.0 0.0 0:01.69 watchdog/5 + 113 root rt 0 0 0 0 S 0.0 0.0 0:00.36 migration/5 + 114 root 20 0 0 0 0 S 0.0 0.0 0:06.14 ksoftirqd/5 + 115 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kworker/5:0 + 116 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kworker/5:0H + 117 root rt 0 0 0 0 S 0.0 0.0 0:01.66 watchdog/6 + 118 root rt 0 0 0 0 S 0.0 0.0 0:00.36 migration/6 + 119 root 20 0 0 0 0 S 0.0 0.0 0:15.15 ksoftirqd/6 + 120 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kworker/6:0 + 121 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kworker/6:0H + 122 root rt 0 0 0 0 S 0.0 0.0 0:01.43 watchdog/7 + 123 root rt 0 0 0 0 S 0.0 0.0 0:00.32 migration/7 + 124 root 20 0 0 0 0 S 0.0 0.0 0:08.87 ksoftirqd/7 + 125 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kworker/7:0 + 126 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kworker/7:0H + 127 root rt 0 0 0 0 S 0.0 0.0 0:01.46 watchdog/8 + 128 root rt 0 0 0 0 S 0.0 0.0 0:00.44 migration/8 + 129 root 20 0 0 0 0 S 0.0 0.0 0:00.96 ksoftirqd/8 + 130 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kworker/8:0 + 131 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kworker/8:0H + 132 root rt 0 0 0 0 S 0.0 0.0 0:01.48 watchdog/9 + 133 root rt 0 0 0 0 S 0.0 0.0 0:00.32 migration/9 + 134 root 20 0 0 0 0 S 0.0 0.0 0:05.57 ksoftirqd/9 + 135 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kworker/9:0 + 136 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kworker/9:0H + 137 root rt 0 0 0 0 S 0.0 0.0 0:08.99 watchdog/10 + 138 root rt 0 0 0 0 S 0.0 0.0 0:01.98 migration/10 + 140 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kworker/10:0 + 141 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kworker/10:0H + 143 root rt 0 0 0 0 S 0.0 0.0 0:08.90 watchdog/11 + 144 root rt 0 0 0 0 S 0.0 0.0 0:02.03 migration/11 + 145 root 20 0 0 0 0 S 0.0 0.0 6217:01 ksoftirqd/11 + 146 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kworker/11:0 + 147 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kworker/11:0H + 148 root rt 0 0 0 0 S 0.0 0.0 0:01.59 watchdog/12 + 149 root rt 0 0 0 0 S 0.0 0.0 0:00.46 migration/12 + 150 root 20 0 0 0 0 S 0.0 0.0 0:00.04 ksoftirqd/12 + 151 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kworker/12:0 + 152 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kworker/12:0H + 153 root rt 0 0 0 0 S 0.0 0.0 0:01.54 watchdog/13 + 154 root rt 0 0 0 0 S 0.0 0.0 0:00.65 migration/13 + 155 root 20 0 0 0 0 S 0.0 0.0 0:07.02 ksoftirqd/13 + 156 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kworker/13:0 + 157 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kworker/13:0H + 158 root rt 0 0 0 0 S 0.0 0.0 0:01.61 watchdog/14 + 159 root rt 0 0 0 0 S 0.0 0.0 0:00.84 migration/14 + 160 root 20 0 0 0 0 S 0.0 0.0 0:08.74 ksoftirqd/14 + 162 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kworker/14:0H + 163 root rt 0 0 0 0 S 0.0 0.0 0:01.59 watchdog/15 + 164 root rt 0 0 0 0 S 0.0 0.0 0:00.37 migration/15 + 165 root 20 0 0 0 0 S 0.0 0.0 0:00.03 ksoftirqd/15 + 166 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kworker/15:0 + 167 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kworker/15:0H + 168 root rt 0 0 0 0 S 0.0 0.0 0:01.58 watchdog/16 + 169 root rt 0 0 0 0 S 0.0 0.0 0:00.36 migration/16 + 170 root 20 0 0 0 0 S 0.0 0.0 0:00.03 ksoftirqd/16 + 171 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kworker/16:0 + 172 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kworker/16:0H + 173 root rt 0 0 0 0 S 0.0 0.0 0:01.57 watchdog/17 + 174 root rt 0 0 0 0 S 0.0 0.0 0:00.33 migration/17 + 175 root 20 0 0 0 0 S 0.0 0.0 0:00.03 ksoftirqd/17 + 176 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kworker/17:0 + 177 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kworker/17:0H + 178 root rt 0 0 0 0 S 0.0 0.0 0:01.55 watchdog/18 + 179 root rt 0 0 0 0 S 0.0 0.0 0:00.49 migration/18 + 180 root 20 0 0 0 0 S 0.0 0.0 0:00.05 ksoftirqd/18 + 181 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kworker/18:0 + 182 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kworker/18:0H + 183 root rt 0 0 0 0 S 0.0 0.0 0:01.58 watchdog/19 + 184 root rt 0 0 0 0 S 0.0 0.0 0:00.49 migration/19 + 185 root 20 0 0 0 0 S 0.0 0.0 0:00.04 ksoftirqd/19 + 186 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kworker/19:0 + 187 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kworker/19:0H + 188 root rt 0 0 0 0 S 0.0 0.0 0:01.57 watchdog/20 + 189 root rt 0 0 0 0 S 0.0 0.0 0:00.79 migration/20 + 190 root 20 0 0 0 0 S 0.0 0.0 0:00.01 ksoftirqd/20 + 191 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kworker/20:0 + 192 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kworker/20:0H + 193 root rt 0 0 0 0 S 0.0 0.0 0:02.57 watchdog/21 + 194 root rt 0 0 0 0 S 0.0 0.0 0:07.91 migration/21 + 195 root 20 0 0 0 0 S 0.0 0.0 86:16.84 ksoftirqd/21 + 196 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kworker/21:0 + 197 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kworker/21:0H + 198 root rt 0 0 0 0 S 0.0 0.0 0:01.60 watchdog/22 + 199 root rt 0 0 0 0 S 0.0 0.0 0:02.34 migration/22 + 200 root 20 0 0 0 0 S 0.0 0.0 3:20.20 ksoftirqd/22 + 201 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kworker/22:0 + 202 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kworker/22:0H + 203 root rt 0 0 0 0 S 0.0 0.0 0:01.57 watchdog/23 + 204 root rt 0 0 0 0 S 0.0 0.0 0:02.20 migration/23 + 205 root 20 0 0 0 0 S 0.0 0.0 0:00.48 ksoftirqd/23 + 206 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kworker/23:0 + 207 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kworker/23:0H + 208 root rt 0 0 0 0 S 0.0 0.0 0:01.68 watchdog/24 + 209 root rt 0 0 0 0 S 0.0 0.0 0:06.80 migration/24 + 210 root 20 0 0 0 0 S 0.0 0.0 4:14.70 ksoftirqd/24 + 211 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kworker/24:0 + 212 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kworker/24:0H + 213 root rt 0 0 0 0 S 0.0 0.0 0:01.57 watchdog/25 + 214 root rt 0 0 0 0 S 0.0 0.0 0:02.62 migration/25 + 215 root 20 0 0 0 0 S 0.0 0.0 0:00.63 ksoftirqd/25 + 216 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kworker/25:0 + 217 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kworker/25:0H + 218 root rt 0 0 0 0 S 0.0 0.0 0:01.60 watchdog/26 + 219 root rt 0 0 0 0 S 0.0 0.0 0:02.75 migration/26 + 220 root 20 0 0 0 0 S 0.0 0.0 0:00.01 ksoftirqd/26 + 221 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kworker/26:0 + 222 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kworker/26:0H + 223 root rt 0 0 0 0 S 0.0 0.0 0:01.33 watchdog/27 + 224 root rt 0 0 0 0 S 0.0 0.0 0:01.46 migration/27 + 225 root 20 0 0 0 0 S 0.0 0.0 0:03.63 ksoftirqd/27 + 226 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kworker/27:0 + 227 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kworker/27:0H + 228 root rt 0 0 0 0 S 0.0 0.0 0:01.60 watchdog/28 + 229 root rt 0 0 0 0 S 0.0 0.0 0:01.26 migration/28 + 230 root 20 0 0 0 0 S 0.0 0.0 0:00.02 ksoftirqd/28 + 231 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kworker/28:0 + 232 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kworker/28:0H + 233 root rt 0 0 0 0 S 0.0 0.0 0:01.61 watchdog/29 + 234 root rt 0 0 0 0 S 0.0 0.0 0:00.87 migration/29 + 235 root 20 0 0 0 0 S 0.0 0.0 0:00.05 ksoftirqd/29 + 236 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kworker/29:0 + 237 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kworker/29:0H + 238 root rt 0 0 0 0 S 0.0 0.0 0:01.68 watchdog/30 + 239 root rt 0 0 0 0 S 0.0 0.0 0:00.37 migration/30 + 240 root 20 0 0 0 0 S 0.0 0.0 55:11.14 ksoftirqd/30 + 241 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kworker/30:0 + 242 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kworker/30:0H + 243 root rt 0 0 0 0 S 0.0 0.0 0:01.83 watchdog/31 + 244 root rt 0 0 0 0 S 0.0 0.0 0:06.33 migration/31 + 245 root 20 0 0 0 0 S 0.0 0.0 0:09.11 ksoftirqd/31 + 246 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kworker/31:0 + 247 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kworker/31:0H + 248 root rt 0 0 0 0 S 0.0 0.0 0:01.87 watchdog/32 + 249 root rt 0 0 0 0 S 0.0 0.0 0:01.45 migration/32 + 250 root 20 0 0 0 0 S 0.0 0.0 248:19.74 ksoftirqd/32 + 251 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kworker/32:0 + 252 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kworker/32:0H + 253 root rt 0 0 0 0 S 0.0 0.0 0:01.56 watchdog/33 + 254 root rt 0 0 0 0 S 0.0 0.0 0:00.44 migration/33 + 255 root 20 0 0 0 0 S 0.0 0.0 0:00.01 ksoftirqd/33 + 256 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kworker/33:0 + 257 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kworker/33:0H + 258 root rt 0 0 0 0 S 0.0 0.0 0:01.50 watchdog/34 + 259 root rt 0 0 0 0 S 0.0 0.0 0:00.58 migration/34 + 260 root 20 0 0 0 0 S 0.0 0.0 0:00.02 ksoftirqd/34 + 261 root 20 0 0 0 0 S 0.0 0.0 0:00.01 kworker/34:0 + 262 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kworker/34:0H + 263 root rt 0 0 0 0 S 0.0 0.0 0:01.55 watchdog/35 + 264 root rt 0 0 0 0 S 0.0 0.0 0:00.57 migration/35 + 265 root 20 0 0 0 0 S 0.0 0.0 0:06.98 ksoftirqd/35 + 266 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kworker/35:0 + 267 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kworker/35:0H + 268 root rt 0 0 0 0 S 0.0 0.0 0:01.53 watchdog/36 + 269 root rt 0 0 0 0 S 0.0 0.0 0:00.38 migration/36 + 270 root 20 0 0 0 0 S 0.0 0.0 0:00.01 ksoftirqd/36 + 271 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kworker/36:0 + 272 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kworker/36:0H + 273 root rt 0 0 0 0 S 0.0 0.0 0:01.59 watchdog/37 + 274 root rt 0 0 0 0 S 0.0 0.0 0:00.33 migration/37 + 275 root 20 0 0 0 0 S 0.0 0.0 0:02.97 ksoftirqd/37 + 276 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kworker/37:0 + 277 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kworker/37:0H + 278 root rt 0 0 0 0 S 0.0 0.0 0:01.50 watchdog/38 + 279 root rt 0 0 0 0 S 0.0 0.0 0:00.30 migration/38 + 280 root 20 0 0 0 0 S 0.0 0.0 0:02.21 ksoftirqd/38 + 281 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kworker/38:0 + 282 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kworker/38:0H + 283 root rt 0 0 0 0 S 0.0 0.0 0:01.53 watchdog/39 + 284 root rt 0 0 0 0 S 0.0 0.0 0:00.21 migration/39 + 285 root 20 0 0 0 0 S 0.0 0.0 0:00.01 ksoftirqd/39 + 286 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kworker/39:0 + 287 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kworker/39:0H + 288 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 khelper + 289 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kdevtmpfs + 290 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 netns + 291 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 writeback + 292 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kintegrityd + 293 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 bioset + 294 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kworker/u83:0 + 295 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kworker/u84:0 + 296 root 0 -20 0 0 0 S 0.0 0.0 0:00.01 kworker/u85:0 + 297 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kblockd + 299 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 ata_sff + 300 root 20 0 0 0 0 S 0.0 0.0 0:00.06 khubd + 301 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 md + 302 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 devfreq_wq + 303 root 20 0 0 0 0 S 0.0 0.0 0:46.89 kworker/2:1 + 304 root 20 0 0 0 0 S 0.0 0.0 0:07.47 kworker/22:1 + 305 root 20 0 0 0 0 S 0.0 0.0 0:04.62 kworker/5:1 + 307 root 20 0 0 0 0 S 0.0 0.0 0:00.35 khungtaskd + 308 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kswapd0 + 309 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kswapd1 + 310 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 vmstat + 311 root 25 5 0 0 0 S 0.0 0.0 0:00.00 ksmd + 312 root 39 19 0 0 0 S 0.0 0.0 0:05.95 khugepaged + 313 root 20 0 0 0 0 S 0.0 0.0 0:00.00 fsnotify_mark + 314 root 20 0 0 0 0 S 0.0 0.0 0:00.00 ecryptfs-kthrea + 315 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 crypto + 327 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kthrotld + 328 root 20 0 0 0 0 S 0.0 0.0 1:17.70 kworker/10:1 + 331 root 20 0 0 0 0 S 0.0 0.0 0:01.04 kworker/39:1 + 332 root 20 0 0 0 0 S 0.0 0.0 0:03.99 kworker/12:1 + 333 root 20 0 0 0 0 S 0.0 0.0 0:04.70 kworker/13:1 + 334 root 20 0 0 0 0 S 0.0 0.0 0:52.89 kworker/14:1 + 335 root 20 0 0 0 0 S 0.0 0.0 0:02.87 kworker/15:1 + 336 root 20 0 0 0 0 S 0.0 0.0 0:02.62 kworker/16:1 + 337 root 20 0 0 0 0 S 0.0 0.0 0:00.05 kworker/0:2 + 339 root 20 0 0 0 0 S 0.0 0.0 0:10.69 kworker/31:1 + 340 root 20 0 0 0 0 S 0.0 0.0 0:07.69 kworker/u80:1 + 359 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 deferwq + 360 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 charger_manager + 367 root 20 0 0 0 0 S 0.0 0.0 0:34.08 kworker/21:1 + 387 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kmpathd + 388 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kmpath_handlerd + 400 root 20 0 0 0 0 S 0.0 0.0 0:02.33 kworker/23:1 + 427 root 20 0 0 0 0 S 0.0 0.0 0:09.71 kworker/24:1 + 433 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kworker/u82:0 + 445 root 20 0 0 0 0 S 0.0 0.0 0:02.51 kworker/6:1 + 446 root 20 0 0 0 0 S 0.0 0.0 0:10.30 kworker/32:1 + 447 root 20 0 0 0 0 S 0.0 0.0 0:53.43 kworker/8:1 + 454 root 20 0 0 0 0 S 0.0 0.0 0:23.83 kworker/3:1 + 455 root 20 0 0 0 0 S 0.0 0.0 0:02.43 kworker/9:1 + 456 root 20 0 0 0 0 S 0.0 0.0 0:02.86 kworker/4:1 + 457 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kworker/1:1 + 461 root 20 0 0 0 0 S 0.0 0.0 0:32.64 kworker/7:1 + 462 root 20 0 0 0 0 S 0.0 0.0 0:01.39 kworker/28:1 + 463 root 20 0 0 0 0 S 0.0 0.0 0:01.55 kworker/34:1 + 466 root 20 0 0 0 0 S 0.0 0.0 0:08.13 kworker/20:1 + 467 root 20 0 0 0 0 S 0.0 0.0 0:00.00 scsi_eh_0 + 468 root 20 0 0 0 0 S 0.0 0.0 0:02.42 kworker/26:1 + 469 root 20 0 0 0 0 S 0.0 0.0 0:00.00 scsi_eh_1 + 470 root 20 0 0 0 0 S 0.0 0.0 0:00.00 scsi_eh_2 + 471 root 20 0 0 0 0 S 0.0 0.0 0:02.41 kworker/29:1 + 472 root 20 0 0 0 0 S 0.0 0.0 0:00.00 scsi_eh_3 + 473 root 20 0 0 0 0 S 0.0 0.0 0:00.00 scsi_eh_4 + 474 root 20 0 0 0 0 S 0.0 0.0 0:00.00 scsi_eh_5 + 476 root 20 0 0 0 0 S 0.0 0.0 0:57.15 kworker/27:1 + 484 root 20 0 0 0 0 S 0.0 0.0 0:05.47 kworker/25:1 + 485 root 20 0 0 0 0 S 0.0 0.0 0:00.00 scsi_eh_6 + 486 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 fw_event0 + 514 root 20 0 0 0 0 S 0.0 0.0 0:08.44 kworker/30:1 + 515 root 20 0 0 0 0 S 0.0 0.0 0:01.83 kworker/35:1 + 516 root 20 0 0 0 0 S 0.0 0.0 0:02.01 kworker/33:1 + 518 root 20 0 0 0 0 S 0.0 0.0 1:35.24 kworker/11:1 + 519 root 20 0 0 0 0 S 0.0 0.0 0:03.69 kworker/19:1 + 520 root 20 0 0 0 0 S 0.0 0.0 0:05.52 kworker/18:1 + 521 root 20 0 0 0 0 S 0.0 0.0 0:01.28 kworker/38:1 + 522 root 20 0 0 0 0 S 0.0 0.0 0:02.66 kworker/17:1 + 542 root 20 0 0 0 0 S 0.0 0.0 0:01.47 kworker/36:1 + 543 root 20 0 0 0 0 S 0.0 0.0 0:01.17 kworker/37:1 + 547 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 raid5wq + 624 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 poll_0_status + 654 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kdmflush + 661 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 bioset + 673 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kdmflush + 674 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 bioset + 676 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kdmflush + 677 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 bioset + 737 root 20 0 0 0 0 S 0.0 0.0 0:17.36 jbd2/dm-1-8 + 738 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 ext4-rsv-conver + 878 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 ext4-rsv-conver + 893 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 xfsalloc + 894 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 xfs_mru_cache + 895 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 xfslogd + 896 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 xfs-data/dm-0 + 897 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 xfs-conv/dm-0 + 898 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 xfs-cil/dm-0 + 899 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 xfs-reclaim/dm- + 900 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 xfs-log/dm-0 + 901 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 xfs-eofblocks/d + 902 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kworker/32:1H + 903 root 20 0 0 0 0 S 0.0 0.0 0:00.12 xfsaild/dm-0 + 904 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kworker/13:1H + 961 root 20 0 19736 916 612 S 0.0 0.0 0:00.40 upstart-udev-br + 966 root 20 0 51220 1528 992 S 0.0 0.0 0:00.34 systemd-udevd + 1138 root 39 19 0 0 0 S 0.0 0.0 0:37.42 kipmi0 + 1395 root 20 0 15544 888 476 S 0.0 0.0 0:00.24 upstart-socket- + 6105 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kworker/12:1H + 8658 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kauditd + 8708 root 20 0 15552 884 468 S 0.0 0.0 0:00.21 upstart-file-br + 8729 message+ 20 0 39248 1540 1092 S 0.0 0.0 0:00.14 dbus-daemon + 8812 root 20 0 43444 1840 1480 S 0.0 0.0 0:00.01 systemd-logind + 8836 root 20 0 12960 936 776 S 0.0 0.0 0:00.00 getty + 8838 root 20 0 12960 932 776 S 0.0 0.0 0:00.00 getty + 8843 root 20 0 12960 936 776 S 0.0 0.0 0:00.00 getty + 8844 root 20 0 12960 936 776 S 0.0 0.0 0:00.00 getty + 8846 root 20 0 12960 936 776 S 0.0 0.0 0:00.00 getty + 8893 root rt 0 238444 4976 3972 S 0.0 0.0 0:15.62 multipathd + 8918 root 20 0 23648 1028 772 S 0.0 0.0 0:03.94 cron + 8932 root 20 0 19432 1052 544 S 0.0 0.0 3:20.79 irqbalance + 9031 root 20 0 25336 1668 1356 S 0.0 0.0 0:01.85 master + 9057 postfix 20 0 27452 1524 1240 S 0.0 0.0 0:00.37 qmgr + 9082 root 20 0 13264 456 312 S 0.0 0.0 0:00.06 mdadm + 9224 root 20 0 451716 56968 4020 S 0.0 0.0 1:20.70 ruby +10722 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kworker/11:1H +11383 neutron 20 0 201288 60516 5872 S 0.0 0.0 123:37.72 neutron-openvsw +11421 root 20 0 14532 936 784 S 0.0 0.0 0:00.00 getty +12603 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kworker/17:1H +12864 root 20 0 60032 2000 1548 S 0.0 0.0 0:00.00 sudo +12874 root 20 0 44136 11676 3740 S 0.0 0.0 0:00.05 neutron-rootwra +12943 root 20 0 17456 1576 1204 S 0.0 0.0 0:00.00 ovsdb-client +15172 root 20 0 1011092 13316 8148 S 0.0 0.0 29:15.41 libvirtd +18884 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kvm-irqfd-clean +19748 root 0 -20 0 0 0 S 0.0 0.0 0:00.02 kworker/0:1H +20161 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kworker/u85:1 +20212 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kworker/u81:2 +22427 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kworker/15:1H +22619 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kworker/10:1H +23390 root 20 0 0 0 0 S 0.0 0.0 0:03.88 kworker/u80:2 +25515 syslog 20 0 412760 18576 1168 S 0.0 0.0 3:51.93 rsyslogd +26596 root 0 -20 18356 6084 3504 S 0.0 0.0 0:25.99 atop +26632 nova 20 0 2189604 126392 12524 S 0.0 0.1 407:45.01 nova-compute +27847 ceilome+ 20 0 210356 47388 7724 S 0.0 0.0 3:01.50 ceilometer-poll +27867 root 20 0 280116 6004 2968 S 0.0 0.0 0:00.02 polkitd +29018 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kworker/u84:1 +29672 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kworker/16:1H +33372 postfix 20 0 27400 1520 1212 S 0.0 0.0 0:00.00 pickup +33382 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kworker/u82:1 +35221 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kworker/14:0 +35921 root 10 -10 17384 532 180 S 0.0 0.0 0:00.00 monitor +35922 root 10 -10 17828 2240 1360 S 0.0 0.0 3:03.18 ovsdb-server +35931 root 10 -10 21896 624 184 S 0.0 0.0 0:00.00 monitor +35948 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 bond0 +36096 ntp 20 0 27220 1924 1352 S 0.0 0.0 0:30.87 ntpd +36955 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kworker/u81:0 +37453 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kworker/u82:2 +39711 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kworker/18:1H +39948 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kworker/19:1H +40517 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kworker/u81:1 +40523 root 20 0 61376 3064 2384 S 0.0 0.0 0:00.00 sshd +40600 root 20 0 101504 4168 3204 S 0.0 0.0 0:00.05 sshd +40624 root 20 0 22124 4684 1872 S 0.0 0.0 0:00.15 bash diff --git a/tests/data/fake.log b/tests/data/fake.log new file mode 100644 index 00000000..bab71e5a --- /dev/null +++ b/tests/data/fake.log @@ -0,0 +1,9 @@ +Lorem ipsum dolor sit amet, +consectetur adipiscing elit, +sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. + +Ut enim ad minim veniam, +quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. + +Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. +Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. diff --git a/tests/data/yaml/invalid.yaml b/tests/data/yaml/invalid.yaml new file mode 100644 index 00000000..22e31ed1 --- /dev/null +++ b/tests/data/yaml/invalid.yaml @@ -0,0 +1 @@ +invalid - yaml
\ No newline at end of file diff --git a/tests/data/yaml/with_name.yaml b/tests/data/yaml/with_name.yaml new file mode 100644 index 00000000..25f7f83d --- /dev/null +++ b/tests/data/yaml/with_name.yaml @@ -0,0 +1 @@ +name: name in content
\ No newline at end of file diff --git a/tests/data/yaml/without_name.yaml b/tests/data/yaml/without_name.yaml new file mode 100644 index 00000000..bd234bd4 --- /dev/null +++ b/tests/data/yaml/without_name.yaml @@ -0,0 +1 @@ +no_name: yaml file without name
\ No newline at end of file diff --git a/tests/unit/cli/test_metric.py b/tests/unit/cli/cmd_metric_test.py index 239da96e..239da96e 100644 --- a/tests/unit/cli/test_metric.py +++ b/tests/unit/cli/cmd_metric_test.py diff --git a/tests/unit/cli/test_plan.py b/tests/unit/cli/cmd_plan_test.py index 3ce3766e..3ce3766e 100644 --- a/tests/unit/cli/test_plan.py +++ b/tests/unit/cli/cmd_plan_test.py diff --git a/tests/unit/cli/test_qpi.py b/tests/unit/cli/cmd_qpi_test.py index 992c85d7..992c85d7 100644 --- a/tests/unit/cli/test_qpi.py +++ b/tests/unit/cli/cmd_qpi_test.py diff --git a/tests/unit/cli/test_options.py b/tests/unit/cli/options_test.py index f9472814..f9472814 100644 --- a/tests/unit/cli/test_options.py +++ b/tests/unit/cli/options_test.py diff --git a/tests/unit/collector/transformer/__init__.py b/tests/unit/collector/__init__.py index e69de29b..e69de29b 100644 --- a/tests/unit/collector/transformer/__init__.py +++ b/tests/unit/collector/__init__.py diff --git a/tests/__init__.py b/tests/unit/collector/base_test.py index d6d2dee5..17fe1af1 100644 --- a/tests/__init__.py +++ b/tests/unit/collector/base_test.py @@ -1,5 +1,5 @@ ############################################################################## -# Copyright (c) 2016 ZTE Corp and others. +# Copyright (c) 2017 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 @@ -7,12 +7,12 @@ # http://www.apache.org/licenses/LICENSE-2.0 ############################################################################## -from os import path +from qtip.loader.plan import load_collector +from qtip.collector import CollectorProp as CProp -class BaseTest(object): - PATH = path.abspath(path.join(path.dirname(__file__), 'data')) - @classmethod - def abspath(cls, name): - return path.join(cls.PATH, name) +def test_load_collector(collectors_config): + for c in collectors_config: + collector = load_collector(c[CProp.TYPE]) + assert collector.TYPE == c[CProp.TYPE] diff --git a/tests/unit/collector/grep_test.py b/tests/unit/collector/grep_test.py new file mode 100644 index 00000000..e5d5f8c6 --- /dev/null +++ b/tests/unit/collector/grep_test.py @@ -0,0 +1,31 @@ +############################################################################## +# Copyright (c) 2017 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 +############################################################################## + +import os +import pytest + +from qtip.collector.parser.grep import grep_in_file + + +@pytest.fixture +def logfile(data_root): + return os.path.join(data_root, 'fake.log') + + +@pytest.mark.parametrize("regex,expected", [ + ('not exist', []), + ('Lorem (\S+)', [{'groups': ('ipsum',), 'groupdict': {}}]), + ('nisi ut (?P<name>\S+)', [{'groups': ('aliquip',), 'groupdict': {'name': 'aliquip'}}]) +]) +def test_grep_in_file(logfile, regex, expected): + matches = grep_in_file(logfile, regex) + assert len(matches) == len(expected) + for i in range(len(matches)): + assert matches[i].groups() == expected[i]['groups'] + assert matches[i].groupdict() == expected[i]['groupdict'] diff --git a/tests/unit/collector/logfile_test.py b/tests/unit/collector/logfile_test.py new file mode 100644 index 00000000..a76aa3ee --- /dev/null +++ b/tests/unit/collector/logfile_test.py @@ -0,0 +1,33 @@ +############################################################################## +# Copyright (c) 2017 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 +############################################################################## + +import pytest + +from qtip.collector.logfile import LogfileCollector + + +@pytest.fixture +def logfile_collector(logfile_config, plan): + return LogfileCollector(logfile_config, plan) + + +def test_run(logfile_collector): + collected = logfile_collector.run() + assert collected['groupdict'] == { + 'event_posted': '1482894965.3', + 'host_down': '1482894965.51', + 'network_down': '1482894965.164096803', + 'notified': '1482894965.63', + 'vm_error': '1482894965.3' + } + assert list(collected['groups']) == ['1482894965.63', + '1482894965.3', + '1482894965.3', + '1482894965.51', + '1482894965.164096803'] diff --git a/tests/unit/loader/__init__.py b/tests/unit/loader/__init__.py deleted file mode 100644 index e69de29b..00000000 --- a/tests/unit/loader/__init__.py +++ /dev/null diff --git a/tests/unit/loader/metric_test.py b/tests/unit/loader/metric_test.py index 26f144af..619d5e00 100644 --- a/tests/unit/loader/metric_test.py +++ b/tests/unit/loader/metric_test.py @@ -28,11 +28,10 @@ def init_test(metric_spec): def list_all_test(benchmarks_root): - metric_list = MetricSpec.list_all(paths=[benchmarks_root]) - assert len(list(metric_list)) is 6 + metric_list = list(MetricSpec.list_all(paths=[benchmarks_root])) + assert len(metric_list) is 6 for desc in metric_list: assert BaseProp.NAME in desc - assert BaseProp.DESCRIPTION in desc assert BaseProp.ABSPATH in desc assert BaseProp.ABSPATH is not None @@ -40,6 +39,5 @@ def list_all_test(benchmarks_root): def content_test(metric_spec): content = metric_spec.content assert BaseProp.NAME in content - assert BaseProp.DESCRIPTION in content assert BaseProp.WORKLOADS in content assert isinstance(content[BaseProp.WORKLOADS], list) diff --git a/tests/unit/loader/plan_test.py b/tests/unit/loader/plan_test.py index 32837f8f..d9869cb6 100644 --- a/tests/unit/loader/plan_test.py +++ b/tests/unit/loader/plan_test.py @@ -9,12 +9,15 @@ import pytest -from qtip.base.constant import PlanProp -from qtip.loader.plan import Plan, QPISpec +from qtip.collector.logfile import LogfileCollector +from qtip.loader.plan import load_collector +from qtip.loader.plan import Plan +from qtip.loader.plan import PlanProp +from qtip.loader.plan import QPISpec def test_init(plan): - assert plan.name == 'fake plan' + assert plan.name == 'doctor performance profiling' assert isinstance(plan.content, dict) for qpi in plan.qpis: assert isinstance(qpi, QPISpec) @@ -26,11 +29,10 @@ def test_init(plan): def test_list_all(benchmarks_root): - plan_list = Plan.list_all(paths=[benchmarks_root]) - assert len(list(plan_list)) is 2 + plan_list = list(Plan.list_all(paths=[benchmarks_root])) + assert len(plan_list) is 1 for desc in plan_list: assert PlanProp.NAME in desc - assert PlanProp.CONTENT in desc assert PlanProp.ABSPATH in desc assert PlanProp.ABSPATH is not None @@ -41,3 +43,7 @@ def test_content(plan): assert PlanProp.DESCRIPTION in content assert PlanProp.CONFIG in content assert PlanProp.QPIS in content + + +def test_load_collector(): + assert load_collector(LogfileCollector.TYPE) is LogfileCollector diff --git a/tests/unit/loader/qpi_test.py b/tests/unit/loader/qpi_test.py index 3328b43a..b53030d4 100644 --- a/tests/unit/loader/qpi_test.py +++ b/tests/unit/loader/qpi_test.py @@ -30,11 +30,10 @@ def test_init(qpi_spec): def test_list_all(benchmarks_root): - qpi_spec_list = QPISpec.list_all(paths=[benchmarks_root]) - assert len(list(qpi_spec_list)) is 2 + qpi_spec_list = list(QPISpec.list_all(paths=[benchmarks_root])) + assert len(qpi_spec_list) is 2 for item in qpi_spec_list: assert SpecProp.NAME in item - assert SpecProp.CONTENT in item assert SpecProp.ABSPATH in item assert SpecProp.ABSPATH is not None diff --git a/tests/unit/loader/yaml_file_test.py b/tests/unit/loader/yaml_file_test.py new file mode 100644 index 00000000..17836946 --- /dev/null +++ b/tests/unit/loader/yaml_file_test.py @@ -0,0 +1,33 @@ +############################################################################## +# Copyright (c) 2017 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 +############################################################################## + +import os +import pytest + +from qtip.base.error import InvalidContent +from qtip.loader.yaml_file import YamlFileLoader + + +@pytest.fixture +def yaml_root(data_root): + return os.path.join(data_root, 'yaml') + + +@pytest.mark.parametrize('filename, expected', [ + ('with_name.yaml', 'name in content'), + ('without_name.yaml', 'without_name')]) +def test_init(yaml_root, filename, expected): + loader = YamlFileLoader(filename, [yaml_root]) + assert loader.name == expected + + +def test_invalid_content(yaml_root): + with pytest.raises(InvalidContent) as excinfo: + YamlFileLoader('invalid.yaml', [yaml_root]) + assert 'invalid.yaml' in excinfo.value.filename diff --git a/tests/unit/runner/__init__.py b/tests/unit/runner/__init__.py deleted file mode 100644 index e69de29b..00000000 --- a/tests/unit/runner/__init__.py +++ /dev/null |