Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FR: history explorer for looking at old runs #224

Open
aspiers opened this issue Feb 26, 2019 · 6 comments
Open

FR: history explorer for looking at old runs #224

aspiers opened this issue Feb 26, 2019 · 6 comments

Comments

@aspiers
Copy link

aspiers commented Feb 26, 2019

Forgive me if I'm missing something here, but it seems that stestr goes to a fair bit of trouble to store old test runs in the file- or sqlite-backed database, but doesn't actually facilitate accessing that history in any way except stestr last for looking at the most recent run. Is that right? If so it would be really nice to have a new subcommand (e.g. stestr history) for exploring old runs.

Example user stories

  • As a developer who is trying to track down a heisenbug, I would like to be able to type something like stestr history --failing=my.test.which.triggers.awkward.heisenbug in order to obtain a list of all historical test runs where the heisenbug was triggered.

  • As a developer who has made a mess and broken his local git branch, I would like to be able to find the exact time of the last run where all the tests passed, via something like stestr history --passing --limit 1, in order to use the git reflog to restore the code to that point.

  • As a developer who is trying to pin down a strange issue stemming from the interaction of tests A and B, I would like to be able to simultaneously view in different terminals the test outputs from:

    • a passing run of just test A
    • a passing run of just test B
    • a single --serial run where test A passes and then test B fails
@mtreinish
Copy link
Owner

Yeah, the history features in stestr at this point is just what testr gave us, which was never much. My intent when I forked from testr was to expand it and leverage all the features that subunit2sql provided for doing this (which is why the experimental subunit2sql backend is there). I just got side tracked and never firmed up the subunit2sql support so I never made any further progress on this. You probably could leverage this a bit today by using subunit2sql-graph (or even openstack-health) and the experimental sql repository type. But, that's far from where I'd like to see this.

That being said I'm definitely in favor of doing something like this, and I think the 3 use cases you've outlined are a good starting point to start discussing what this should look like and how we go about writing it. I also think we should decouple it's implementation from the subunit2sql backend (because there is still work to do on the subunit2sql side around generating an output subunit stream from the DB with attachments) which might double the future work, but at least will enable us to move forward on this.

@mtreinish
Copy link
Owner

As an aside one thing you bring up is in the second example is that right now we don't track sha1 or anything from git at all. It would be cool as a simple starting point to add initial support for tracking git sha1s at stestr run. The only complexity comes from what about uncommitted changes? In my typical dev workflow I run tests before making a commit, if we do track the current git ref it won't really take that kind of workflow into account.

@aspiers
Copy link
Author

aspiers commented Feb 26, 2019

Cool, thanks. Yes it should definitely be independent of the backend if possible.

@mtreinish commented on February 26, 2019 7:29 PM:

As an aside one thing you bring up is in the second example is that right now we don't track sha1 or anything from git at all. It would be cool as a simple starting point to add initial support for tracking git sha1s at stestr run. The only complexity comes from what about uncommitted changes? In my typical dev workflow I run tests before making a commit, if we do track the current git ref it won't really take that kind of workflow into account.

Yes, this is a problem. One simple solution (or at least way to dodge the issue) would just be to append -dirty to the sha1.

mtreinish added a commit that referenced this issue Feb 27, 2019
This commit adds repository APIs around storing and accessing run
metadata strings. The concept being that you can store a metadata string
to identify a run by some other identifier then the run id. The example
use case in mind for this feature is using it to store a VCS commit hash
(like a git sha1) or identifier. The APIs in this commit allow storing
metadata at run creation time, accessing the metadata for a run, and
finding run_ids by a metadata value. This is implemented for both the
file and sql repository types. The memory repository type does not have
this implemented, as it is more limited.

Related to: #224
@mtreinish
Copy link
Owner

@aspiers to facilitate the second user story I pushed up: #225 which will let us store git hashes (or any other vcs support we decide to implement) in the future and find runs based on that.

mtreinish added a commit that referenced this issue Feb 28, 2019
This commit adds repository APIs around storing and accessing run
metadata strings. The concept being that you can store a metadata string
to identify a run by some other identifier then the run id. The example
use case in mind for this feature is using it to store a VCS commit hash
(like a git sha1) or identifier. The APIs in this commit allow storing
metadata at run creation time, accessing the metadata for a run, and
finding run_ids by a metadata value. This is implemented for both the
file and sql repository types. The memory repository type does not have
this implemented, as it is more limited.

Related to: #224
mtreinish added a commit that referenced this issue Mar 17, 2019
This commit adds repository APIs around storing and accessing run
metadata strings. The concept being that you can store a metadata string
to identify a run by some other identifier then the run id. The example
use case in mind for this feature is using it to store a VCS commit hash
(like a git sha1) or identifier. The APIs in this commit allow storing
metadata at run creation time, accessing the metadata for a run, and
finding run_ids by a metadata value. This is implemented for both the
file and sql repository types. The memory repository type does not have
this implemented, as it is more limited.

Related to: #224
mtreinish added a commit that referenced this issue Apr 11, 2021
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
@mtreinish
Copy link
Owner

Just a heads up I got a start to this in #306. It doesn't do the VCS integration component yet (so I didn't mark this as fixing this issue), but it adds a history subcommand that can be used to list all past runs, view a past run, and/or remove a run from the repository. Once the command is in place we can look at expanding it's functionality to include things like the VCS integration, search by results and metadata, and other things.

@aspiers
Copy link
Author

aspiers commented Apr 11, 2021

Nice! Thanks for the update and hope you're well :-)

mtreinish added a commit that referenced this issue Apr 11, 2021
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
mtreinish added a commit that referenced this issue Apr 11, 2021
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
mtreinish added a commit that referenced this issue Apr 11, 2021
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
mtreinish added a commit that referenced this issue Apr 11, 2021
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants