test: remove unused Redis protocol tests and helpers

- Removed obsolete Redis protocol test cases and helper functions that were no longer relevant due to recent architecture changes.
- Streamlined remaining test files to align with updated Redis handling and connection management logic.
This commit is contained in:
Luis Pater
2026-05-19 23:12:57 +08:00
parent b9589e8ed6
commit 99fa530967
14 changed files with 72 additions and 1429 deletions
+4 -4
View File
@@ -37,8 +37,8 @@ type Config struct {
// TLS config controls HTTPS server settings.
TLS TLSConfig `yaml:"tls" json:"tls"`
// Home config enables the Redis-based control plane integration.
Home HomeConfig `yaml:"home" json:"-"`
// Home config is runtime-only and is populated from -home-jwt.
Home HomeConfig `yaml:"-" json:"-"`
// RemoteManagement nests management-related options under 'remote-management'.
RemoteManagement RemoteManagement `yaml:"remote-management" json:"-"`
@@ -69,8 +69,8 @@ type Config struct {
// UsageStatisticsEnabled toggles in-memory usage aggregation; when false, usage data is discarded.
UsageStatisticsEnabled bool `yaml:"usage-statistics-enabled" json:"usage-statistics-enabled"`
// RedisUsageQueueRetentionSeconds controls how long (in seconds) usage queue items
// are retained in memory for the Redis RESP interface (LPOP/RPOP).
// RedisUsageQueueRetentionSeconds controls how long usage queue items are retained
// in memory for Management API consumers.
// Default: 60. Max: 3600.
RedisUsageQueueRetentionSeconds int `yaml:"redis-usage-queue-retention-seconds" json:"redis-usage-queue-retention-seconds"`
+1 -2
View File
@@ -1,11 +1,10 @@
package config
// HomeConfig configures the optional "home" control plane integration over Redis protocol.
// HomeConfig stores runtime-only Home control plane settings from -home-jwt.
type HomeConfig struct {
Enabled bool `yaml:"enabled" json:"enabled"`
Host string `yaml:"host" json:"-"`
Port int `yaml:"port" json:"-"`
Password string `yaml:"password" json:"-"`
DisableClusterDiscovery bool `yaml:"disable-cluster-discovery" json:"-"`
TLS HomeTLSConfig `yaml:"tls" json:"-"`
}
+17 -21
View File
@@ -2,13 +2,12 @@ package config
import "testing"
func TestParseConfigBytesHomeTLS(t *testing.T) {
func TestParseConfigBytesIgnoresHomeConfig(t *testing.T) {
cfg, err := ParseConfigBytes([]byte(`
home:
enabled: true
host: home.example.com
port: 444
password: secret
disable-cluster-discovery: true
tls:
enable: true
@@ -20,31 +19,28 @@ home:
t.Fatalf("ParseConfigBytes() error = %v", err)
}
if !cfg.Home.Enabled {
t.Fatal("Home.Enabled = false, want true")
if cfg.Home.Enabled {
t.Fatal("Home.Enabled = true, want false")
}
if cfg.Home.Host != "home.example.com" {
t.Fatalf("Home.Host = %q, want home.example.com", cfg.Home.Host)
if cfg.Home.Host != "" {
t.Fatalf("Home.Host = %q, want empty", cfg.Home.Host)
}
if cfg.Home.Port != 444 {
t.Fatalf("Home.Port = %d, want 444", cfg.Home.Port)
if cfg.Home.Port != 0 {
t.Fatalf("Home.Port = %d, want 0", cfg.Home.Port)
}
if cfg.Home.Password != "secret" {
t.Fatalf("Home.Password = %q, want secret", cfg.Home.Password)
if cfg.Home.DisableClusterDiscovery {
t.Fatal("Home.DisableClusterDiscovery = true, want false")
}
if !cfg.Home.DisableClusterDiscovery {
t.Fatal("Home.DisableClusterDiscovery = false, want true")
if cfg.Home.TLS.Enable {
t.Fatal("Home.TLS.Enable = true, want false")
}
if !cfg.Home.TLS.Enable {
t.Fatal("Home.TLS.Enable = false, want true")
if cfg.Home.TLS.ServerName != "" {
t.Fatalf("Home.TLS.ServerName = %q, want empty", cfg.Home.TLS.ServerName)
}
if cfg.Home.TLS.ServerName != "home.example.com" {
t.Fatalf("Home.TLS.ServerName = %q, want home.example.com", cfg.Home.TLS.ServerName)
if cfg.Home.TLS.CACert != "" {
t.Fatalf("Home.TLS.CACert = %q, want empty", cfg.Home.TLS.CACert)
}
if cfg.Home.TLS.CACert != "C:/certs/ca.pem" {
t.Fatalf("Home.TLS.CACert = %q, want C:/certs/ca.pem", cfg.Home.TLS.CACert)
}
if !cfg.Home.TLS.InsecureSkipVerify {
t.Fatal("Home.TLS.InsecureSkipVerify = false, want true")
if cfg.Home.TLS.InsecureSkipVerify {
t.Fatal("Home.TLS.InsecureSkipVerify = true, want false")
}
}