diff --git a/gumble/gumble/integration_audio_test.go b/gumble/gumble/integration_audio_test.go index e578e2a..bc24a55 100644 --- a/gumble/gumble/integration_audio_test.go +++ b/gumble/gumble/integration_audio_test.go @@ -27,7 +27,13 @@ func (l *integrationAudioListener) OnAudioStream(e *gumble.AudioStreamEvent) { // TestLocalMumbleAudioRoundTrip sends generated 440 Hz audio through a real // local Mumble server and requires the other client to decode non-silent PCM. -func TestLocalMumbleAudioRoundTrip(t *testing.T) { +func TestLocalMumbleAudioRoundTrip(t *testing.T) { testLocalMumbleAudioRoundTrip(t, false) } + +// Regression: TCP tunnel fallback must remain usable when UDP is deliberately +// disabled or blocked, rather than silently dropping valid audio. +func TestLocalMumbleTCPAudioFallback(t *testing.T) { testLocalMumbleAudioRoundTrip(t, true) } + +func testLocalMumbleAudioRoundTrip(t *testing.T, disableUDP bool) { if os.Getenv("BARNARD_MUMBLE_INTEGRATION") != "1" { t.Skip("set BARNARD_MUMBLE_INTEGRATION=1") } @@ -35,7 +41,7 @@ func TestLocalMumbleAudioRoundTrip(t *testing.T) { c := gumble.NewConfig() c.Address = "localhost:64738" c.Username = name - c.DisableUDP = false + c.DisableUDP = disableUDP return c } tlsConfig := &tls.Config{InsecureSkipVerify: true} @@ -57,7 +63,11 @@ func TestLocalMumbleAudioRoundTrip(t *testing.T) { t.Fatal("no negotiated audio encoder") } time.Sleep(1500 * time.Millisecond) - if !sender.UDPActive() || !receiver.UDPActive() { + if disableUDP { + if sender.UDPActive() || receiver.UDPActive() { + t.Fatal("UDP activated despite TCP-only configuration") + } + } else if !sender.UDPActive() || !receiver.UDPActive() { t.Fatalf("native UDP did not become active: sender=%v receiver=%v", sender.UDPActive(), receiver.UDPActive()) } frame := make([]int16, sendConfig.AudioFrameSize())