Page MenuHomeSoftware Heritage

swh-vault: Unify db initialization scheme
Open, NormalPublic

Description

To avoid confusion as to how running db tests in modules (make test), we should align how their db data is boostraped.
Where it makes sense to do so (that is where we do not depend on some other framework tools, e.g. swh-deposit depends on django...).

Gist of it is:

make -C $SWH_ENVIRONMENT_HOME rebuild-testdata

This drops db, creates db, inject schema + data and creates dumps for the tests to run.

And then, from the module:

make test

Add what's necessary for the vault to be compliant in that regards.

14:23:15  +ardumont | (it's just a matter of adding the proper sql/Makefile, update swh-environment/Makefile, and adapting slightly the db fixture instance in the vault, and we should good to go)
14:23:21  +ardumont | "just" ;)

Event Timeline

ardumont created this task.Apr 26 2018, 2:40 PM
ardumont triaged this task as Normal priority.

Adding IRC discussion:

10:14:39  +ardumont | seirl: how are we supposed to run the vault tests?
10:14:58  +ardumont | like i mentioned a while ago, that's not running ok for me
10:15:16  +ardumont | i don't see the swh-vault in the modules to run for the rebuild-testdata routine
10:15:53  +ardumont | (routine in charge of dropping, creating, resetting, initializing, etc... the db and creating the dumps for the tests)
10:17:30  +ardumont | and indeed, i don't see any Makefile in swh-vault/sql/ which could help in plugging to that routine
10:19:06  +ardumont | to be clear, i'd like to align the vault if that's ok
10:19:25  +ardumont | i'd like to be able to run `make test` from $SWH_ENVIRONMENT_HOME (that's what i call it ;)
10:19:45      +zack | ardumont: yep, that remains definitely a goal, thanks for working on this!                                                                                                                  10:20:42      
...

P251 revealed some issues which are now fixed (yeah!).
Still, the bootstrap remains to be done, it's on hold though.

14:18:22  +ardumont | > the vault tests run fine here without the database: so to clarify, tests use a database, the initialization scheme is just slightly divergent from the other db
14:18:38  +ardumont | as the vault only defines on swh-vault-schema.sql, this is loaded through psql
14:18:56  +ardumont | whereas other modules uses the dump scheme initialized through the rebuild-testdata routine
14:19:42  +ardumont | there is another exception which uses directly django to initialize its schema, the deposit
14:20:47  +ardumont | > ardumont: yep, that remains definitely a goal, thanks for working on this!
14:21:35  +ardumont | zack: do i unify here or not then?
14:21:54  +ardumont | i have "don't fix it if it ain't broken" and all that in my mind ;)
14:23:15  +ardumont | (it's just a matter of adding the proper sql/Makefile, update swh-environment/Makefile, and adapting slightly the db fixture instance in the vault, and we should good to go)
14:23:21  +ardumont | "just" ;)
14:26:21  +ardumont | barf, s/defines on swh-vault-schema.sql/defines ONE swh-vault-schema.sql/
14:27:24     +olasd | please don't migrate while we're still generating the testdata repo by hand