test(HH-572): cover PostgreSQL longest-waiting null order (#146)

Co-authored-by: Rogee <rogee@ipao.vip>
This commit is contained in:
Rogee
2026-08-24 10:09:55 +08:00
committed by GitHub
co-authored by rogee
parent eda4889d85
commit 83e2a8ead6
2 changed files with 13 additions and 1 deletions
@@ -214,7 +214,11 @@ func TestAssignmentEligibilityRejectsSoftDeletedUserAndAccountUser(t *testing.T)
}
func TestLongestWaitingSortsUnknownActivityLast(t *testing.T) {
db := setupCapacityAssignmentDB(t)
testLongestWaitingSortsUnknownActivityLast(t, setupCapacityAssignmentDB(t))
}
func testLongestWaitingSortsUnknownActivityLast(t *testing.T, db *gorm.DB) {
t.Helper()
account := &model.Account{Name: "Longest waiting"}
require.NoError(t, db.Create(account).Error)
inbox := &model.Inbox{AccountID: account.ID, Name: "Inbox", ChannelType: string(model.InboxChannelTypeWebWidget)}
@@ -221,6 +221,14 @@ func TestAssignmentServiceOnlyOneConcurrentWorkerWinsPostgres(t *testing.T) {
testAssignmentServiceOnlyOneConcurrentWorkerWins(t, db, rdb)
}
func TestLongestWaitingSortsUnknownActivityLastPostgres(t *testing.T) {
if os.Getenv("GOCHAT_TEST_DB") != "postgres" {
t.Skip("PostgreSQL longest-waiting test")
}
db, _ := setupFullAAPostgresDB_Cov9(t)
testLongestWaitingSortsUnknownActivityLast(t, db)
}
func testAssignmentServiceOnlyOneConcurrentWorkerWins(t *testing.T, db *gorm.DB, rdb *redis.Client) {
t.Helper()
account, agent, inbox, conversation := seedAssignableConversation_Cov9(t, db)