fix(channelserver): eliminate test log spam, schema errors, and slow setup

Three fixes for the channelserver test suite:

- Add net.ErrClosed check in acceptClients() so a closed listener
  breaks the loop immediately instead of spinning and logging warnings.
  This is correct production behavior too.

- Remove -c flag from pg_restore that conflicted with CleanTestDB's
  prior DROP, causing "gook DROP CONSTRAINT" errors. Clean the schema
  with DROP SCHEMA CASCADE instead of per-table drops.

- Use sync.Once to apply the test schema once per binary run, then
  TRUNCATE tables for isolation. Reduces ~60 pg_restore + 29-patch
  cycles to a single setup pass.
This commit is contained in:
Houmgaor
2026-02-20 23:40:15 +01:00
parent de3bf9173a
commit 339487c3d8
2 changed files with 80 additions and 44 deletions

View File

@@ -1,6 +1,7 @@
package channelserver
import (
"errors"
"fmt"
"net"
"sync"
@@ -210,7 +211,7 @@ func (s *Server) acceptClients() {
shutdown := s.isShuttingDown
s.Unlock()
if shutdown {
if shutdown || errors.Is(err, net.ErrClosed) {
break
} else {
s.logger.Warn("Error accepting client", zap.Error(err))