Support a separate database for Web UI tables
This commit is contained in:
1 parent
a2f8e59d9b
commit
f464dc0af9
38 files changed
+880
-302
No files matched your search
@@ -30,7 +30,12 @@ type itZoneAPI struct {
|
||||
|
||||
func newITZoneAPI(t *testing.T) itZoneAPI {
|
||||
t.Helper()
|
||||
d := newITDatabase(t, itOptions{prefix: "zones_"})
|
||||
return newITZoneAPIWith(t, itOptions{prefix: "zones_"})
|
||||
}
|
||||
|
||||
func newITZoneAPIWith(t *testing.T, opts itOptions) itZoneAPI {
|
||||
t.Helper()
|
||||
d := newITDatabase(t, opts)
|
||||
db, tables := d.migrated(t)
|
||||
users := newUserStore(db, tables)
|
||||
admin, err := users.CreateUser(t.Context(), "alice", "admin", "test", modelNow)
|
||||
@@ -544,7 +549,7 @@ func TestIntegrationZoneAPIAuditRollback(t *testing.T) {
|
||||
it := newITZoneAPI(t)
|
||||
it.call(t, it.admin, "zone_create", "", "", zoneAPITestCreate, 201)
|
||||
tn := it.server.tables
|
||||
it.db.rootExec(t, tn.sql("CREATE TRIGGER fail_zone_audit BEFORE INSERT ON {audit} FOR EACH ROW "+
|
||||
it.db.rootExec(t, tn.sql("CREATE TRIGGER "+qualifiedIdent(it.db.webui, "fail_zone_audit")+" BEFORE INSERT ON {audit} FOR EACH ROW "+
|
||||
"BEGIN IF NEW.operation = 'record_create' AND EXISTS (SELECT 1 FROM {records} WHERE name = 'new') "+
|
||||
"THEN SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT = 'forced audit failure'; END IF; END"))
|
||||
c := it.request(it.admin, "record_create", "", "", zoneAPITestRecord)
|
||||
@@ -558,7 +563,7 @@ func TestIntegrationZoneAPIAuditRollback(t *testing.T) {
|
||||
}
|
||||
it.audit(t, "record_create", 0)
|
||||
it.serial(t, newSOASerial(modelNow))
|
||||
it.db.rootExec(t, "DROP TRIGGER fail_zone_audit")
|
||||
it.db.rootExec(t, "DROP TRIGGER "+qualifiedIdent(it.db.webui, "fail_zone_audit"))
|
||||
it.call(t, it.admin, "record_create", "", "", zoneAPITestRecord, 201)
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user