This commit adds a sample config file for each of the current 3
commands in subunit2sql. The files contain the current list of options
which can potentially be set in a config file when using the command.
However for some of the arguments it doesn't make any sense to use them
outside of the cli.
The sample config files can be generated using the oslo-config-generator
utility with the config files added in the config-generator dir.
Change-Id: Ie578f99f27553e14fca4153a9ac5b5aa1c7eb49e
This commit removes the uncessary state_path config option. This was
only used to manage the location where a sqlite db would be kept.
However, since several migrations don't work with sqlite and support
for using it has been dropped there is no reason to keep the extra
option around. Especially since it's been inconsitently used as the
rest of the project has grown. If sqlite support is ever brought back
this option can be added again in a more uniform and consistent manner.
Change-Id: I88910e85a2248d16bf691a4e01ce5a5f4c64e943
This commit adds a new cli utility for managing the subunit2sql db.
Previously alembic could just be used directly however since access
to the db models were needed for future migration scripts the db api
was needed. This required invoking the config object to be able to
use the db api calls. Alembic isn't aware of oslo.db or the config
object, so by creating a seperate cli interface we initialize all of
that at the same time. This also saves the need to configure
connection info to the db in 2 places, since just the oslo.db option
will be used.
This utility borrows heavily from the neutron utility to do the same
thing.
Change-Id: I110baa532d08de4ca70b7ea2d1dcdc845d595693
This commit adds a new db api method to return a list of test_run
objects that failed for a given run_id. This is needed for adding a
subunit2sql based repository in testrepository.
Change-Id: Ib4a283fc3abeae1ecfc74995c2ad85564b06671a
Since the most recent migration broke support for using a sqlite db
it makes sense to update the db in the alembic.ini to use another
db. This commit switches the default url in the alembic.ini to use
a mysql db running on the localhost with the name subunit which is
also the username and password for that database. This is just an
example which should be changed when running the migrations on an
actual db.
Change-Id: Ibf19552758af0818217ab276e0033fcd0b2bce7b
This commit updates the ignore list for the new hacking version. Some
additional rule skips are needed for various reasons.
Change-Id: I0f037978b76dec05cfd5eab6038252f6bc6c6db3
Part of subunit2sql's goals is to add support to the testrepository
package to use subunit2sql as a configurable repository type. (just
like the current file, memory, or samba_buildfarm repository types.
Right now the data model of the subunit2sql db schema won't work with
that. Testrespository assumes that runs are added to the repository
in an order and can be retrieved based on that. So in order to support
that use case, support needs to be added to the data model for knowing
the order runs were added to the DB. However since since the schema
will require changes a new migration must be added to add this to the
data model.
This commit updates the TODO list to add this work item.
Change-Id: I1e5f140eb1df21eb1239e02e048346843d3b42ec
This adds a new command, sql2subunit, to take a run_id and create a
subunit stream from all the data in the db around that run_id.
Change-Id: Id1f95da71f3d4ca8469e985ee904e91fb4acb247
The get_test_run_by_run_id() method was broken, it was using the
incorrect db model name. (a copy and paste error) so the method
would not work. This corrects the issue so you can get all the
test runs for a give run_id field.
Change-Id: I289b04f8a1a26a34be2e22507c95a80c9347b1ad
This commit updates the documentation for subunit2sql. It adds details
to the README around running setting up the DB and running subunit2sql.
Also, the db api autodoc usage is corrected so that it properly
generates the documentation. Finally, the sphinx theme is switched to
oslosphinx to have consistent style with the documentation for the
other OpenStack projects.
Related-Bug: #1348202
Change-Id: Icf148dee19bb888b551e60a396f87f6c09553e09
There is a bug in oslo.config <=1.3.0 when registering cli opts with
deprecated_opts set. This causes an error with registering the oslo.db
opts. The bug was fixed post 1.3.0, so pinning this to >= the latest
alpha, which will pull in any release 1.4.0 when it becomes available.
Closes-Bug: #1347911
Change-Id: I58505ffcdfb0acf0ed2137282c18258e94e201f6
Since subunit2sql was adopted by openstack-infra code submissions and
reviews will be done in openstack gerrit. This commit adds a
.gitreview file to subunit2sql, so that by default the git review
command will point to the right location for subunit2sql.
Change-Id: I043cbd59fb7c3e83de2dfe8922b0ab96c56cd37f
The get_duration code was borrowed from tempest's subunit-trace script
which had it return a string marking it in secs. However, a float was
the proper type for the variable. So instead of converting the return
for every instance just have it return the proper type.
This commit adds the first unit tests to the projects. Right now
it's just testing a couple of utility methods. Mostly because they
were the easiest tests to write.
This commit actually adds support for building the docs with sphinx.
Before we had a tox job for building docs but there wasn't actually
anything to build.
This commit adds a new CLI/Config option to set a string which is used
to indicate the location of test artifacts. For example a web address
pointing to run logs.
This commit gets a bit smarter and limits the amount of db writes we
need. Instead of updating everything for every test in the list it
does the summing up front where possible. Also for new tests there is
no need to break up the add and update so this breaks it into an
either or situation. Lastly, the session object is properly being
passed to every operation. Before there were some that were missed.
This commit adds a migration to actually set indexes besides
the primary keys. They were set in the models but the schema didn't
have them. Also fix setting the status in the DB api.
This commit adds support for using the test_run metadata table. It
will take the attrs from the the test id and the tags from the subunit
stream and add them to the metadata table.
For the runs table migration the mysql_engine param was set as true
which obviously isn't a valid mysql_engine. This commit fixes it
and sets it to the proper innodb.
This commit adds a key value metadata table for each of the 3 object
types: test, run, and test_run including the ORM model for the new
tables. An DB API call is added to set the metadata for a run and
a CLI argument is added to added to set arbitrary metadata about
the run(s) being added to the db.
This commit adds a tracking the moving average of individual test
run times. It involves added a new column to the tests table and
handling updating the test row on each time the test shows up in
a subunit stream being processed
This commit adds count updates to both the run and test tables.
Before this commit the counts of test status in the run table and
test tables weren't ever used.
This commit adds calculating the total run time in secs and storing
that in the runs table to the script. This also converts the column
in the runs table to be a float not an int. Normally this would
require a separate migration but since I just pushed this I'm
assuming I'm not going to break existing DBs.
This commit takes the db code from previous commits, the api, models,
and schema migrations and fixes the bugs in them to make them work
as intended. From here we have a working base which can be expanded
to make the tool more feature rich.
It should probably be noted that the one test I did at this point
had terrible performance. I loaded a tempest run subunit ouput file
with roughly 2300 tests in it. This might have been either a sqlite
issue or my use of session is far from ideal. I'm assuming the latter.