History log of /external/autotest/frontend/setup_test_environment.py
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
9a535c9f3144690cf85d88a51e07b98c21454159 24-Nov-2014 Dan Shi <dshi@chromium.org> [autotest] Add server database to django model.

Server database is added to store information about servers running in an
Autotest instance. This is the first CL to implement it. Design doc:
go/chromeos-lab-serverdb-design

django model uses db_router to rout database calls to different database
connections:
local: All AFE table calls.
global: All TKO table calls.
readonly: Calls from web frontend.

This CL adds another router for all calls to server database to `server`.

DEPLOY=migrate_server_db
CQ-DEPEND=CL:230814
BUG=chromium:424778
TEST=unitest, part of the test is done by atest code that'll be in another cl.
Test server database migration:
./database/migrate.py sync 0 -d AUTOTEST_SERVER_DB
./database/migrate.py sync 1 -d AUTOTEST_SERVER_DB
./database/migrate.py sync 2 -d AUTOTEST_SERVER_DB
./database/migrate.py sync 3 -d AUTOTEST_SERVER_DB
python frontend/health/utils_unittest.py

Change-Id: I84be386c8f5b7efd53ae1ecbd6293eae4326f19f
Reviewed-on: https://chromium-review.googlesource.com/231671
Tested-by: Dan Shi <dshi@chromium.org>
Reviewed-by: Fang Deng <fdeng@chromium.org>
Commit-Queue: Dan Shi <dshi@chromium.org>
/external/autotest/frontend/setup_test_environment.py
8a764d1fb6cd99d08cda6400bd35162fa3ac5fe0 15-Oct-2014 Jakob Juelich <jakobjuelich@chromium.org> [autotest] Use global database for tko models in django v3.

This adds the global database to django.
A django database router is added to determine to which database
should be used for which models. All tko models are always taken or
written from or into the global database while all other objects
remain unchanged.

BUG=chromium:422637
TEST=Ran suites, syncdb, restart apache, ran a suite.
Confirm global database connection is closed after each attempt to get
test view: https://x20web.corp.google.com/~beeps/log/db_routers.html

Change-Id: Idf6933d1d112bbc5a2896fa61afd03f6604dafb5
Reviewed-on: https://chromium-review.googlesource.com/223501
Tested-by: Dan Shi <dshi@chromium.org>
Reviewed-by: Prashanth B <beeps@chromium.org>
Commit-Queue: Dan Shi <dshi@chromium.org>
/external/autotest/frontend/setup_test_environment.py
7bef8416138f662c39326bdb6f8a9b548c3d4b45 15-Oct-2014 Jakob Juelich <jakobjuelich@chromium.org> [autotest] Refactor readonly_connection

The way readonly connections were used used
some monkey patching and manual connection handling.

Code gets easier to maintain if Django manages all the
database connections and no monkeypatching is done.
This is what this CL achieves.

BUG=chromium:422637
DEPLOY=apache,scheduler,host_scheduler,shard_client
TEST=Ran suites.

Change-Id: I2761af10f5172bb3558e7dbd7c1f1875f7a7cb51
Reviewed-on: https://chromium-review.googlesource.com/223393
Tested-by: Jakob Jülich <jakobjuelich@chromium.org>
Reviewed-by: Dan Shi <dshi@chromium.org>
Reviewed-by: Fang Deng <fdeng@chromium.org>
Commit-Queue: Jakob Jülich <jakobjuelich@chromium.org>
/external/autotest/frontend/setup_test_environment.py
3270e189d5da845d034231a6eb75c5bd4e37ac97 13-Oct-2014 Jakob Juelich <jakobjuelich@chromium.org> Revert "[autotest] Always use tko tables on master from shards."

This reverts commit e2bf396b7d3870f7565b2b10018087ab7fa6256e.

BUG=422637
CQ-DEPEND=CL:223065

Change-Id: I0513889a3acfc3a189843e79030da9bbd551999d
Reviewed-on: https://chromium-review.googlesource.com/223072
Reviewed-by: Fang Deng <fdeng@chromium.org>
Commit-Queue: Jakob Jülich <jakobjuelich@chromium.org>
Tested-by: Jakob Jülich <jakobjuelich@chromium.org>
/external/autotest/frontend/setup_test_environment.py
e2bf396b7d3870f7565b2b10018087ab7fa6256e 02-Oct-2014 Jakob Juelich <jakobjuelich@chromium.org> [autotest] Always use tko tables on master from shards.

tko/db.py was changed to always use settings for the global database.
This added configuration overhead for non-shard machines. This adds
the normal, old settings as a failover.

Also, this adds the global database to django.
A django database router is added to determine to which database
should be used for which models. All tko models are always taken or
written from or into the global database while all other objects
remain unchanged.

BUG=chromium:419435
TEST=Ran suites and manually tried rpcs.
DEPLOY=apache,tko

Change-Id: I675b064ffdcb0440cd33835b9a83e3858f826ca7
Reviewed-on: https://chromium-review.googlesource.com/221018
Tested-by: Jakob Jülich <jakobjuelich@chromium.org>
Reviewed-by: Fang Deng <fdeng@chromium.org>
Commit-Queue: Jakob Jülich <jakobjuelich@chromium.org>
/external/autotest/frontend/setup_test_environment.py
3536b98cf0f552eb9c4d8d6dc0403423166da9f5 29-Aug-2011 Mike Truty <truty@chromium.org> Fix django 1.3 DeprecationWarning for DATABASES.

Django 1.3 which we migrated to, modified the settings structure so that
the database settings are no longer a set of constants. They are replaced
with a dictionary of dictionaries where the 'default' dictionary contains
the desired settings. I've switched to that format to avoid the warning. Not
sure when those constants will actually stop working.

This is the actual message that no longer shows:
/usr/local/autotest/site-packages/django/db/__init__.py:19: DeprecationWarning:
settings.DATABASE_* is deprecated; use settings.DATABASES instead.

TEST=ran dashboard generation on local autotest

Change-Id: I647f2c353b67a0ec820895c7973bfffab84f3f87
Reviewed-on: http://gerrit.chromium.org/gerrit/6835
Reviewed-by: Lucas Meneghel Rodrigues <lookkas@gmail.com>
Tested-by: Lucas Meneghel Rodrigues <lookkas@gmail.com>
Reviewed-by: Dale Curtis <dalecurtis@chromium.org>
Tested-by: Mike Truty <truty@chromium.org>
/external/autotest/frontend/setup_test_environment.py
74a314b490ff542c4dd2ae4aa0d11c6394d92960 23-Jun-2011 Dale Curtis <dalecurtis@chromium.org> Upstream Autotest merge.

As titled, a merge up to 93fc426ca133e775eb495f34d138fc57d92fb55e.

- Removes a bunch of deprecated code.
- Moves several private utilities into the private repo.
- Couple changes ported upstream and resynced.

BUG=None
TEST=In progress... will spin up new Autotest server and use
run_remote_tests for bvt, regression, smoke.

Change-Id: Id3e2ad529bb7b05f148e5d98aea46bb9ea828200
Reviewed-on: http://gerrit.chromium.org/gerrit/3350
Tested-by: Dale Curtis <dalecurtis@chromium.org>
Reviewed-by: Dale Curtis <dalecurtis@chromium.org>
/external/autotest/frontend/setup_test_environment.py
78f5b016b5367cb51b1f031b31e3afea6ebd2d74 23-Dec-2009 showard <showard@592f7852-d20e-0410-864c-8624ca9c26a4> Update to Django 1.1.1. I want to use a new feature for my RESTful interface prototyping (direct inclusion of URL patterns in URLconfs).

The one obstacle this presented was that Django 1.1.1 changes the DB connection object to accept DB config information in its constructor, rather than reading it from django.conf.settings on-demand. This was a problem because we change stuff in django.conf.settings on the fly to do our fancy test DB stuff -- basically, we initialize a SQLite DB once, copy it off, and then copy it between test cases, rather than clearing and reconstructing the initial DB. I did measurements and it turns out all that jazz wasn't really saving us much time at all, so I just got rid of it all. Django's testing stuff has improved and v1.1 even has some new tricks for using transactions to accomplish the above with a dramatic speedup, so we ought to look into using that in the future.

Signed-off-by: Steve Howard <showard@google.com>


git-svn-id: http://test.kernel.org/svn/autotest/trunk@4041 592f7852-d20e-0410-864c-8624ca9c26a4
/external/autotest/frontend/setup_test_environment.py
9bb33ecab4a6e147e295e1df40ffaa155a5c7276 31-Aug-2009 showard <showard@592f7852-d20e-0410-864c-8624ca9c26a4> handy-dandy function to print all SQL queries executed during a unit test, useful for debugging failing tests (you can call it from tearDown)

Signed-off-by: Steve Howard <showard@google.com>


git-svn-id: http://test.kernel.org/svn/autotest/trunk@3624 592f7852-d20e-0410-864c-8624ca9c26a4
/external/autotest/frontend/setup_test_environment.py
a5288b4bb2b09aafe914d0b7d5aab79a7e433eaf 28-Jul-2009 showard <showard@592f7852-d20e-0410-864c-8624ca9c26a4> Upgrade from Django 0.96 to Django 1.0.2.

Risk: high (framework change)
Visibility: medium

Signed-off-by: James Ren <jamesren@google.com>


git-svn-id: http://test.kernel.org/svn/autotest/trunk@3457 592f7852-d20e-0410-864c-8624ca9c26a4
/external/autotest/frontend/setup_test_environment.py
844960a5d0a96d6a03296c4267d6295e4d479919 29-May-2009 showard <showard@592f7852-d20e-0410-864c-8624ca9c26a4> make the readonly connection fallback to the regular Django connection when running in the scheduer. this is really important, because otherwise the readonly connection is not autocommit and bad, bad things could happen, though i'm not sure exactly what existing problems there might have been. we used to do this only for testing, but since we do it in another context here, i renamed the method to be more generic and appropriate.

Signed-off-by: Steve Howard <showard@google.com>


git-svn-id: http://test.kernel.org/svn/autotest/trunk@3183 592f7852-d20e-0410-864c-8624ca9c26a4
/external/autotest/frontend/setup_test_environment.py
f8b19046c4496f570c776b65288382108a633ab4 12-May-2009 showard <showard@592f7852-d20e-0410-864c-8624ca9c26a4> Add the ability for users to add test attributes. Non-user-created attributes (added by the parser) are still immutable.
* add boolean column user_created to TestAttribute to keep track of which are user created, so we can preserve immutability
* add id primary key field to test attributes. Django requires this and we've been squeezing by without it, but we can't anymore.
* declare some PK fields AutoFields in TKO models, as they should be. this didn't matter before but does now that we have a TKO unit test, since these models determine how the test DB gets created.
* add set_test_attribute RPC to set/delete attributes
* modify get_detailed_test_views() to use the new populate_relationships() method to gather attributes and labels much more efficiently
* add rpc_interface_unittest, a unit test for the TKO rpc interface. TKO was previously completely untested, so this is the first unit test of any kind for it. since the doctests on AFE turned out to be quite unpopular, I'm using the unittest framework this time. this required some changes to AFE testing code.
* various fixes to model_logic to account for assumptions we were previously making that aren't true in TKO (mostly about PK fields being named "id").

Note that the migration may be slow, as it's adding two columns to test_attributes, a potentially large table.

Signed-off-by: Steve Howard <showard@google.com>


git-svn-id: http://test.kernel.org/svn/autotest/trunk@3109 592f7852-d20e-0410-864c-8624ca9c26a4
/external/autotest/frontend/setup_test_environment.py
364fe862f88bcaaefaa40dd145a777bee840ec9b 17-Oct-2008 showard <showard@592f7852-d20e-0410-864c-8624ca9c26a4> Refactor the basic environment setup code out of django_test_utils.py into setup_django_environment.py, and rename django_test_utils.py to setup_test_environment.py. Also changed the environment setup code to run at import time. This makes it easy for scripts, both test and non-test, to use Django models without running through manage.py. The idea is that scripts will import setup_django_environment before importing Django code (somewhat akin to common.py), and test code will subsequently import setup_test_environment.



git-svn-id: http://test.kernel.org/svn/autotest/trunk@2297 592f7852-d20e-0410-864c-8624ca9c26a4
/external/autotest/frontend/setup_test_environment.py