package service import ( "context" "strings" "testing" ) func TestCustomDomainRejectsEveryPlatformReservedZone(t *testing.T) { projects := &Projects{reservedDomains: []string{"hosts.example.com", "console.example.com", "ftp.example.com"}} tests := []string{ "hosts.example.com", "tenant.hosts.example.com", "console.example.com", "login.console.example.com", "ftp.example.com", "files.ftp.example.com", } for _, domain := range tests { _, _, err := projects.customDomain(context.Background(), domain) if err == nil || !strings.Contains(err.Error(), "平台保留域名") { t.Errorf("reserved domain %q was accepted: %v", domain, err) } } }