Giter Site home page Giter Site logo

os-autoinst / openqa_review Goto Github PK

View Code? Open in Web Editor NEW
8.0 10.0 29.0 1.27 MB

A review helper script for openQA

Home Page: http://os-autoinst.github.io/openqa_review

License: MIT License

Python 95.81% Shell 4.19%
openqa openqa-review python webscraping hacktoberfest

openqa_review's Introduction

os-autoinst badge badge

The OS-autoinst project aims at providing a means to run fully automated tests. Especially to run tests of basic and low-level operating system components such as bootloader, kernel, installer and upgrade, which can not easily and safely be tested with other automated testing frameworks. However, it can just as well be used to test firefox and openoffice operation on top of a newly installed OS.

os-autoinst can be executed alone, but is currently designed to be executed together with openQA, the web user interface that allows to run more than one os-autoinst instance at the same time.

More information on os-autoinst and openQA can be found on http://os-autoinst.github.io/openQA/

Getting started

Under openSUSE the os-autoinst package can be installed from the official repository or from our devel repository. For further details, have a look at the openQA documentation.

For building os-autoinst manually checkout the build instructions below.

The main executable isotovideo can read test parameters from the command line or read test parameters from a file named vars.json. This file stores the values of the different variables that will configure the behavior of the test execution.

A container is provided and can be pulled and the main execution can be called in one step, for example using the podman container engine for tests defined in the current directory on x86_64 if your environment supports KVM virtualization acceleration:

podman run --rm -it -v .:/tests registry.opensuse.org/devel/openqa/containers/isotovideo:qemu-kvm casedir=/tests

Use the image variant ending with qemu-x86 on x86_64 if no KVM support is available.

Additional test variables can be supplied on the command line. There are some variables used by os-autoinst itself and other that are used by the tests. A minimal command line can look like this:

isotovideo distri=opensuse casedir=/full/path/for/tests iso=/full/path/for/iso

As alternative or completementary a corresponding vars.json with additional parameters could be:

{
   "DISTRI" :      "opensuse",
   "CASEDIR" :     "/full/path/for/tests",
   "NAME" :        "test-name",
   "ISO" :         "/full/path/for/iso",
   "VNC" :         "91",
   "BACKEND" :     "qemu",
   "DESKTOP" :     "kde"
}

Be advised that the file vars.json is also modified by os-autoinst so make sure to backup handcrafted versions of this file.

For more concrete instructions read on in the "How to run test cases" section below. Find sections about "How to contribute" or "Build instructions" further below.

How to run test cases

This following instructions shows how to run test cases. First one needs to clone the test distribution. Checkout os-autoinst-distri-example for an example of a minimal test distribution.

Example for openSUSE’s tests:

mkdir distri && cd distri
git clone [email protected]:os-autoinst/os-autoinst-distri-opensuse.git opensuse
cd opensuse/products/opensuse
git clone [email protected]:os-autoinst/os-autoinst-needles-opensuse.git needles

Example for openQA’s self-tests ("openQA-in-openQA" test):

mkdir distri && cd distri
git clone [email protected]:os-autoinst/os-autoinst-distri-openQA.git openqa
cd openqa
git clone [email protected]:os-autoinst/os-autoinst-needles-openQA.git needles

Then create a working directory for the test execution, e.g.:

mkdir /tmp/os-autoinst-run && cd /tmp/os-autoinst-run

Create a minimal vars.json config file within that directory, e.g.:

vars.json
{
   "ARCH" : "x86_64",
   "BACKEND" : "qemu",
   "CASEDIR" : "/path/to/os-autoinst-distri-opensuse",
   "DESKTOP" : "gnome",
   "DISTRI" : "opensuse",
   "ISO" : "/path/to/openSUSE-Tumbleweed-DVD-x86_64-Snapshot20160715-Media.iso",
   "PRODUCTDIR" : "/path/to/os-autoinst-distri-opensuse/products/opensuse",
   "VNC" : 90,
}

You will need to correct the file paths to point to real locations. Some of the variables you can use are listed here. Test case specific variables are listed in the distri directories e.g. os-autoinst-distri-opensuse/variables.

Then you can run the isotovideo script within the created working directory. When doing a manual build, that script can be found at the top-level of the os-autoinst Git checkout.

All of these examples were using the QEMU backend which is usually the easiest backend to handle and therefore recommended. If you need to develop and test other backends, have a look at the backend-specific documentation.

When using the QEMU backend it is possible to access the system under test via VNC:

vncviewer localhost:91 -ViewOnly -Shared

Run isotovideo with the environment variable RUN_VNCVIEWER set to autostart a VNC viewer on the right port.

Run isotovideo with the environment variable RUN_DEBUGVIEWER to start the internal debug screenshot viewer updated with an always recent screenshot of the test run.

Develop test modules

Individual test modules are written with one test module per file using the test API in Perl code. Experimental support for test modules in the Python programming language is provided.

Find more details about how to write tests on http://open.qa/docs/#_how_to_write_tests

Verifying a runtime environment

To check if your hardware is able to successfully execute os-autoinst based tests one can execute openQA tests, all the development tests or simply call something like

podman run --pull=always --rm -it --entrypoint '' registry.opensuse.org/devel/openqa/containers/os-autoinst_dev:latest /bin/sh -c 'git -C /opt clone --depth 1 https://github.com/os-autoinst/os-autoinst && make -C /opt/os-autoinst/ test-perl-testsuite TESTS=t/99-full-stack.t'

which only requires the container runtime environment "podman" and will run a container based os-autoinst full-stack test, here without KVM hardware accelerated virtualization support.

How to contribute

If you want to contribute to this project, please clone and send pull requests via https://github.com/os-autoinst/os-autoinst.

More information on the contribution can be found on http://os-autoinst.github.io/openQA/contact/, too.

For an overview of the architecture, see doc/architecture.md.

Rules for commits

  • Every commit is checked by our CI system as soon as you create a pull request but you should run the os-autoinst tests locally. Checkout the build instructions for further details.

  • For git commit messages use the rules stated on How to Write a Git Commit Message as a reference

  • Every pull request is reviewed in a peer review to give feedback on possible implications and how we can help each other to improve

If this is too much hassle for you feel free to provide incomplete pull requests for consideration or create an issue with a code change proposal.

Deprecation approach

In case you want to deprecate functionality consider the use of the function backend::baseclass::handle_deprecate_backend.

Build instructions

Installing dependencies

On openSUSE one can install the package os-autoinst-devel which provides all the dependencies to build and run os-autoinst for the corresponding version of the sources. To build a current version of os-autoinst it is recommended to install os-autoinst-devel from devel:openQA as the distribution-provided packages might be too old or miss dependencies. This is particularly true for openSUSE Leap. Also see the openQA docs.

The required dependencies are also declared in dependencies.yaml. (The names listed within that file are specific to openSUSE but can be easily transferred to other distributions.)

Conducting the build

Simply call

make

in the top folder which automatically creates a build directory and builds the complete project.

Call

make help

to list all available targets.

The above commands use a convenience Makefile calling cmake. For packaging, when using an IDE or to conduct the steps manually it is suggested to use CMake directly and do the following: Create a build directory outside of the source directory. The following commands need to be invoked within that directory.

Configure build:

cmake $path_to_os_autoinst_checkout

You can specify any of the standard CMake variables, e.g. -DCMAKE_BUILD_TYPE=Debug and -DCMAKE_INSTALL_PREFIX=/custom/install/prefix.

The following examples assume that GNU Make is used. It is possible to generate for a different build tool by adding e.g. -G Ninja to the CMake arguments.

Build executables and libraries:

make symlinks

This target also creates symlinks of the built executables and libraries within the source directory so isotovideo can find them.

Run all tests:

make check

By default CTest is invoked in verbose mode because prove already provides condensed output. Add -DVERBOSE_CTEST=OFF to the CMake arguments to avoid that.

Run all Perl tests (*.t files found within the t and xt directories):

make test-perl-testsuite

Run individual tests by specifying them explicitly:

make test-perl-testsuite TESTS="t/15-logging.t t/28-signalblocker.t"

Run perl author tests:

make test-local-author-perl

Run all author tests:

make test-local

Notice that the user needs to include the test directory for each test (either t for normal or xt for developer-centric tests) when specifying individual tests.

Add additional arguments to the prove invocation, e.g. enable verbose output:

make test-perl-testsuite PROVE_ARGS=-v

Gather coverage data while running tests:

make test-perl-testsuite WITH_COVER_OPTIONS=1

Generate a coverage report from the gathered coverage data:

make coverage

If no coverage data has been gathered so far the coverage target will invoke the testsuite automatically.

Reset gathered coverage data:

make coverage-reset

Install files for packaging:

make install DESTDIR=…

Automatically tidy all perl files:

tools/tidyall

Tidy all changed perl files:

tools/tidyall --git

Further notes:

  • When using the test-perl-testsuite target, ctest is not used (and therefore ctest specific tweaks have no effect).

  • One can always run Perl tests manually via prove after the build has been conducted with make symlinks. Note that some tests need to be invoked within the t directory. An invocation like prove -vI.. -I../external/os-autoinst-common/lib 28-signalblocker.t is supposed to work.

  • It is also possible to run ctest within the build directory directly instead of using the mentioned targets.

  • All mentioned variables to influence the test execution (TESTS, WITH_COVER_OPTIONS, …) can be combined and can also be used with the coverage target.

Running isotovideo as CI check

We provide a container to run isotovideo which can be used to run QEMU-based tests directly in a CI runner. Checkout this example workflow for how it can be used. The README of the example test distribution also contains further details.

The script imgsearch in the repository’s top-level allows to use the fuzzy image comparison independently of the normal test execution. Invoke the script with no parameters to show its usage. There is also an example file showing what output you can expect. There is one key for each file to be searched. The best matching image to be found will show up as match and the other images under candidates. If no image matches well enough, match will be null.

To use the script the previously shown build instructions need to be executed (including the invocation of the symlinks target).

History of os-autoinst

At a time Bernhard M. Wiedemann who later joined was on the openSUSE testing team and was assigned the task of testing the installer. Which meant tedious and dull work of waiting for 4GB ISO files to download when it’s not even clear if those things even boot. And as the Perl founder Larry Wall states, important traits of programmers are laziness, impatience and hybris. Which quickly led to developing os-autoinst to automate installations ;) See https://lizards.opensuse.org/2010/04/29/making-of-the-opensuse-install-video/ and https://lizards.opensuse.org/2010/05/25/automated-opensuse-testing/ for Bernhard’s blog posts.

Further notes

When using the QEMU backend, also ensure your user running os-autoinst has access to /dev/kvm.

modprobe kvm-intel || modprobe kvm-amd
chgrp kvm /dev/kvm ; chmod g+rw /dev/kvm # maybe redundant
# optionally use a new user; just to keep things separate
useradd -m USERNAME -G kvm
passwd USERNAME # and/or add ~USERNAME/.ssh/authorized_keys

openqa_review's People

Contributors

agraul avatar amrysliu avatar asdil12 avatar asmorodskyi avatar b10n1k avatar baierjan avatar fruitfly638 avatar grisu48 avatar kalikiana avatar martchus avatar mergify[bot] avatar mimi1vx avatar nicksinger avatar okurz avatar oleksandrorlov avatar perlpunk avatar soulofdestiny avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

openqa_review's Issues

traceback when running openqa-review --help on Tumbleweed

openqa-review --help
Traceback (most recent call last):
File "/usr/bin/openqa-review", line 6, in
from pkg_resources import load_entry_point
File "/usr/lib/python2.7/site-packages/pkg_resources/init.py", line 2991, in
@_call_aside
File "/usr/lib/python2.7/site-packages/pkg_resources/init.py", line 2977, in _call_aside
f(*args, **kwargs)
File "/usr/lib/python2.7/site-packages/pkg_resources/init.py", line 3004, in _initialize_master_working_set
working_set = WorkingSet._build_master()
File "/usr/lib/python2.7/site-packages/pkg_resources/init.py", line 662, in _build_master
ws.require(requires)
File "/usr/lib/python2.7/site-packages/pkg_resources/init.py", line 970, in require
needed = self.resolve(parse_requirements(requirements))
File "/usr/lib/python2.7/site-packages/pkg_resources/init.py", line 856, in resolve
raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'configparser' distribution was not found and is required by openqa-review

TypeError: 'NoneType' object has no attribute '__getitem__' in get_test_details

Observation

Traceback (most recent call last):
  File "/usr/bin/openqa-review", line 9, in <module>
    load_entry_point('openqa-review==0.0.0', 'console_scripts', 'openqa-review')()
  File "/usr/lib/python2.7/site-packages/openqa_review/openqa_review.py", line 1220, in main
    report = generate_report(args)
  File "/usr/lib/python2.7/site-packages/openqa_review/openqa_review.py", line 1156, in generate_report
    return Report(browser, args, root_url, job_groups)
  File "/usr/lib/python2.7/site-packages/openqa_review/openqa_review.py", line 1106, in __init__
    self.report[k] = self._one_report(v)
  File "/usr/lib/python2.7/site-packages/openqa_review/openqa_review.py", line 1117, in _one_report
    return ProductReport(self.browser, job_group_url, self.root_url, self.args)
  File "/usr/lib/python2.7/site-packages/openqa_review/openqa_review.py", line 928, in __init__
    results = get_arch_state_results(arch, current_details, previous_details, args.output_state_results)
  File "/usr/lib/python2.7/site-packages/openqa_review/openqa_review.py", line 288, in get_arch_state_results
    states = SortedDict(get_state(v, test_results_previous_dict) for k, v in iteritems(test_results_dict))
  File "/usr/lib/python2.7/site-packages/sortedcontainers/sorteddict.py", line 140, in __init__
    self._update(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/sortedcontainers/sorteddict.py", line 338, in update
    self._dict_update(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/openqa_review/openqa_review.py", line 288, in <genexpr>
    states = SortedDict(get_state(v, test_results_previous_dict) for k, v in iteritems(test_results_dict))
  File "/usr/lib/python2.7/site-packages/openqa_review/openqa_review.py", line 276, in get_state
    state_dict.update(get_test_details(cur))
  File "/usr/lib/python2.7/site-packages/openqa_review/openqa_review.py", line 250, in get_test_details
    'failedmodules': [{'href': m.a['href'], 'name': m.text.strip(), 'needles': get_failed_needles(m)} for m in failedmodules]
TypeError: 'NoneType' object has no attribute '__getitem__'

fail to request data from bugzilla - status code: 401

Sample output

[cryptlvm_minimal_x](https://openqa.suse.de/tests/1012891 "Failed modules: hostname") -> [bsc#1028286](https://bugzilla.suse.com/show_bug.cgi?id=1028286) (Request to https://apibugzilla.suse.com/jsonrpc.cgi?method=Bug.get&params=%5B%7B%22ids%22%3A+%5B1028286%5D%7D%5D was not successful, status code: 401)

Network-settings

Hello,

i am trying to create a test with openQA and connect to network.
For example start machine and ping an adress (www.google.com) . But i cant find a way to give the openQA machine an ip-address. Do i have to use openvswitch ? Or os-autoinst-openvswitch ? Is there a guide for networking that could help me ?
Thanks a lot. Fabi

Numeric builds without a leading zero should sort numerically not alphabetically

Observation

It seems with #102 we have covered a part of the issue but not completely. SLE12SP4+SP5 is properly handled because builds have a leading 0 so an "alphabetic" sort will work but for SLE15 we have the problem that build 98 is considered higher than 102.

Acceptance criteria

  • AC1: A more recent build 102 is considered "later" or "higher" than 98
  • AC2: Builds including non-numerical characters don't crash the script

Problem

Basically there are two potentially conflicting build sorting approaches, by time of creation and by value of the build itself. Normally a more recent build is also higher by numerical value however not ensured to be. We could try to not sort on our own at all but rely on the order how it is presented by openQA or we get the information what is preferred from openQA and sort accordingly or we define our own rules with precedence.

Suggestion

Just trying to sort numerically with fallback to alphabetic sort if there are non-numeric characters besides interpunctation sounds good. Hopefully this is a "standard-problem" for which we find a good "standard-solution", at best without needing to define our own complicated algorithms.

comprehensive number of bugs with priority

Would be nice if there is a possibility to have a comprehensive number of bugs with priority for all the projects that do not focus on fixing bugs but "managing" them ;-)

Also with difference vs. comparison target

E.g.

P1: 42 (+3)
P2: 3 (-2)

Retry on 504

Observation

Traceback (most recent call last):
  File "/usr/bin/openqa-review", line 9, in <module>
    load_entry_point('openqa-review==0.0.0', 'console_scripts', 'openqa-review')()
  File "/usr/lib/python2.7/site-packages/openqa_review/openqa_review.py", line 1233, in main
    print(report)
  File "/usr/lib/python2.7/site-packages/openqa_review/openqa_review.py", line 1129, in __str__
    report_str += '# %s\n\n%s\n---\n' % (k, v)
  File "/usr/lib/python2.7/site-packages/openqa_review/openqa_review.py", line 946, in __str__
    'arch_report': '\n---\n'.join(map(str, self.reports.values()))
  File "/usr/lib/python2.7/site-packages/openqa_review/openqa_review.py", line 881, in __str__
    'todo_issues': self._todo_issues_str(),
  File "/usr/lib/python2.7/site-packages/openqa_review/openqa_review.py", line 865, in _todo_issues_str
    'existing_issues': issue_listing('***existing issues***', self.issues['existing']['todo'], self.args.show_empty),
  File "/usr/lib/python2.7/site-packages/openqa_review/openqa_review.py", line 334, in issue_listing
    return '\n' + header + '\n\n' + ''.join(map(str, issues)) + '\n'
  File "/usr/lib/python2.7/site-packages/openqa_review/openqa_review.py", line 735, in __str__
    ', '.join(map(self._format_failure, self.failures)),
  File "/usr/lib/python2.7/site-packages/openqa_review/openqa_review.py", line 719, in _format_failure
    report_str = issue_report_link(self.root_url, f, self.test_browser) if (self.args.report_links and self.test_browser) else ''
  File "/usr/lib/python2.7/site-packages/openqa_review/openqa_review.py", line 488, in issue_report_link
    test_details_page = test_browser.get_soup(f['href'])
  File "/usr/lib/python2.7/site-packages/openqa_review/browser.py", line 71, in get_soup
    return BeautifulSoup(self.get_page(url), "html.parser")
  File "/usr/lib/python2.7/site-packages/openqa_review/browser.py", line 102, in get_page
    content = self._get(absolute_url, as_json=as_json)
  File "/usr/lib/python2.7/site-packages/openqa_review/browser.py", line 123, in _get
    raise DownloadError(msg)
openqa_review.browser.DownloadError: Request to https://openqa.opensuse.org/tests/654185 was not successful, status code: 504

Expected result

openqa-review should not fail on this but skip or retry gracefully

add soft-fails without bugref to report instead of log

Motivation

In case openqa-review finds a soft-fail reference but without a valid bug reference this is reported in logs but rather should show up in the generated report as this is relevant information for the test reviewers.

Acceptance criteria

  • AC1: A soft-fail reference in test without a valid bugref is reported in the generated report
  • AC2: soft-fail references without valid bugref are not reported as error in log

Further details

Currently the log messages contain for example the following report:

ERROR:openqa_review.openqa_review:Could not find any soft failure reference within details of soft-failed job 'https://openqa.suse.de/tests/1580533'. Could be deleted workaround needle?.
ERROR:openqa_review.openqa_review:Failed to find valid bug tracker URL for {'state': 'NEW_SOFT_ISSUE', 'href': u'/tests/1562126', 'failedmodules': [], 'bugref': u'fate#321208: activating existing encrypted volume does *not* yield an encrypted system if not forcing'} with error u'ate'. Skipping current result

bugzilla bug filing assistant

user story

As a reviewer of failing tests in openQA I want to openqa-review to help me fill in bug reports with the common content to save some time when filing bugs

acceptance criteria

  • AC1: Text for bug entries is pre-generated, either as local text or within a browser window with the entries of a bug prefilled

ideas

  • provide a helper script parsing the information from a test
  • compare with previous jobs to fill "last good"
  • fill some statistics from previous jobs
  • add link to "latest in this scenario"

tumblesle-release compares with reference that might be pruned from openQA already

observation

[Notice] -hermes to #qa-review- [07:05:30] tumbleSLE release: build: 0405
<c> [07:09:37] that is good?
<c> [07:11:28] that was a forced release? because 405 is not even tested
<okurz> tumblesle_release:0405: 1/0 vs. 0234: 1/1, clearly 1 passed+0 failed
is better than 1 passed and 1 failed ;-) but why does have the last tumblesle
release 1/1?

problem

https://oqXXX/group_overview/XX?limit_builds=200 shows the problem. 0234 is the reference but only 2 jobs still exist from that old "non-important" job so tumblesle-release should probably tag the last release

further details

I guess you can see it as a feature: if no build gets released for a very long time it just picks the most recent one

tumblesle_release stalls on network issues

observation

DEBUG:openqa_review.tumblesle_release:Checking last builds on http://openqa.suse.de ...
DEBUG:openqa_review.tumblesle_release:Finding most recent ISO matching regex '.*SP2.*Server.*x86\_64.*\Z(?ms)'
DEBUG:openqa_review.tumblesle_release:Found last ISO SLE-12-SP2-Server-MINI-ISO-x86_64-Build1651-Media.iso
DEBUG:openqa_review.tumblesle_release:Found last build 1651
DEBUG:openqa_review.tumblesle_release:Getting jobs in build 1651 ...


# pressed Ctrl-C here after it got stuck for very long, should have found build1652 already, probably stuck for at least 12h.

^CTraceback (most recent call last):
  File "/home/tumblesle/venv/bin/tumblesle-release", line 9, in <module>
    load_entry_point('openqa-review-script===0.4.0-27-gdfdc6f9', 'console_scripts', 'tumblesle-release')()
  File "/home/tumblesle/venv/lib/python2.7/site-packages/openqa_review/tumblesle_release.py", line 355, in main
    tr.run()
  File "/home/tumblesle/venv/lib/python2.7/site-packages/openqa_review/tumblesle_release.py", line 113, in run
    self.one_run()
  File "/home/tumblesle/venv/lib/python2.7/site-packages/openqa_review/tumblesle_release.py", line 121, in one_run
    self.check_last_builds()
  File "/home/tumblesle/venv/lib/python2.7/site-packages/openqa_review/tumblesle_release.py", line 170, in check_last_builds
    jobs_by_result['last'] = self.retrieve_jobs_by_result(build['last'])
  File "/home/tumblesle/venv/lib/python2.7/site-packages/openqa_review/tumblesle_release.py", line 141, in retrieve_jobs_by_result
    jobs_build = self.browser.get_json('/api/v1/jobs?state=done&latest=1&build=%s&group_id=%s' % (build, group_id))['jobs']
  File "/home/tumblesle/venv/lib/python2.7/site-packages/openqa_review/openqa_review.py", line 145, in get_json
    return self.get_page(url, as_json=True)
  File "/home/tumblesle/venv/lib/python2.7/site-packages/openqa_review/openqa_review.py", line 164, in get_page
    r = requests.get(absolute_url, verify=False)
  File "/home/tumblesle/venv/lib/python2.7/site-packages/requests/api.py", line 71, in get
    return request('get', url, params=params, **kwargs)
  File "/home/tumblesle/venv/lib/python2.7/site-packages/requests/api.py", line 57, in request
    return session.request(method=method, url=url, **kwargs)
  File "/home/tumblesle/venv/lib/python2.7/site-packages/requests/sessions.py", line 475, in request
    resp = self.send(prep, **send_kwargs)
  File "/home/tumblesle/venv/lib/python2.7/site-packages/requests/sessions.py", line 617, in send
    r.content
  File "/home/tumblesle/venv/lib/python2.7/site-packages/requests/models.py", line 741, in content
    self._content = bytes().join(self.iter_content(CONTENT_CHUNK_SIZE)) or bytes()
  File "/home/tumblesle/venv/lib/python2.7/site-packages/requests/models.py", line 664, in generate
    for chunk in self.raw.stream(chunk_size, decode_content=True):
  File "/home/tumblesle/venv/lib/python2.7/site-packages/requests/packages/urllib3/response.py", line 353, in stream
    data = self.read(amt=amt, decode_content=decode_content)
  File "/home/tumblesle/venv/lib/python2.7/site-packages/requests/packages/urllib3/response.py", line 310, in read
    data = self._fp.read(amt)
  File "/usr/lib64/python2.7/httplib.py", line 573, in read
    s = self.fp.read(amt)
  File "/usr/lib64/python2.7/socket.py", line 380, in read
    data = self._sock.recv(left)
KeyboardInterrupt

problem

H1. network issues

suggestion

Call requests.get with timeout. tumblesle_release actually continued just fine after pressing Ctrl-C once.

"Missing architectures" table entry consumes next "hline"

report generates something like this


  Acceptance: SLE 12 SP2 1.Server

*Date:* 2016-09-19 - 08:00 *Build:* 2131

*Common issues:*

  * *Missing architectures*: x86_64, ppc64le
    ------------------------------------------------------------------------

*Arch:* aarch64 *Status: Red*

*TODO: review*

*/new issues/*

  * btrfs
  * minimal_x+uefi
  * sdk-ftp
  * textmode

------------------------------------------------------------------------
*Arch:* s390x *Status: Green*

------------------------------------------------------------------------

where the line after "missing architectures" should not be indented.

Missing dependency: python-configparser is required

The python-openqa_review package is installed by zypper command on my openSUSE Tumbleweed:

~> sudo zypper in python-openqa_review

~> openqa-review --help
Traceback (most recent call last):
  File "/usr/bin/openqa-review", line 6, in <module>
    from pkg_resources import load_entry_point
  File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2991, in <module>
    @_call_aside
  File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2977, in _call_aside
    f(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 3004, in _initialize_master_working_set
    working_set = WorkingSet._build_master()
  File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 662, in _build_master
    ws.require(__requires__)
  File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 970, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 856, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'configparser' distribution was not found and is required by openqa-review

After installing python-configparser:
~> sudo zypper in python-configparser
~> openqa-review --help
Traceback (most recent call last):
  File "/usr/bin/openqa-review", line 11, in <module>
    load_entry_point('openqa-review===.-0.0.0-', 'console_scripts', 'openqa-review')()
  File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 567, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2604, in load_entry_point
    return ep.load()
  File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2264, in load
    return self.resolve()
  File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2270, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/usr/lib/python2.7/site-packages/openqa_review/openqa_review.py", line 105, in <module>
    from configparser import ConfigParser, NoSectionError, NoOptionError  # isort:skip can not make isort happy here
  File "/usr/lib/python2.7/site-packages/configparser.py", line 12, in <module>
    from backports.configparser import (
ImportError: No module named backports.configparser

The issue can be workaround by install configparser via pip
~> sudo pip install configparser
~> openqa-review --help

tumblesle-release does not send out notification if notification connection died previously

observation

[…]
DEBUG:openqa_review.tumblesle_release:Release DONE
ERROR:pika.adapters.base_connection:Socket Error: 104
WARNING:pika.adapters.base_connection:Socket closed when connection was open
WARNING:pika.connection:Disconnected from RabbitMQ at kazhua.suse.de:5672 (0): Not specified
Traceback (most recent call last):
  File "/home/tumblesle/venv/bin/tumblesle-release", line 9, in <module>
    load_entry_point('openqa-review===1.4.1-9-g73059a2', 'console_scripts', 'tumblesle-release')()
  File "/home/tumblesle/venv/lib/python2.7/site-packages/openqa_review/tumblesle_release.py", line 395, in main
    tr.run()
  File "/home/tumblesle/venv/lib/python2.7/site-packages/openqa_review/tumblesle_release.py", line 145, in run
    self.one_run()
  File "/home/tumblesle/venv/lib/python2.7/site-packages/openqa_review/tumblesle_release.py", line 156, in one_run
    self.release()
  File "/home/tumblesle/venv/lib/python2.7/site-packages/openqa_review/tumblesle_release.py", line 318, in release
    self.notify({'build': self.release_build}, topic='release')
  File "/home/tumblesle/venv/lib/python2.7/site-packages/openqa_review/tumblesle_release.py", line 136, in notify
    self.notify_channel.basic_publish(exchange='pubsub', routing_key='.'.join([self.notify_topic, topic]), body=body)
  File "/home/tumblesle/venv/lib/python2.7/site-packages/pika/adapters/blocking_connection.py", line 1978, in basic_publish
    mandatory, immediate)
  File "/home/tumblesle/venv/lib/python2.7/site-packages/pika/adapters/blocking_connection.py", line 2065, in publish
    self._flush_output()
  File "/home/tumblesle/venv/lib/python2.7/site-packages/pika/adapters/blocking_connection.py", line 1174, in _flush_output
    *waiters)
  File "/home/tumblesle/venv/lib/python2.7/site-packages/pika/adapters/blocking_connection.py", line 395, in _flush_output
    raise exceptions.ConnectionClosed()
pika.exceptions.ConnectionClosed
Exception pika.exceptions.ConnectionClosed: The AMQP connection was closed: () in <bound method TumblesleRelease.__del__ of <openqa_review.tumblesle_release.TumblesleRelease object at 0x7f1cae6fb110>> ignored

steps to reproduce

I assume we could do the following

  • start test server
  • let tumblesle-release connect to server initially
  • terminate notification server
  • let tumblesle-release run into the notification and see it fail or wait until the second time and it still fails although the server might be up again

suggestion

-        self.notify_channel.exchange_declare(exchange='pubsub', type='topic')
+        self.notify_channel.exchange_declare(exchange='pubsub', type='topic', passive=True, durable=True)

retrieving bugs from bugzilla can fail and abort the script

observation

Cron <okurz@lord> env TPL=/suse/okurz/Export/dashboard_files/dashboard.html.in $HOME/local/openqa_review/bin/openqa-review-daily-email
Date: Today 08:00:55
From: "(Cron Daemon)" <[email protected]>
To: [email protected]
Traceback (most recent call last):
  File "/usr/bin/openqa-review", line 9, in <module>
    load_entry_point('openqa-review==0.0.0', 'console_scripts', 'openqa-review')()
  File "/usr/lib/python2.7/site-packages/openqa_review/openqa_review.py", line 1193, in main
    report = generate_report(args)
  File "/usr/lib/python2.7/site-packages/openqa_review/openqa_review.py", line 1129, in generate_report
    return Report(browser, args, root_url, job_groups)
  File "/usr/lib/python2.7/site-packages/openqa_review/openqa_review.py", line 1079, in __init__
    self.report[k] = self._one_report(v)
  File "/usr/lib/python2.7/site-packages/openqa_review/openqa_review.py", line 1090, in _one_report
    return ProductReport(self.browser, job_group_url, self.root_url, self.args)
  File "/usr/lib/python2.7/site-packages/openqa_review/openqa_review.py", line 910, in __init__
    self.reports[arch] = ArchReport(arch, results, args, root_url, progress_browser, bugzilla_browser, browser)
  File "/usr/lib/python2.7/site-packages/openqa_review/openqa_review.py", line 771, in __init__
    issue = Issue(bug['bugref'], bug['bugref_href'], self.args.query_issue_status, self.progress_browser, self.bugzilla_browser)
  File "/usr/lib/python2.7/site-packages/openqa_review/openqa_review.py", line 609, in __init__
    self.json = bugzilla_browser.json_rpc_get('/jsonrpc.cgi', 'Bug.get', {"ids": [self.bugid]})['result']['bugs'][0]
  File "/usr/lib/python2.7/site-packages/openqa_review/browser.py", line 129, in json_rpc_get
    return self.get_json(get_url.replace('http://dummy', ''), cache)
  File "/usr/lib/python2.7/site-packages/openqa_review/browser.py", line 75, in get_json
    return self.get_page(url, as_json=True, cache=cache)
  File "/usr/lib/python2.7/site-packages/openqa_review/browser.py", line 103, in get_page
    r = requests.get(absolute_url, auth=self.auth)
  File "/usr/lib/python2.7/site-packages/requests/api.py", line 70, in get
    return request('get', url, params=params, **kwargs)
  File "/usr/lib/python2.7/site-packages/requests/api.py", line 56, in request
    return session.request(method=method, url=url, **kwargs)
  File "/usr/lib/python2.7/site-packages/requests/sessions.py", line 475, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/lib/python2.7/site-packages/requests/sessions.py", line 596, in send
    r = adapter.send(request, **kwargs)
  File "/usr/lib/python2.7/site-packages/requests/adapters.py", line 471, in send
    raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', error("(104, 'ECONNRESET')",))

reproducible

seems to happen near every day now when the automatic report is generated. Seems to be more reproducible now as we have more bugs to retrieve data for

problem

problems on retrieving single bugs should not abort the whole report generation

suggestion

  • handle one error gracefully, e.g. skip the retrieval of this one bug
  • retry multiple times to retrieve one bug

Add support for multi-version job groups

Motivation

E.g. http://openqa.suse.de/group_overview/110 for SLE15 as well as https://openqa.opensuse.org/group_overview/50 use the same job group for minor versions / service packs. For SLE15 the build number started from 0 again and openqa-review does not find the 15SP1 jobs as "last finished". This should be changed

Acceptance criteria

  • AC1: The latest two SLE15SP1 builds are found and compared automatically by openqa-review over SLE15(SP0)

Suggestions

  • We need some changes somewhere within the function "get_build_urls_to_compare"
  • Read out both the "version" as well as "build" from the job group page
  • Compare by using the max of version and build, e.g. by using a custom sort function for the call to "sorted" on finished_builds

UnicodeEncodeError: 'ascii' codec can't encode character u'\u2026' in position 382: ordinal not in range(128)

Observation

Traceback (most recent call last):
  File "/usr/bin/openqa-review", line 9, in <module>
    load_entry_point('openqa-review==0.0.0', 'console_scripts', 'openqa-review')()
  File "/usr/lib/python2.7/site-packages/openqa_review/openqa_review.py", line 1245, in main
    print(report)
  File "/usr/lib/python2.7/site-packages/openqa_review/openqa_review.py", line 1141, in __str__
    report_str += '# %s\n\n%s\n---\n' % (k, v)
  File "/usr/lib/python2.7/site-packages/openqa_review/openqa_review.py", line 958, in __str__
    'arch_report': '\n---\n'.join(map(str, self.reports.values()))
  File "/usr/lib/python2.7/site-packages/openqa_review/openqa_review.py", line 892, in __str__
    'existing_product_issues': issue_listing('**Existing Product bugs:**', self.issues['existing']['product'], self.args.show_empty),
  File "/usr/lib/python2.7/site-packages/openqa_review/openqa_review.py", line 342, in issue_listing
    return '\n' + header + '\n\n' + ''.join(map(str, issues)) + '\n'
UnicodeEncodeError: 'ascii' codec can't encode character u'\u2026' in position 382: ordinal not in range(128)

found in email report from daily dashboard report generation. I assume a problem introduced by any person using a label with non-ascii characters.

Reproducible

  • Happens sometimes but not every day in the daily jobs

Further details

"daily dashboard report generation" is mainly https://github.com/okurz/openqa_review/blob/master/bin/openqa-review-daily-email triggered on a daily base from a cron job on lord.arch.suse.de for both o3 as well as osd.

Automated notification test failure template

When there is a soft failure, the message posted into BZ neither openQA console dump may not contain information to uncover the failure cause. (Or it is well hidden for a person not so familiar with those reports.)

I suggest to modify record_soft_failure in such a way that the message would contain location of the actual code (similar to C assert). E.g link to the code

Soft fail at lib/sles4sap.pm:85, see [1]

[1] https://github.com/os-autoinst/os-autoinst-distri-opensuse/blob/7cb2bc0e2831c19b01777a0df019c5f50641125c/lib/sles4sap.pm#L85

Cc: @ricardobranco777 @okurz

requests.exceptions.ConnectionError: ('Connection aborted.', error("(104, 'ECONNRESET')",)) -> should be handled gracefully

Observation

from cron email:

Subject: Cron okurz@lord env openqa_host=https://openqa.opensuse.org recv=[email protected] html_target_file=openqa_opensuse_org_status.html TPL=$HOME/local/openqa_review/dashboard_files/dashboard.html.in $HOME/local/openqa_review/bin/openqa-review-daily-email; cp -a ~/{Export,public_html}/openqa_opensuse_org_status.html
Date: Sun, 5 Aug 2018 07:10:52 +0200 (CEST)

Traceback (most recent call last):
File "/usr/bin/openqa-review", line 9, in
load_entry_point('openqa-review==0.0.0', 'console_scripts', 'openqa-review')()
File "/usr/lib/python2.7/site-packages/openqa_review/openqa_review.py", line 1254, in main
reminder_comment_on_issues(report)
File "/usr/lib/python2.7/site-packages/openqa_review/openqa_review.py", line 1240, in reminder_comment_on_issues
reminder_comment_on_issue(ie, min_days_unchanged)
File "/usr/lib/python2.7/site-packages/openqa_review/openqa_review.py", line 1224, in reminder_comment_on_issue
issue.add_comment(comment)
File "/usr/lib/python2.7/site-packages/openqa_review/openqa_review.py", line 660, in add_comment
"is_private": True,
File "/usr/lib/python2.7/site-packages/openqa_review/browser.py", line 150, in json_rpc_post
r = requests.post(absolute_url, data=data, auth=self.auth, headers={'content-type': 'application/json'})
File "/usr/lib/python2.7/site-packages/requests/api.py", line 110, in post
return request('post', url, data=data, json=json, **kwargs)
File "/usr/lib/python2.7/site-packages/requests/api.py", line 56, in request
return session.request(method=method, url=url, **kwargs)
File "/usr/lib/python2.7/site-packages/requests/sessions.py", line 475, in request
resp = self.send(prep, **send_kwargs)
File "/usr/lib/python2.7/site-packages/requests/sessions.py", line 596, in send
r = adapter.send(request, **kwargs)
File "/usr/lib/python2.7/site-packages/requests/adapters.py", line 471, in send
raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', error("(104, 'ECONNRESET')",))

Reproducible

Seen sometimes already

Suggestions

104 should be handled gracefully.

openqa-review in openSUSE Leap 42.2 script is not compatible with new openQA version

On openSUSE Leap 42.2, after installing openqa-review

zypper in python-openqa_review
zypper in python-configparser # because this dependency is not available yet (https://github.com/okurz/openqa_review/issues/56#issuecomment-300504567)

I get this error executing openqa_review

mansilla@copland:/var/log/apache2$ openqa-review                                                                                                                                                                                             
Traceback (most recent call last):
  File "/usr/bin/openqa-review", line 9, in <module>
    load_entry_point('openqa-review===.-0.0.0-', 'console_scripts', 'openqa-review')()
  File "/usr/lib/python2.7/site-packages/openqa_review/openqa_review.py", line 1115, in main
    report = generate_report(args)
  File "/usr/lib/python2.7/site-packages/openqa_review/openqa_review.py", line 1055, in generate_report
    return Report(browser, args, root_url, job_groups)
  File "/usr/lib/python2.7/site-packages/openqa_review/openqa_review.py", line 1008, in __init__
    self.report[k] = self._one_report(v)
  File "/usr/lib/python2.7/site-packages/openqa_review/openqa_review.py", line 1016, in _one_report
    return ProductReport(self.browser, job_group_url, self.root_url, self.args)
  File "/usr/lib/python2.7/site-packages/openqa_review/openqa_review.py", line 808, in __init__
    current_url, previous_url = get_build_urls_to_compare(browser, job_group_url, args.builds, args.against_reviewed, args.running_threshold)
  File "/usr/lib/python2.7/site-packages/openqa_review/openqa_review.py", line 427, in get_build_urls_to_compare
    finished_builds = find_builds(get_group_result(job_group), running_threshold)
  File "/usr/lib/python2.7/site-packages/openqa_review/openqa_review.py", line 378, in find_builds
    log.debug("Found the following finished non-empty builds: %s" % ', '.join(finished.keys()))
TypeError: sequence item 1: expected string or Unicode, NoneType found
mansilla@copland:/var/log/apache2$

Write more proper unit tests that could replace current integration tests

motivation

openqa_review has 100% statement and branch coverage so it's easy to start hacking and see how it behaves. The current tests are "integration tests" that rely on downloaded html source files and compare the generated result against reference reports in markdown. This is a complete testing approach but the two main limitations are:

  • tests can be slow more than 1 second for a complete test run can be considered too much for such a simple project
  • not so helpful test failures if tests fail the main problem shown is that the generated report does not look like the reference which is not helpful when trying to work on low-level internal functions.

suggestion

More proper unit tests (could also be doctests) should be added.

Review contains invalid HTML

The review accessible under https://w3.suse.de/~okurz/openqa_suse_de_status.html contains invalid HTML.

<p><strong>Arch:</strong> s390x <strong>Status: <font color="green">Green</font></strong> <hr> <strong>Arch:</strong> x86_64 <strong>Status: <font color="green">Green</font></strong></p>

There shouldn't be a closing </p> according to the validator. This is because the <hr> element is not inside the <p> element. It causes the <p> element to be implicitly closed before and hence the closing </p> is wrong.

Also the use of <font ... should be avoided.

spectacle gz7336

This HTML output seems to be used directly and unaltered used in openQA comments causing invalid HTML in openQA.

Handle "boo#0" not as error in log but better

Acceptance criteria

  • AC1: boo#0 is not reported as error in the log but handled appropriately in the report

Suggestions

  • Adapt ttm in a way to do what openSUSE RMs need so that no one would use this bugref anymore.
  • If above not possible workaround in openqa_review by accepting the bugref as special

Further details

openSUSE RMs are using the invalid boo#0 bug reference to fool ttm which demands a ticket reference for each failure.

Log error:

ERROR:openqa_review.openqa_review:Error retrieving details for bugref boo#0 (https://bugzilla.opensuse.org/show_bug.cgi?id=0): 'NoneType' object has no attribute '__getitem__'

issue status should include priority of issue

bugs and issues have priority. Especially for bugzilla references within SUSE the priority is very important, e.g. to find failing tests with bugrefs that don't have a high priority as every failing test should probably be linked against a bug that has at least prio 3.

openqa_review fails if it can not access an restricted progress issue

observation

Traceback (most recent call last):
  File "/usr/bin/openqa-review", line 11, in <module>
    load_entry_point('openqa-review===.-0.0.0-', 'console_scripts', 'openqa-review')()
  File "/usr/lib/python2.7/site-packages/openqa_review/openqa_review.py", line 1003, in main
    report = generate_report(args)
  File "/usr/lib/python2.7/site-packages/openqa_review/openqa_review.py", line 969, in generate_report
    return Report(browser, args, root_url, job_groups)
  File "/usr/lib/python2.7/site-packages/openqa_review/openqa_review.py", line 919, in __init__
    self.report[k] = self._one_report(v)
  File "/usr/lib/python2.7/site-packages/openqa_review/openqa_review.py", line 930, in _one_report
    return ProductReport(self.browser, job_group_url, self.root_url, self.args)
  File "/usr/lib/python2.7/site-packages/openqa_review/openqa_review.py", line 787, in __init__
    self.reports[arch] = ArchReport(arch, results, args, root_url, progress_browser, bugzilla_browser, browser)
  File "/usr/lib/python2.7/site-packages/openqa_review/openqa_review.py", line 700, in __init__
    issue = Issue(bug['bugref'], bug['bugref_href'], self.args.query_issue_status, self.progress_browser, self.bugzilla_browser)
  File "/usr/lib/python2.7/site-packages/openqa_review/openqa_review.py", line 564, in __init__
    self.json = progress_browser.get_json(bugref_href + '.json')['issue']
  File "/usr/lib/python2.7/site-packages/openqa_review/browser.py", line 66, in get_json
    return self.get_page(url, as_json=True)
  File "/usr/lib/python2.7/site-packages/openqa_review/browser.py", line 80, in get_page
    raw = open(os.path.join(self.load_dir, filename)).read()
IOError: [Errno 2] No such file or directory: '/tmp/tmp.AufehQRMV7/https%3A::progress.opensuse.org:issues:11438.json'

steps to reproduce

  • link a private ticket in openqa
  • call openqa_review covering the referenced ticket from a failing job
  • see the crash

suggestion

  • the whole run of openqa_review should not fail if it can not read a single issue
  • next step: openqa_review should try to use authentication to read issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.