mirror of
https://github.com/Mezeporta/Erupe.git
synced 2026-03-29 03:52:41 +02:00
fix(channelserver): fix flaky integration tests from 3 isolation issues
- testhelpers_db: retry truncateAllTables up to 3 times on deadlock, which occurs when previous tests' goroutines still hold DB connections - handlers_rengoku_integration_test: restore rengoku_score table after TestRengokuData_SaveOnDBError drops it, preventing cascading failures in all subsequent rengoku tests - client_connection_simulation_test: fix TestClientConnection_PacketDuringLogout to accept both race outcomes (save-wins or logout-wins) since both handlers independently load from DB and last-writer-wins is valid
This commit is contained in:
@@ -543,7 +543,17 @@ func TestRengokuData_SaveOnDBError(t *testing.T) {
|
||||
server := createTestServerWithDB(t, db)
|
||||
session := createTestSessionForServerWithChar(server, charID, "ErrChar")
|
||||
|
||||
// Drop the rengoku_score table to trigger error in score extraction
|
||||
// Drop the rengoku_score table to trigger error in score extraction.
|
||||
// Restore it afterward so subsequent tests aren't affected.
|
||||
defer func() {
|
||||
_, _ = db.Exec(`CREATE TABLE IF NOT EXISTS rengoku_score (
|
||||
character_id int PRIMARY KEY,
|
||||
max_stages_mp int NOT NULL DEFAULT 0,
|
||||
max_points_mp int NOT NULL DEFAULT 0,
|
||||
max_stages_sp int NOT NULL DEFAULT 0,
|
||||
max_points_sp int NOT NULL DEFAULT 0
|
||||
)`)
|
||||
}()
|
||||
_, _ = db.Exec("DROP TABLE IF EXISTS rengoku_score")
|
||||
|
||||
payload := make([]byte, 100)
|
||||
|
||||
Reference in New Issue
Block a user