43 Commits

Author SHA1 Message Date
Matthew Treinish
f1b08f61a2 Add sample config files for commands
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
2014-10-06 20:29:49 +00:00
Matthew Treinish
7002586529 Remove unneccesary state_path config option
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
2014-10-02 20:06:16 -04:00
Matthew Treinish
1394000b39 Add subunit2sql-db-manage utility
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
2014-09-26 14:13:18 -04:00
Matthew Treinish
3b2d1494e0 Add get_failing_from_run db api method
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
2014-09-12 19:38:15 +00:00
Matthew Treinish
950357bd9f Switch sample sqlalchemy url to use mysql
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
2014-09-12 19:38:11 +00:00
Matthew Treinish
db943945f3 Update pep8 ignore list
This commit updates the ignore list for the new hacking version. Some
additional rule skips are needed for various reasons.

Change-Id: I0f037978b76dec05cfd5eab6038252f6bc6c6db3
2014-09-03 09:10:00 -04:00
Jenkins
f6adf35923 Merge "Add new item to the TODO list" 2014-08-14 21:56:32 +00:00
Matthew Treinish
397b8f613a Add new item to the TODO list
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
2014-08-13 23:33:28 -04:00
Matthew Treinish
d43c12d1e1 Add basic support for creating a subunit stream from db
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
2014-08-12 23:18:18 -04:00
Matthew Treinish
57722c6ef5 Fix get_test_run_by_run_id() db api method
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
2014-08-02 19:41:01 -04:00
Matthew Treinish
a08a7afa81 Update the documentation
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
2014-07-27 13:15:12 -04:00
Matthew Treinish
10e5d0eda5 Bump oslo.config version
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
2014-07-23 22:53:16 +00:00
Matthew Treinish
9076f715b8 Add a .gitreview file
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
2014-07-12 12:48:23 -04:00
Matthew Treinish
2b46c7b0c7 Update the TODO file again
This commit updates the items in the TODO.rst file again. To keep it
inline with recent changes.
2014-07-09 15:55:41 -04:00
Matthew Treinish
ca04ae8034 Release subunit2sql-0.1
subunit2sql-0.1 was pushed to pypi. Change the development to be on
the next version subunit2sql 0.2
2014-07-06 14:27:34 -04:00
Matthew Treinish
6c35c5c575 Add unit tests for ReadSubunit helper methods
This commit adds unit tests for the remaining helper methods in the
ReadSubunit class.
0.1
2014-06-25 11:56:23 -04:00
Matthew Treinish
9dbaabf463 Add unit tests and fixes for increment_counts
This commit adds unit tests for the increment_counts function. In the
process of writing them several bugs in the function were fixed too.
2014-06-25 10:21:00 -04:00
Matthew Treinish
963f980ae0 Make get_duration return the proper type
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.
2014-06-25 00:31:20 -04:00
Matthew Treinish
423d13aff2 Add basic unit tests
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.
2014-06-24 20:14:18 -04:00
Matthew Treinish
81f84d66f9 Update requirements files
This commit makes some updates to the requirements files.
2014-06-24 16:26:50 -04:00
Matthew Treinish
efae453856 Add sphinx docs
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.
2014-06-24 16:21:38 -04:00
Matthew Treinish
818ce157f1 Allow oslo.db config options on the CLI
This commit changes how the oslo.db options are registered so that
they can be specified on the CLI interface.
2014-06-24 16:08:30 -04:00
Matthew Treinish
82db3dfdb5 Cleanup the readme
This commit makes some minor cleanups to the readme file.
2014-06-24 16:00:13 -04:00
Matthew Treinish
b3637c3b1b Update project packaging
This commit makes some updates to the project packaging as well as
adding a couple more short term TODOs to the list.
2014-06-24 15:50:36 -04:00
Matthew Treinish
eed1f1c9d1 Update TODO file
This commit just updates the TODO file to keep the short term goals
current.
2014-06-23 10:31:00 -04:00
Matthew Treinish
e2c0eea976 More pep8 fixes
Calling it a night time for some pep8 fixes...
2014-06-20 23:17:37 -04:00
Matthew Treinish
9664e56f01 Add CLI option to set run artifacts
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.
2014-06-20 23:10:54 -04:00
Matthew Treinish
fc721cf796 Some performance improvements to db updates
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.
2014-06-20 23:06:36 -04:00
Matthew Treinish
0290904fbd Fix more DB bugs
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.
2014-06-20 21:44:24 -04:00
Matthew Treinish
e883617115 Add Test run metadata
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.
2014-06-20 19:39:01 -04:00
Matthew Treinish
969dff7821 Fix DB bugs found testing with mysql
No one should be using this yet so I fixed a bug by changing a
migration instead of doing the right thing.
2014-06-20 18:11:27 -04:00
Matthew Treinish
937a0774c7 Fix typo setting mysql engine
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.
2014-06-20 15:30:57 -04:00
Matthew Treinish
355c57c7bd Add metadata tables and cli args for run meta
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.
2014-06-19 18:49:30 -04:00
Matthew Treinish
44c797d143 Add support for keeping a moving avg of test run_time
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
2014-06-16 16:59:35 -04:00
Matthew Treinish
03f85e3c90 Update TODO items
This commit adds a new item to the short term TODO list.
2014-06-16 11:23:52 -04:00
Matthew Treinish
f395a2b213 Store counts for runs and tests
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.
2014-06-16 11:02:21 -04:00
Matthew Treinish
595336f599 Add a TODO file
This commit adds a todo file outlining short term and longer term
things that need to be worked on.
2014-06-15 22:38:09 -04:00
Matthew Treinish
fe76e50b61 Add total run time to the runs table
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.
2014-06-14 13:53:31 -04:00
Matthew Treinish
082715bb28 Make DB path work
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.
2014-06-14 12:54:16 -04:00
Matthew Treinish
882ef3563b Make stream parser work correctly
This commit fixes the issues with the ReadSubunit class so it correctly
parseses a subunit v2 stream.
2014-06-14 01:27:46 -04:00
Matthew Treinish
893f722702 flake8 clean checkpoint
This commit takes what was in tree so far and makes it pass the tox
pep8 job.
2014-06-13 21:50:22 -04:00
Matthew Treinish
658f6c857e Flesh out more of subunit
This commit makes a first pass at the subunit parser.
2014-06-13 20:27:13 -04:00
Matthew Treinish
9d86270fac Initial commit
This just adds the basic framework for all the various pieces. The
schema will be built using alembic. Everything else is untested.
2014-06-12 23:59:00 -04:00