mirror of
https://github.com/Mezeporta/Erupe.git
synced 2026-03-21 23:22:34 +01:00
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:
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user