Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
cc7da7b
modified claiming log message not to be so verbose
May 22, 2018
4653a97
claim_by_rules now recognizes field to match on
May 22, 2018
510f334
added duration and stdout to the attributes to fetch
May 22, 2018
49137f7
Show some stats
jhutar Jun 6, 2018
a92068d
Also indicate which rules are in the KB
jhutar Jun 7, 2018
fc03bb0
Implement possibility to add some logick into rules. Add some basic t…
jhutar Jun 13, 2018
7f1aa7c
Implement possibility to add some logick into rules. Add some basic t…
jhutar Jun 13, 2018
a8557b2
Log via logging only, no print here and there
jhutar Jun 13, 2018
dbc2516
Typo
jhutar Jun 14, 2018
af0eff8
Rewrote to classes
jhutar Jun 14, 2018
664e5ad
Rename Results and Rules to singular
jhutar Jun 14, 2018
db09bac
Move some code here and there as we discussed with Roman
jhutar Jun 14, 2018
ecab09f
Fix is_claimed and is_unclaimed
jhutar Jun 14, 2018
d235f2d
Simplify, thanks rplevka
jhutar Jun 14, 2018
33707e6
Discussed with rplevka and we do not want these is_* and get_* methods
jhutar Jun 14, 2018
a7153eb
Add possibility to learn tests start and end time
jhutar Jun 14, 2018
316ea0d
When we can not parse start/end time, return KeyError
jhutar Jun 16, 2018
d524206
Tool to generate timeline of tests run
jhutar Jun 16, 2018
5a17e1b
Utility to see stability of the tests
jhutar Jun 16, 2018
d0c9bd8
Add possibility to get production log for each case. Problem he is te…
jhutar Jun 18, 2018
262c295
Make relevant piece of production.log part of every test result
jhutar Jun 18, 2018
bfb36c0
Add caching to production.log functionality
jhutar Jun 18, 2018
053e6f4
Time is seriously wrong in the log :-/
jhutar Jun 18, 2018
994d128
Format it in a same way as elsewhere
jhutar Jun 25, 2018
683c8e0
More useful debug message and workaround one traceback
jhutar Jun 29, 2018
8b0a1c8
Base stats per tier
jhutar Jul 5, 2018
ec9469e
Make it possible to specify more job groups
jhutar Jul 7, 2018
c3e367e
Use job/build to identify production.log
jhutar Jul 7, 2018
4d352a0
Some useful code
jhutar Jul 9, 2018
d8ae238
Fix script (some variables were overwritten by per tier values and ti…
jhutar Jul 9, 2018
2ea66fc
Fixed tests
jhutar Jul 10, 2018
235215e
Move tests and module
jhutar Jul 10, 2018
9f4fdba
Tabulate is needed
jhutar Jul 10, 2018
df5b6ac
Started on cli tool
jhutar Jul 10, 2018
61a252d
Pass job group to Report object
jhutar Jul 11, 2018
e0bbec9
Create a helper function for GET requests
jhutar Jul 11, 2018
5ba22f0
Now handles foreman-debug/production.log
jhutar Jul 11, 2018
237498d
Added possibility to print test details
jhutar Jul 11, 2018
bdaeb27
Added stats functionality
jhutar Jul 17, 2018
69d477d
Make '--output csv' actually work
jhutar Jul 17, 2018
1b76bc4
Way to show history
jhutar Jul 18, 2018
da49876
Provide some default
jhutar Jul 18, 2018
d116b28
Added possibility to claim
jhutar Jul 23, 2018
4a56f23
Added possibility to clean cache for job groups
jhutar Jul 23, 2018
56311ee
Get stats for correct job groupu
jhutar Jul 23, 2018
b550850
Added two more columns into 'How many failures are there per endpoint…
jhutar Jul 23, 2018
ad69d7b
Sameflake8 fixes
jhutar Jul 24, 2018
60bdf37
Added function to draw timegraphs
jhutar Jul 24, 2018
63aca59
Not needed now I hope
jhutar Jul 24, 2018
1c9583e
This is needed for rungraphs
jhutar Jul 24, 2018
3a11868
Restructured claims module
jhutar Jul 26, 2018
4b73050
Fixing tests
jhutar Jul 26, 2018
50c92ec
Updated docs
jhutar Jul 26, 2018
8e65262
Do not import it all in too difficult manner
jhutar Jul 26, 2018
d55c671
Mask more files
jhutar Jul 26, 2018
cd4c1c1
We do not need to create a config instance here
jhutar Jul 26, 2018
08405db
That constant is in the config object
jhutar Jul 30, 2018
04debbe
Add missing imports, avoid circular imports
jhutar Jul 30, 2018
ef2ac81
Typo
jhutar Jul 30, 2018
15ac2cb
More small fixes
jhutar Jul 30, 2018
820ee77
More of imports fixing
jhutar Jul 31, 2018
3684a4c
Remove some debug prints
jhutar Aug 15, 2018
7a46517
Also show rule used
jhutar Aug 15, 2018
51daf7d
Show also tier and rhel
jhutar Aug 16, 2018
b3742fe
Way to diff two runs
jhutar Aug 16, 2018
1da10fe
Add counts
jhutar Aug 16, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
*.pyc
config.yaml
kb.json
*.swp
.cache/
.pytest_cache/
138 changes: 39 additions & 99 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,100 +1,40 @@
A set of scripts for easier parsing and batch processing of the Jenkins test reports.

Usage Examples:

Parse all tiers for the last completed builds of the job
```
In [1]: import claims

In [2]: claims.config
Out[2]:
{'bld': 'lastCompletedBuild',
'job': 'automation-6.2-tier{0}-rhel{1}',
'pwd': 'nbusr123',
'url': 'https://jenkins.server.com',
'usr': 'uradnik1'}

In [5]: reports
Out[5]:
['t1':
[
'el6': [
{
u'className': u'tests.foreman.cli.test_syncplan.SyncPlanTestCase',
u'errorDetails': None,
u'errorStackTrace': None,
u'name': u'test_negative_synchronize_custom_product_past_sync_date',
u'status': u'PASSED',
u'testActions': [],
'url': u'https://jenkins.server.com/job/automation-6.2-tier4-rhel7/lastCompletedBuild/testReport/junit/tests.foreman.cli.test_syncplan/SyncPlanTestCase/test_negative_synchronize_custom_product_past_sync_date'
}
],
'el7': [
{...}
]
],
't2': [...],
...
]
```

Get a flat list of all failed tests:
```
In [6]: failures = []

In [7]: for i in reports.keys():
...: for j in reports[i].keys():
...: failures += claims.parse_fails(reports[i][j])
...:

In [8]: len(failures)
Out[8]: 324
In [9]: failures
Out[9]:
[
{u'className': u'tests.foreman.cli.test_syncplan.SyncPlanTestCase',
u'errorDetails': u'AssertionError: Repository contains invalid number of content entities',
u'errorStackTrace': u'self = <tests.foreman.cli.test_syncplan.SyncPlanTestCase ...',
u'name': u'test_positive_synchronize_custom_product_past_sync_date',
u'status': u'FAILED',
u'testActions': [{u'reason': None}],
'url': u'https://jenkins.server.com/job/automation-6.2-tier4-rhel6/lastCompletedBuild/testReport/junit/tests.foreman.cli.test_syncplan/SyncPlanTestCase/test_positive_synchronize_custom_product_past_sync_date'
},
{...},
...
]
```

Claim unclaimed tests, containing 'foo' in the errorDetails with a reason: 'bar':
```
for f in [i for i in failures if u'foo' in i['errorDetails'] and not i['testActions'][0]['reason']]:
claims.claim(f, 'bar')
```

Iterate over a list of failures and claim them based on the provided ruleset:

```
#load the ruleset (from kb.json)
In [10]: rules = claims.load_rules()

In [11]: rules
Out[11]:
[{u'pattern': u'StaleElementReferenceException',
u'reason': u'https://github.com/SatelliteQE/robottelo/issues/4162'},
{u'pattern': u'HTTPError: 500 Server Error: Internal Server Error for url: https://jenkins.server.com/docker/api/v2/containers',
u'reason': u'https://bugzilla.redhat.com/show_bug.cgi?id=1414821'},
{u'pattern': u'Unable to log in to this Docker Registry - 404 Resource Not Found: 404 page not found',
u'reason': u'docker_infra_error'},
{u'pattern': u'VirtualMachineError: Failed to fetch virtual machine IP address information',
u'reason': u'https://github.com/SatelliteQE/robottelo/issues/4578'},
{u'pattern': u'Forbidden - server refused to process the request[^$]+Could not enable repository',
u'reason': u'outdated_subscription'},
{u'pattern': u'HTTPError: 403 Client Error: Forbidden for url[^$]+repository_sets[^$]+enable',
u'reason': u'outdated_subscription'},
{u'pattern': u'TaskTimedOutError[^$]+action[^$]+Manifest',
u'reason': u'https://bugzilla.redhat.com/show_bug.cgi?id=1339696'},
{u'pattern': u'SSHCommandTimeoutError:[^$]+hammer[^$+subscription]',
u'reason': u'https://bugzilla.redhat.com/show_bug.cgi?id=1339696'}]

In [12]: claims.claim_by_rules(failures, rules)
# Manipulate Jenkins claims with grace

For example to config, see `config.yaml.sample`.

For example on how knowleadge base could look like see `kb.json.sample`.

```
$ ./claims-cmd.py --help
usage: claims-cmd.py [-h] [--clean-cache] [--show-failed] [--show-claimed]
[--show-unclaimed] [--show-claimable] [--show SHOW]
[--claim] [--stats] [--history] [--timegraph]
[--job-group JOB_GROUP] [--grep-results REGEXP]
[--grep-rules REGEXP] [--output {simple,csv,html}] [-d]

Manipulate Jenkins claims with grace

optional arguments:
-h, --help show this help message and exit
--clean-cache Cleans cache for job group provided by "--job-group"
option (default: latest)
--show-failed Show all failed tests
--show-claimed Show claimed tests
--show-unclaimed Show failed and not yet claimed tests
--show-claimable Show failed, not yet claimed but claimable tests
--show SHOW Show detailed info about given test case
--claim Claim claimable tests
--stats Show stats for selected job group
--history Show how tests results and duration evolved
--timegraph Generate time graph
--job-group JOB_GROUP
Specify group of jobs to perform the action with
(default: latest)
--grep-results REGEXP
Only work with tests, whose "className+name" matches
the regexp
--grep-rules REGEXP Only work with rules, whose reason matches the regexp
--output {simple,csv,html}
Format tables as plain, csv or html (default: simple)
-d, --debug Show also debug messages
```
16 changes: 0 additions & 16 deletions claim_by_rules.py

This file was deleted.

13 changes: 0 additions & 13 deletions claimable.py

This file was deleted.

5 changes: 5 additions & 0 deletions claims-cmd.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-

import claims
claims.ClaimsCli().handle_args()
215 changes: 0 additions & 215 deletions claims.py

This file was deleted.

Loading