Skip to content

Commit

Permalink
Add history command to stestr
Browse files Browse the repository at this point in the history
This commit adds a new command to stestr, history. The history command
is used for interacting with the history of results in the repository.
Prior to this commit you could only interact with the most recent run in
the repository via the last command, but anything older was just taking
up disk space and never used. The history command to start has 3
subcommands, 'list', 'show', and 'remove'. List will generate a table of
all the contents of the repository that will show the run id, the result
of the run, when it started, how long it took, and optionally show any
metadata for the run. Show will show a run in the repository, this is
equivalent to 'stestr last', but takes an optional run id instead of just
unconditionally showing the last run. Remove is used to remove runs from
the repository, this is useful if you don't need the history anymore and
want to clean up some disk space.

Fixes #303
Starts #224
  • Loading branch information
mtreinish committed Apr 11, 2021
1 parent 2b717fd commit 7214b2e
Show file tree
Hide file tree
Showing 13 changed files with 623 additions and 1 deletion.
17 changes: 17 additions & 0 deletions doc/source/MANUAL.rst
Original file line number Diff line number Diff line change
Expand Up @@ -560,6 +560,23 @@ runner per test it runs. To avoid cross-test-runner interactions concurrency
is disabled in this mode. ``--analyze-isolation`` supersedes ``--isolated`` if
they are both supplied.

History
-------

stestr keeps a history of all test runs in a local repository. the
``stestr history`` command is used for interacting with those old runs. The
history command has 3 sub-commands, ``list``, ``show``, and ``remove``. The
``list`` sub-command will generate a list of the previous runs in the data
repository and show some basic stats for each run. The ``show`` sub-command is
used to retreive the record of a previous run, it behaves identically to
``stestr last``, except that it takes an optional run id to show any run in the
stestr history. If a run id is not specified it will use the most recent
result. The ``remove`` sub-command will delete a specified run from the data
repository. Additionally, the keyword ``all`` can be used to remove all runs
from the repository. For example::

$ stestr history remove all

Repositories
------------

Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# process, which may cause wedges in the gate later.
future
pbr!=2.1.0,>=2.0.0,!=4.0.0,!=4.0.1,!=4.0.2,!=4.0.3 # Apache-2.0
PrettyTable>=0.7.2 # BSD
cliff>=2.8.0 # Apache-2.0
python-subunit>=1.4.0 # Apache-2.0/BSD
fixtures>=3.0.0 # Apache-2.0/BSD
Expand Down
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ stestr.cm =
list = stestr.commands.list:List
load = stestr.commands.load:Load
slowest = stestr.commands.slowest:Slowest
history = stestr.commands.history:History

[extras]
sql =
Expand Down
8 changes: 7 additions & 1 deletion stestr/commands/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,18 @@
# under the License.

from stestr.commands.failing import failing as failing_command
from stestr.commands.history import history_list as history_list_command
from stestr.commands.history import history_remove as history_remove_command
from stestr.commands.history import history_show as history_show_command
from stestr.commands.init import init as init_command
from stestr.commands.last import last as last_command
from stestr.commands.list import list_command
from stestr.commands.load import load as load_command
from stestr.commands.run import run_command
from stestr.commands.slowest import slowest as slowest_command


__all__ = ['failing_command', 'init_command', 'last_command',
'list_command', 'load_command', 'run_command', 'slowest_command']
'list_command', 'load_command', 'run_command', 'slowest_command',
'history_show_command', 'history_list_command',
'history_remove_command']
Loading

0 comments on commit 7214b2e

Please sign in to comment.