internal/checker+gui: remove voice-srv test (Discord doesn't expose regional voice servers via public DNS)
Build / test (push) Failing after 30s
Build / build-windows (push) Has been skipped
Release / release (push) Failing after 3m20s

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-01 19:02:11 +03:00
parent 9ea777d7b7
commit 11c4eb7f4a
9 changed files with 27 additions and 484 deletions
+19 -79
View File
@@ -48,11 +48,6 @@ type fakeProxy struct {
apiTargetPort uint16
apiTargetAddr string
// blockVoiceCONNECT, when true, makes any CONNECT to a hostname
// not equal to apiTargetHost return REP=05. Used by voice-srv
// negative scenarios.
blockVoiceCONNECT atomic.Bool
// timeoutFirstAttempt stalls the first connection on greet to
// drive a timeout. Subsequent connections behave normally.
timeoutFirstAttempt atomic.Int32
@@ -96,7 +91,7 @@ func newFakeProxy(t *testing.T, scenario string) *fakeProxy {
func needsUDPRelay(scenario string) bool {
switch scenario {
case "happy_no_auth", "happy_with_auth", "udp_unsupported", "connect_refused", "timeout_then_ok",
"voice_quality_warn", "voice_quality_fail", "voice_srv_blocked":
"voice_quality_warn", "voice_quality_fail":
return true
default:
return false
@@ -196,23 +191,6 @@ func (fp *fakeProxy) handle(conn net.Conn) {
switch cmdReq.cmd {
case 0x01: // CONNECT
// voice-srv block: refuse CONNECT to anything that isn't the
// gateway/api passthrough target. Only checked when the test
// explicitly sets blockVoiceCONNECT — keeps gateway+api happy.
if fp.blockVoiceCONNECT.Load() {
isAPITarget := fp.apiTargetHost != "" && cmdReq.host == fp.apiTargetHost && cmdReq.port == fp.apiTargetPort
isGatewayTarget := cmdReq.port == 443 && (cmdReq.host == "127.0.0.1" || cmdReq.host == "localhost") && fp.apiTargetHost == ""
_ = isGatewayTarget
if !isAPITarget {
// Refuse only :443 voice probes; allow gateway probe
// (which has its own configured port from stubGatewayAddr,
// not 443). Logic: target port == 443 → voice probe → refuse.
if cmdReq.port == 443 {
_, _ = conn.Write([]byte{0x05, 0x05, 0x00, 0x01, 0, 0, 0, 0, 0, 0})
return
}
}
}
switch fp.scenario {
case "connect_refused":
_, _ = conn.Write([]byte{0x05, 0x05, 0x00, 0x01, 0, 0, 0, 0, 0, 0})
@@ -517,25 +495,17 @@ func hostPort(addr string) (string, int) {
// proxyConfig builds a Config pointed at the given fakeProxy with sane
// short timeouts for tests.
//
// Note on voice-srv: the default Config.VoiceServerHostnames would hit
// real Discord DNS during go test — we don't want that. Override with a
// single local hostname ("localhost") so DNS always resolves to 127.0.0.1
// and the SOCKS5 CONNECT goes back to the fake proxy itself, which
// returns REP=00 on a happy CONNECT or REP=05 when blockVoiceCONNECT is
// flipped.
func proxyConfig(fp *fakeProxy, useAuth bool) Config {
host, port := hostPort(fp.addr)
cfg := Config{
ProxyHost: host,
ProxyPort: port,
UseAuth: useAuth,
PerTestTimeout: 500 * time.Millisecond,
MaxRetries: 1,
RetryBackoff: 30 * time.Millisecond,
VoiceBurstCount: 10,
VoiceBurstInterval: 5 * time.Millisecond,
VoiceServerHostnames: []string{"localhost"},
ProxyHost: host,
ProxyPort: port,
UseAuth: useAuth,
PerTestTimeout: 500 * time.Millisecond,
MaxRetries: 1,
RetryBackoff: 30 * time.Millisecond,
VoiceBurstCount: 10,
VoiceBurstInterval: 5 * time.Millisecond,
}
if useAuth {
cfg.ProxyLogin = "u"
@@ -609,7 +579,7 @@ func TestRun_HappyNoAuth(t *testing.T) {
ch := Run(context.Background(), cfg)
results := drainResults(t, ch, 10*time.Second)
expected := []string{"tcp", "greet", "connect", "udp", "voice-quality", "voice-srv", "api"}
expected := []string{"tcp", "greet", "connect", "udp", "voice-quality", "api"}
finals := map[string]Result{}
for _, id := range expected {
r, ok := finalByID(results, id)
@@ -629,7 +599,6 @@ func TestRun_HappyNoAuth(t *testing.T) {
assert.Contains(t, finals["greet"].Metric, "no auth")
assert.Equal(t, "REP=00", finals["connect"].Metric)
assert.Contains(t, finals["voice-quality"].Metric, "loss=")
assert.Contains(t, finals["voice-srv"].Metric, "1/1 regions")
assert.Equal(t, "HTTP 200", finals["api"].Metric)
}
@@ -643,7 +612,7 @@ func TestRun_HappyWithAuth(t *testing.T) {
ch := Run(context.Background(), cfg)
results := drainResults(t, ch, 10*time.Second)
expected := []string{"tcp", "greet", "auth", "connect", "udp", "voice-quality", "voice-srv", "api"}
expected := []string{"tcp", "greet", "auth", "connect", "udp", "voice-quality", "api"}
for _, id := range expected {
r, ok := finalByID(results, id)
require.True(t, ok, "missing %s; results=%+v", id, results)
@@ -674,7 +643,7 @@ func TestRun_AuthRejected(t *testing.T) {
assert.Equal(t, StatusFailed, rA.Status)
assert.NotEmpty(t, rA.Hint)
for _, id := range []string{"connect", "udp", "voice-quality", "voice-srv", "api"} {
for _, id := range []string{"connect", "udp", "voice-quality", "api"} {
r, ok := finalByID(results, id)
require.True(t, ok, "missing %s", id)
assert.Equal(t, StatusSkipped, r.Status, "id=%s", id)
@@ -699,7 +668,7 @@ func TestRun_AllMethodsRejected(t *testing.T) {
assert.Equal(t, StatusFailed, rG.Status)
assert.NotEmpty(t, rG.Hint)
for _, id := range []string{"connect", "udp", "voice-quality", "voice-srv", "api"} {
for _, id := range []string{"connect", "udp", "voice-quality", "api"} {
r, ok := finalByID(results, id)
require.True(t, ok, "missing %s", id)
assert.Equal(t, StatusSkipped, r.Status, "id=%s", id)
@@ -735,10 +704,6 @@ func TestRun_ConnectRefused(t *testing.T) {
rVQ, _ := finalByID(results, "voice-quality")
assert.Equal(t, StatusPassed, rVQ.Status)
// voice-srv depends on connect → skipped.
rVS, _ := finalByID(results, "voice-srv")
assert.Equal(t, StatusSkipped, rVS.Status)
// api depends on connect → skipped.
rA, _ := finalByID(results, "api")
assert.Equal(t, StatusSkipped, rA.Status)
@@ -767,10 +732,6 @@ func TestRun_UDPUnsupported(t *testing.T) {
rVQ, _ := finalByID(results, "voice-quality")
assert.Equal(t, StatusSkipped, rVQ.Status)
// voice-srv depends on connect (passed) → runs and passes.
rVS, _ := finalByID(results, "voice-srv")
assert.Equal(t, StatusPassed, rVS.Status)
rA, _ := finalByID(results, "api")
assert.Equal(t, StatusPassed, rA.Status)
}
@@ -806,8 +767,8 @@ func TestRun_TimeoutThenOK(t *testing.T) {
assert.Equal(t, StatusPassed, greetEvents[3].Status)
assert.Equal(t, 2, greetEvents[3].Attempt)
// All seven non-auth tests should ultimately pass.
for _, id := range []string{"tcp", "greet", "connect", "udp", "voice-quality", "voice-srv", "api"} {
// All non-auth tests should ultimately pass.
for _, id := range []string{"tcp", "greet", "connect", "udp", "voice-quality", "api"} {
r, ok := finalByID(results, id)
require.True(t, ok, "missing %s", id)
assert.Equal(t, StatusPassed, r.Status, "id=%s, got %+v", id, r)
@@ -873,10 +834,10 @@ func TestRun_CancelledMidFlight(t *testing.T) {
// Either: one cancelled-failed + rest cancelled-skipped, OR all
// cancelled-skipped (if cancellation hit before next test even
// started). Both are acceptable.
// Without auth, 6 tests remain after tcp (greet/connect/udp/
// voice-quality/voice-srv/api). Cancel may race with greet
// completing successfully, so accept ≥4.
assert.GreaterOrEqual(t, failed+skipped, 4, "expected at least 4 cancellation-marked results, got failed=%d skipped=%d all=%+v", failed, skipped, results)
// Without auth, 5 tests remain after tcp (greet/connect/udp/
// voice-quality/api). Cancel may race with greet
// completing successfully, so accept ≥3.
assert.GreaterOrEqual(t, failed+skipped, 3, "expected at least 3 cancellation-marked results, got failed=%d skipped=%d all=%+v", failed, skipped, results)
}
func TestRun_AppliesDefaults(t *testing.T) {
@@ -979,27 +940,6 @@ func TestRun_VoiceQualityFail(t *testing.T) {
assert.NotEmpty(t, rVQ.Hint)
}
// TestRun_VoiceSrvAllResolvedNoneReachable: DNS resolves localhost but
// the proxy refuses CONNECT to :443. Expect StatusWarn with "0/1 regions
// reachable" metric.
func TestRun_VoiceSrvAllResolvedNoneReachable(t *testing.T) {
fp := newFakeProxy(t, "voice_srv_blocked")
cfg := proxyConfig(fp, false)
cfg.DiscordGateway = stubGatewayAddr(t)
cfg.DiscordAPI = stubAPIServer(t, fp, 200)
cfg.StunServer = "127.0.0.1:65000"
fp.blockVoiceCONNECT.Store(true)
ch := Run(context.Background(), cfg)
results := drainResults(t, ch, 15*time.Second)
rVS, ok := finalByID(results, "voice-srv")
require.True(t, ok)
assert.Equal(t, StatusWarn, rVS.Status, "got %+v", rVS)
assert.Equal(t, "0/1 regions reachable", rVS.Metric)
assert.NotEmpty(t, rVS.Hint)
}
func TestExtractRawHex(t *testing.T) {
cases := []struct {
in, want string