http://hg.code.sf.net:8000/p/roundup/code/atom-log/tip/test/test_anydbm.py Mercurial Repository: p/roundup/code: test/test_anydbm.py history 2022-08-04T14:41:58-04:00 Summary: Support selecion session/otk data store. Add redis as data store. http://hg.code.sf.net:8000/p/roundup/code/#changeset-3f60a71b081240cebcb1c0e96d760e7a9c790612 John Rouillard rouilj@ieee.org 2022-08-04T14:41:58-04:00 2022-08-04T14:41:58-04:00
changeset 3f60a71b0812
branch
bookmark
tag
user John Rouillard <rouilj@ieee.org>
description Summary: Support selecion session/otk data store. Add redis as data store.

Allow admin to select the backend data store. Compatibility matrix:

main\/ session>| anydbm | sqlite | redis | mysql | postgresql |
anydbm | D | | X | | |
sqlite | X | D | X | | |
mysql | | | | D | |
postgresql | | | | | D |
--------------------------------------------------------------+
D - default if unconfigured, X - compatible choice

DETAILS

roundup/configuration.py:
add config.ini section sessiondb with settings: backend and redis_url.

CHANGES.txt, doc/admin_guide.txt, doc/installation.txt, doc/upgrading.txt:
doc on config of session db and redis. Plus some other fixes:

admin - clarified why we do not drop __words and __testids
table in native-fts conversion. TYpo fix.

upgrading - doc how you can keep using anydbm for session data with
sqlite. Fix dupe sentence in an upgrading config.ini
section.

roundup/backends/back_anydbm.py, roundup/backends/back_sqlite.py:
code to support redis, redis/anydbm backends respectively.

roundup/backends/sessions_redis.py
new storage backend for redis.

roundup/rest.py, roundup/cgi/actions.py, roundup/cgi/templating.py
redis uses a different way of calculating lifetime/timestamp.
Since expiration of an item occurred if its timestamp was more
than 1 week old, code would calculate:
now - 1 week + lifetime.
But this results in faster expiration in redis if used for
lifetime/timestamp.
Convert code to use the lifetime() method in BasicDatabase
that generates the right timestamp for each backend.

test/session_common.py:
added tests for more cases, get without default, getall non-existing
key etc. timestamp test changed to use new self.get_ts which is
overridden in other tests. Test that datatypes survive storage.

test/test_redis_session.py:
test redis session store with sqlite and anydbm primary databases

test/test_anydbm.py, test/test_sqlite.py
add test to make sure the databases are properly set up

sqlite - add test cases where anydbm is used as datastore
anydbm - remove updateTimestamp override add get_ts().

test/test_config.py
tests on redis_url and compatibility on choice of sessiondb backend

.travis.yml:
add redis db and redis-py
files
- issue2551223 - fix timestamp truncation in mysql and postgresql http://hg.code.sf.net:8000/p/roundup/code/#changeset-bdd28b244839c257336c4eefc7ba45593437d1d3 John Rouillard rouilj@ieee.org 2022-07-25T17:20:20-04:00 2022-07-25T17:20:20-04:00
changeset bdd28b244839
branch
bookmark
tag
user John Rouillard <rouilj@ieee.org>
description - issue2551223 - fix timestamp truncation in mysql and postgresql

The data types used to represent timestamps in pg and mysql for
ephemeral tables: sessions and otks don't have enough signifcant
digits to work. As a result the timestamps are rounduped (up/down)
rsuling in the stored timestamp being 2 minutes (pg) or 2-3
hours(mysql) off from what it should be.

Modify db schema to use a numeric type that preserves more significant
figures. Implement schema upgrade. Document need for upgrade in
upgrading.txt.

Write tests for schema upgrade.

Implement test for updateTimestamp method on BasicDatabase that showed
this issue in the first place. Write overrides for test for
anydbm/memorydb which store timestamp properly or not at all.
files
update session db tests http://hg.code.sf.net:8000/p/roundup/code/#changeset-044dcf3608a27540b78d8dec68b84705abea30e8 John Rouillard rouilj@ieee.org 2022-07-25T15:02:30-04:00 2022-07-25T15:02:30-04:00
changeset 044dcf3608a2
branch
bookmark
tag
user John Rouillard <rouilj@ieee.org>
description update session db tests

session_common.py:

testList had no asserts. While adding them I found out the memory
and anydbm backends return byte strings while the rdbms backend
return strings. So added a call to s2b defined in each db test file
to covert. rdbms i a no-op and memory/anydbm call
roundup.anypy.strings::s2b().

also add some data to other tests and verify it.

other files:
define s2b appropriately.
files
[REST-rebased] Integrate REST tests into db framework http://hg.code.sf.net:8000/p/roundup/code/#changeset-fcbeff272828220b7566ee26a15ba1e5acd77121 Ralf Schlatterbeck rsc@runtux.com 2019-01-30T13:58:14+01:00 2019-01-30T13:58:14+01:00
changeset fcbeff272828
branch REST-rebased
bookmark
tag
user Ralf Schlatterbeck <rsc@runtux.com>
description Integrate REST tests into db framework
files
Python 3 preparation: make relative imports explicit. http://hg.code.sf.net:8000/p/roundup/code/#changeset-d26921b851c328681aa6638475ce2cdae29963b4 Joseph Myers jsm@polyomino.org.uk 2018-07-24T22:22:08+00:00 2018-07-24T22:22:08+00:00
changeset d26921b851c3
branch
bookmark
tag
user Joseph Myers <jsm@polyomino.org.uk>
description Python 3 preparation: make relative imports explicit.

Tool-generated patch.
files
Fix commits although a Reject exception is raised http://hg.code.sf.net:8000/p/roundup/code/#changeset-62de601bdf6fd224fead26c33b585af5a05e7d80 Ralf Schlatterbeck rsc@runtux.com 2018-04-20T18:46:28+02:00 2018-04-20T18:46:28+02:00
changeset 62de601bdf6f
branch
bookmark
tag
user Ralf Schlatterbeck <rsc@runtux.com>
description Fix commits although a Reject exception is raised

Fix the problem that changes are committed to the database (due to
commits to otk handling) even when a Reject exception occurs. The fix
implements separate database connections for otk/session handling and
normal database operation.
files
Add (currently failing) test for atomic actions http://hg.code.sf.net:8000/p/roundup/code/#changeset-efb34cbdba7c2610de41c0e4241f6a388ebb3329 Ralf Schlatterbeck rsc@runtux.com 2017-11-06T09:26:59+01:00 2017-11-06T09:26:59+01:00
changeset efb34cbdba7c
branch
bookmark
tag
user Ralf Schlatterbeck <rsc@runtux.com>
description Add (currently failing) test for atomic actions

Actions via the web-interface can have several database-modifying
instructions. These should be atomic, i.e., either all should go in or
none. This is currently not the case due to commit calls from OTK
handling (CSRF-protection).
files
Remove unneeded TestSuite code from tests http://hg.code.sf.net:8000/p/roundup/code/#changeset-364c549918613cff81c3ebe07aee4025e0ef3fcc John Kristensen john@jerrykan.com 2015-08-21T13:08:02+10:00 2015-08-21T13:08:02+10:00
changeset 364c54991861
branch
bookmark
tag
user John Kristensen <john@jerrykan.com>
description Remove unneeded TestSuite code from tests

The TestSuite code is no longer needed now that we are using py.test
which can automatically discover tests
files
Update tests to work with py.test http://hg.code.sf.net:8000/p/roundup/code/#changeset-63c79c0992aeb805fbed74a82881d2eb32bbb70d John Kristensen john@jerrykan.com 2015-08-20T14:44:49+10:00 2015-08-20T14:44:49+10:00
changeset 63c79c0992ae
branch
bookmark
tag
user John Kristensen <john@jerrykan.com>
description Update tests to work with py.test

py.test searches for any class that looks like a TestCase in the test
directory and tries to run them as tests. Some of the classes that
inherit TestCase are not meant to be run and are only intended to be
"helper classes". Only the tests of the classes that inherit the "helper
classes" should be run. If we convert these "helper classes" to be
"mixins" py.test should not pick them up.
files
HTML* classes for cgi are now all new-style http://hg.code.sf.net:8000/p/roundup/code/#changeset-f6e76a03b502d3e331cc7d888fbc70c3afea18b8 Ralf Schlatterbeck rsc@runtux.com 2014-03-29T10:52:20+01:00 2014-03-29T10:52:20+01:00
changeset f6e76a03b502
branch
bookmark
tag
user Ralf Schlatterbeck <rsc@runtux.com>
description HTML* classes for cgi are now all new-style

Add regression test for old behaviour: Lookup of a value of a
HTMLProperty was possibly via getitem -- for old-style classes this
worked because __getattr__ returned the __getitem__ of a newly created
HTMLItem object, this does no longer work for new-style classes as these
look up special method only on the class not the instance.
files
Remove keyword expansions from CVS. All regression tests passed afterwards. http://hg.code.sf.net:8000/p/roundup/code/#changeset-6e3e4f24c75376f61ae0bf0e9ee334567585c38e Eric S. Raymond esr@thyrsus.com 2011-11-16T09:51:38-05:00 2011-11-16T09:51:38-05:00
changeset 6e3e4f24c753
branch
bookmark
tag
user Eric S. Raymond <esr@thyrsus.com>
description Remove keyword expansions from CVS. All regression tests passed afterwards.
files
don't try to import all backends in backends.__init__ unless we *want* to http://hg.code.sf.net:8000/p/roundup/code/#changeset-adec352e2ce05c53bc62d77df81b56e4fa61a63c Richard Jones richard@users.sourceforge.net 2004-11-03T01:34:21+00:00 2004-11-03T01:34:21+00:00
changeset adec352e2ce0
branch
bookmark
tag
user Richard Jones <richard@users.sourceforge.net>
description don't try to import all backends in backends.__init__ unless we *want* to
files
Finished implementation of session and one-time-key stores for RDBMS backends. http://hg.code.sf.net:8000/p/roundup/code/#changeset-c091cacdc505c94fed0c4fddba142d9646f96214 Richard Jones richard@users.sourceforge.net 2004-03-18T01:58:46+00:00 2004-03-18T01:58:46+00:00
changeset c091cacdc505
branch
bookmark
tag
user Richard Jones <richard@users.sourceforge.net>
description Finished implementation of session and one-time-key stores for RDBMS backends.

Refactored the API of sessions and their interaction with the
backend database a fair bit too.

Added some session tests. Nothing testing ageing yet, 'cos that's a pain
inna ass to test :)

Note: metakit backend still uses the *dbm implementation. It might
want to implement its own session store some day, as it'll be faster than
the *dbm one.
files
Fixed retirement of items in rdbms imports [SF#841355] http://hg.code.sf.net:8000/p/roundup/code/#changeset-f9316d2cd5ba6dab9a51ea45ff3e6b55f3faba0c Richard Jones richard@users.sourceforge.net 2003-11-14T00:11:19+00:00 2003-11-14T00:11:19+00:00
changeset f9316d2cd5ba
branch
bookmark
tag
user Richard Jones <richard@users.sourceforge.net>
description Fixed retirement of items in rdbms imports [SF#841355]

Fixed bug in looking up journal of newly-created items in *dbm backends
files
Backend improvements. http://hg.code.sf.net:8000/p/roundup/code/#changeset-f63aa57386b0b2c50eb311d6b407a12e9b5e45db Richard Jones richard@users.sourceforge.net 2003-10-25T22:53:26+00:00 2003-10-25T22:53:26+00:00
changeset f63aa57386b0
branch
bookmark
tag
user Richard Jones <richard@users.sourceforge.net>
description Backend improvements.

- using Zope3's test runner now, allowing GC checks, nicer controls and
coverage analysis
- all RDMBS backends now have indexes on several columns
- added testing of schema mutation, fixed rdbms backends handling of a
couple of cases
- !BETA! added postgresql backend, needs work !BETA!
files