Skip to content

Commit

Permalink
Add unit tests for templated test utils
Browse files Browse the repository at this point in the history
Test the templated test code and adapats some existing tests
to ensure they work properly and simplify the way tests and
defs are organised.
  • Loading branch information
dosaboy committed May 6, 2023
1 parent f0463d2 commit df42f2e
Show file tree
Hide file tree
Showing 86 changed files with 758 additions and 432 deletions.
16 changes: 16 additions & 0 deletions hotsos/defs/scenarios/juju/bugs/lp1812361.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
checks:
has_lp1812361:
input: 'var/log/juju/unit-glance-simplestreams-sync*.log'
expr: '.* Missing required data: internal_host internal_port'
conclusions:
lp1812361:
decision: has_lp1812361
raises:
type: LaunchpadBug
bug-id: 1812361
message: >-
A known glance-simplestream-sync bug has been identified - this happens because
the relation data received from keystone is missing some
expected settings (internal_host and internal_port). Upgrading
charm-keystone to version >= stable/539 should fix the problem.
19 changes: 19 additions & 0 deletions hotsos/defs/scenarios/juju/bugs/lp1852502.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
checks:
has_lp1852502:
input:
command: journalctl
options:
kwargs:
unit: juju-db
expr: '.* CappedPositionLost: CollectionScan died due to position in capped collection being deleted'
conclusions:
lp1852502:
decision: has_lp1852502
raises:
type: LaunchpadBug
bug-id: 1852502
message: >-
A known mongodb bug has been identified that is known to affect backups - https://jira.mongodb.org/browse/TOOLS-1636.
Workaround is to pass --no-logs to juju create-backup. This issue only
affects Mongo 3 so using a higher version should avoid the issue.
15 changes: 15 additions & 0 deletions hotsos/defs/scenarios/juju/bugs/lp1858519.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
checks:
has_lp1858519:
input: 'var/log/juju/unit-ceph-osd*.log'
expr: '.* Cannot zap a device used by lvm'
conclusions:
lp1858519:
decision: has_lp1858519
raises:
type: LaunchpadBug
bug-id: 1858519
message: >-
A known ceph-osd charm bug has been identified - charm tried to zap a disk but
failed since the disk has an LVM header. If you are sure the disk is
not in active use by LVM, you may run pvremove on it before using it as
an OSD - see LP bug for details.
18 changes: 18 additions & 0 deletions hotsos/defs/scenarios/juju/bugs/lp1895040.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
checks:
has_unknown_relation_errors:
input:
path: 'var/log/juju/unit-*.log'
expr: '(\S+) (\S+) ERROR juju.worker.uniter agent.go:\d+ resolver loop error: unknown relation: \d+'
constraints:
# within 7 days
search-result-age-hours: 168
conclusions:
lp1895040:
decision: has_unknown_relation_errors
raises:
type: LaunchpadBug
bug-id: 1895040
message: >-
One or more charms on this host has "unknown relation" errors which is
an indication of this bug. Upgrading Juju to a version >= 2.9.13 should
fix the problem.
16 changes: 16 additions & 0 deletions hotsos/defs/scenarios/juju/bugs/lp1910958.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
checks:
has_lp1910958:
input:
path: 'var/log/juju/unit-*.log'
expr: '.* manifold worker .+ error: failed to initialize uniter for "(\S+)": cannot create relation state tracker: cannot remove persisted state, relation (\d+) has members'
hint: 'manifold worker returned unexpected error'
conclusions:
lp1910958:
decision: has_lp1910958
raises:
type: LaunchpadBug
bug-id: 1910958
message: >-
Unit {} failed to start due to members in relation {} that cannot be
removed.
search-result-format-groups: [1, 2]
16 changes: 16 additions & 0 deletions hotsos/defs/scenarios/juju/bugs/lp1948906.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
checks:
has_lp1948906:
input:
path: 'var/log/juju/unit-*.log'
expr: '.* manifold worker .+ error: executing operation \"run post-series-upgrade hook\" for (\S+): upgrade series status \"complete running\"'
hint: 'manifold worker returned unexpected error'
conclusions:
lp1948906:
decision: has_lp1948906
raises:
type: LaunchpadBug
bug-id: 1948906
message: >-
Juju post-series-upgrade failed, issues with unit {} - see LP bug for
workaround.
search-result-format-groups: [1]
13 changes: 13 additions & 0 deletions hotsos/defs/scenarios/juju/bugs/lp1983140.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
checks:
has_lp1983140:
input:
path: 'var/log/juju/machine-*.log'
expr: '.* quiescing, timed out waiting for agents to report'
conclusions:
lp1983140:
decision: has_lp1983140
raises:
type: LaunchpadBug
bug-id: 1983140
message: model migration failed - see LP bug for workaround.

13 changes: 13 additions & 0 deletions hotsos/defs/scenarios/juju/bugs/lp1983506.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
checks:
has_lp1983506:
input:
path: 'var/log/juju/machine-*.log'
expr: '.* failed to migrate binaries: charm local:.+(\S) unexpectedly assigned local:.+'
conclusions:
lp1983506:
decision: has_lp1983506
raises:
type: LaunchpadBug
bug-id: 1983506
message: model migration failed - see LP bug for workaround.

16 changes: 16 additions & 0 deletions hotsos/defs/scenarios/juju/bugs/lp1996230.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
checks:
has_lp1996230:
input:
path: 'var/log/juju/machine-*.log'
expr: '.* manifold worker .+ error: could not retrieve action (\S+): action no longer available'
hint: 'manifold worker returned unexpected error'
conclusions:
lp1996230:
decision: has_lp1996230
raises:
type: LaunchpadBug
bug-id: 1996230
message: >-
There are inconsistencies in the actionnotifications mongodb collection. See
https://canonical.lightning.force.com/lightning/r/Knowledge__kav/ka44K000000PRFmQAO/view
for instructions on how to fix.
64 changes: 0 additions & 64 deletions hotsos/defs/scenarios/juju/charm_unit_checks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,6 @@ checks:
- '^(\S+) (\S+) (?:ERROR|WARNING) unit\.([^\.]+)\.\S+ .+ Traceback \('
constraints:
search-result-age-hours: 48
has_unknown_relation_errors:
expr: '(\S+) (\S+) ERROR juju.worker.uniter agent.go:\d+ resolver loop error: unknown relation: \d+'
constraints:
# within 7 days
search-result-age-hours: 168
has_lp1812361:
input: 'var/log/juju/unit-glance-simplestreams-sync*.log'
expr: '.* Missing required data: internal_host internal_port'
has_lp1858519:
input: 'var/log/juju/unit-ceph-osd*.log'
expr: '.* Cannot zap a device used by lvm'
has_lp1910958:
expr: '.* manifold worker .+ error: failed to initialize uniter for "(\S+)": cannot create relation state tracker: cannot remove persisted state, relation (\d+) has members'
hint: 'manifold worker returned unexpected error'
has_lp1948906:
expr: '.* manifold worker .+ error: executing operation \"run post-series-upgrade hook\" for (\S+): upgrade series status \"complete running\"'
hint: 'manifold worker returned unexpected error'
conclusions:
units-have-leadership-errors:
decision: units_have_leadership_errors
Expand All @@ -51,50 +34,3 @@ conclusions:
format-dict:
units: '@checks.units_have_tracebacks.search.results_group_2:comma_join'
num_tracebacks: '@checks.units_have_tracebacks.search.results_group_2:len'
lp1812361:
decision: has_lp1812361
raises:
type: LaunchpadBug
bug-id: 1812361
message: >-
A known glance-simplestream-sync bug has been identified - this happens because
the relation data received from keystone is missing some
expected settings (internal_host and internal_port). Upgrading
charm-keystone to version >= stable/539 should fix the problem.
lp1858519:
decision: has_lp1858519
raises:
type: LaunchpadBug
bug-id: 1858519
message: >-
A known ceph-osd charm bug has been identified - charm tried to zap a disk but
failed since the disk has an LVM header. If you are sure the disk is
not in active use by LVM, you may run pvremove on it before using it as
an OSD - see LP bug for details.
lp1895040:
decision: has_unknown_relation_errors
raises:
type: LaunchpadBug
bug-id: 1895040
message: >-
One or more charms on this host has "unknown relation" errors which is
an indication of this bug. Upgrading Juju to a version >= 2.9.13 should
fix the problem.
lp1910958:
decision: has_lp1910958
raises:
type: LaunchpadBug
bug-id: 1910958
message: >-
Unit {} failed to start due to members in relation {} that cannot be
removed.
search-result-format-groups: [1, 2]
lp1948906:
decision: has_lp1948906
raises:
type: LaunchpadBug
bug-id: 1948906
message: >-
Juju post-series-upgrade failed, issues with unit {} - see LP bug for
workaround.
search-result-format-groups: [1]
47 changes: 0 additions & 47 deletions hotsos/defs/scenarios/juju/jujud_machine_checks.yaml
Original file line number Diff line number Diff line change
@@ -1,25 +1,8 @@
input:
# default path can be overriden by any check
path: 'var/log/juju/machine-*.log'
checks:
jujud_not_found:
property:
path: hotsos.core.plugins.juju.JujuChecksBase.systemd_processes
ops: [[contains, jujud], [not_]]
has_lp1983140:
expr: '.* quiescing, timed out waiting for agents to report'
has_lp1983506:
expr: '.* failed to migrate binaries: charm local:.+(\S) unexpectedly assigned local:.+'
has_lp1852502:
input:
command: journalctl
options:
kwargs:
unit: juju-db
expr: '.* CappedPositionLost: CollectionScan died due to position in capped collection being deleted'
has_lp1996230:
expr: '.* manifold worker .+ error: could not retrieve action (\S+): action no longer available'
hint: 'manifold worker returned unexpected error'
conclusions:
jujud-not-found:
decision: jujud_not_found
Expand All @@ -28,33 +11,3 @@ conclusions:
message: >-
No jujud process(es) found running on this host but it seems there should
be since Juju is installed - please check.
lp1852502:
decision: has_lp1852502
raises:
type: LaunchpadBug
bug-id: 1852502
message: >-
A known mongodb bug has been identified that is known to affect backups - https://jira.mongodb.org/browse/TOOLS-1636.
Workaround is to pass --no-logs to juju create-backup. This issue only
affects Mongo 3 so using a higher version should avoid the issue.
lp1983140:
decision: has_lp1983140
raises:
type: LaunchpadBug
bug-id: 1983140
message: model migration failed - see LP bug for workaround.
lp1983506:
decision: has_lp1983506
raises:
type: LaunchpadBug
bug-id: 1983506
message: model migration failed - see LP bug for workaround.
lp1996230:
decision: has_lp1996230
raises:
type: LaunchpadBug
bug-id: 1996230
message: >-
There are inconsistencies in the actionnotifications mongodb collection. See
https://canonical.lightning.force.com/lightning/r/Knowledge__kav/ka44K000000PRFmQAO/view
for instructions on how to fix.
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,6 @@ checks:
- systemd: octavia-mysql-router
- systemd: placement-mysql-router
- systemd: vault-mysql-router
free_blocks_difficult:
input:
path: 'var/log/mysql/error.log'
expr: '(.+ \d+) (\d+:\d+:\d+) .+ (\S+) Difficult to find free blocks in the buffer pool'
conclusions:
lp1971565:
decision:
Expand All @@ -47,11 +43,3 @@ conclusions:
format-dict:
package: '@checks.has_1971565.requires.package'
version: '@checks.has_1971565.requires.version'
lp372017:
decision: free_blocks_difficult
raises:
type: LaunchpadBug
bug-id: 372017
message: >-
mariabackup ran out of innodb buffer pool.
See https://jira.mariadb.org/browse/MDEV-26784
14 changes: 14 additions & 0 deletions hotsos/defs/scenarios/mysql/bugs/lp372017.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
checks:
free_blocks_difficult:
input:
path: 'var/log/mysql/error.log'
expr: '(.+ \d+) (\d+:\d+:\d+) .+ (\S+) Difficult to find free blocks in the buffer pool'
conclusions:
lp372017:
decision: free_blocks_difficult
raises:
type: LaunchpadBug
bug-id: 372017
message: >-
mariabackup ran out of innodb buffer pool.
See https://jira.mariadb.org/browse/MDEV-26784
Loading

0 comments on commit df42f2e

Please sign in to comment.