Sort out database usage for integration test
Current state seems to be that the resetdb.sh script (https://github.com/google/trillian/blob/master/scripts/resetdb.sh) logs in to mariadb/mysql as the root user, drops and recreates a database named "test", and sets up privileges so the database can be accessed by the user "test". I think the "test" user is created by default by the mariadb installation.
The script then goes on to create needed tables, via the storage.sql script (https://github.com/google/trillian/blob/master/storage/mysql/schema/storage.sql). Including tables Trees, Treecontrol, TreeHead, etc.
There are a few problems with this:
- All scripts needed by the log-go integration tests should be part of the repo, or of managed dependencies (be that go modules, git modules, or whatever).
- It appears the primary and secondary instance under test will use the same database and the same tables? Sounds like it could be a problem, and it's not how primary and secondary are intended to be deployed, right?
- The resetdb script, which should be run between tests, needs access to the database root user. Database setup needed that kind of privileges should only be done once.
- Per-test database setup should be integrated into out test.sh script.
- Copying storage.sql into the log-go repo, to make it more self contained, implies that it might get out of sync, and need update whenever trillian version is updated.