Align DeliveryResult tags and make the index table test-local
check / check (push) Successful in 2m52s
check / check (push) Successful in 2m52s
Re-align the json tag column in DeliveryResult after the wider DeliveryID gorm tag, and move the test's index table out of package scope into the test function. Model: opus-5-5
This commit is contained in:
@@ -17,23 +17,23 @@ type indexedColumn struct {
|
|||||||
field string
|
field string
|
||||||
}
|
}
|
||||||
|
|
||||||
// eventTierIndexes are the columns the background work reads by: the
|
// TestWebhookDBManager_OpenAddsEventTierIndexes verifies that opening a
|
||||||
// recovery and sweep queries (status), the event log (event_id and
|
// per-webhook database that predates these indexes creates them, so the
|
||||||
// delivery_id) and retention (created_at).
|
// queries that read by those columns stop scanning whole tables. It
|
||||||
var eventTierIndexes = []indexedColumn{
|
// stands in for an older database file by dropping the indexes
|
||||||
|
// AutoMigrate just created, then reopening the same file.
|
||||||
|
func TestWebhookDBManager_OpenAddsEventTierIndexes(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
|
// The columns the background work reads by: the recovery and sweep
|
||||||
|
// queries (status), the event log (event_id and delivery_id) and
|
||||||
|
// retention (created_at).
|
||||||
|
eventTierIndexes := []indexedColumn{
|
||||||
{&database.Delivery{}, "Status"},
|
{&database.Delivery{}, "Status"},
|
||||||
{&database.Delivery{}, "EventID"},
|
{&database.Delivery{}, "EventID"},
|
||||||
{&database.DeliveryResult{}, "DeliveryID"},
|
{&database.DeliveryResult{}, "DeliveryID"},
|
||||||
{&database.Event{}, "CreatedAt"},
|
{&database.Event{}, "CreatedAt"},
|
||||||
}
|
}
|
||||||
|
|
||||||
// TestWebhookDBManager_OpenAddsEventTierIndexes verifies that opening a
|
|
||||||
// per-webhook database that predates these indexes creates them, so the
|
|
||||||
// queries above stop scanning whole tables. It stands in for an older
|
|
||||||
// database file by dropping the indexes AutoMigrate just created, then
|
|
||||||
// reopening the same file.
|
|
||||||
func TestWebhookDBManager_OpenAddsEventTierIndexes(t *testing.T) {
|
|
||||||
t.Parallel()
|
|
||||||
|
|
||||||
mgr, lc := setupTestWebhookDBManager(t)
|
mgr, lc := setupTestWebhookDBManager(t)
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
|
|||||||
Reference in New Issue
Block a user