From 24b607231d58a975debc8ccb2de3c8699f557176 Mon Sep 17 00:00:00 2001 From: Kuzz007 Date: Tue, 4 Aug 2026 10:36:23 +0300 Subject: [PATCH] Fix TestOtherTunnelAllowedIPsExcludesSelfEmail's own test setup CI caught this: the "genuinely different client" (other@wg) was seeded onto the SAME inbound passed as excludeID, which otherTunnelAllowedIPs already excludes entirely regardless of the selfEmails fix -- so the assertion that its address is still reported could never have passed, proving nothing either way. Move it onto the sibling inbound alongside shared@id, which is what the test actually needs to exercise (two clients on one sibling, one excluded by email, one not). --- internal/web/service/client_inbound_apply_test.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/internal/web/service/client_inbound_apply_test.go b/internal/web/service/client_inbound_apply_test.go index cc85cd208..88d220008 100644 --- a/internal/web/service/client_inbound_apply_test.go +++ b/internal/web/service/client_inbound_apply_test.go @@ -57,8 +57,13 @@ func TestOtherTunnelAllowedIPs(t *testing.T) { // never a genuine different client. func TestOtherTunnelAllowedIPsExcludesSelfEmail(t *testing.T) { setupConflictDB(t) - seedInboundConflict(t, "awg-1", "0.0.0.0", 443, model.AmneziaWG, ``, `{"server":{"subnetIp":"10.8.1.0","subnetCidr":24},"clients":[{"email":"shared@id","allowedIPs":["10.8.1.21/32"]}]}`) - seedInboundConflict(t, "wg-1", "0.0.0.0", 51820, model.WireGuard, ``, `{"clients":[{"email":"other@wg","allowedIPs":["10.8.1.5/32"]}]}`) + // Both shared@id (to be excluded) and other@awg (a genuinely different + // client, must still be reported) live on the SAME sibling inbound -- + // otherTunnelAllowedIPs already excludes the asking inbound entirely via + // excludeID, so putting other@awg there instead would make it invisible + // to the scan regardless of the selfEmails fix, proving nothing. + seedInboundConflict(t, "awg-1", "0.0.0.0", 443, model.AmneziaWG, ``, `{"server":{"subnetIp":"10.8.1.0","subnetCidr":24},"clients":[{"email":"shared@id","allowedIPs":["10.8.1.21/32"]},{"email":"other@awg","allowedIPs":["10.8.1.5/32"]}]}`) + seedInboundConflict(t, "wg-1", "0.0.0.0", 51820, model.WireGuard, ``, `{"clients":[]}`) var wgInbound model.Inbound if err := database.GetDB().Where("tag = ?", "wg-1").First(&wgInbound).Error; err != nil {