Files
AetherForge/server/internal/sys/firewall_test.go

33 lines
709 B
Go

package sys
import (
"runtime"
"strings"
"testing"
)
func TestEnsureInboundTCPPortInvalidPort(t *testing.T) {
err := EnsureInboundTCPPort(0, "test")
if err == nil {
t.Fatal("expected error for port 0")
}
if runtime.GOOS == "windows" {
if !strings.Contains(err.Error(), "invalid port") {
t.Fatalf("unexpected error: %v", err)
}
}
}
func TestEnsureInboundTCPPortNonWindows(t *testing.T) {
if runtime.GOOS == "windows" {
t.Skip("stub-only test for non-Windows builds")
}
err := EnsureInboundTCPPort(8080, "test")
if err == nil {
t.Fatal("expected error on non-Windows")
}
if !strings.Contains(err.Error(), "only supported on Windows") {
t.Fatalf("unexpected error: %v", err)
}
}