Add native Windows support (#91)
- Native Windows daemon using TCP loopback endpoints - Direct-mode fallback for CLI/daemon compatibility - Comment operations over RPC - PowerShell installer script - Go 1.24 requirement - Cross-OS testing documented Co-authored-by: danshapiro <danshapiro@users.noreply.github.com> Amp-Thread-ID: https://ampcode.com/threads/T-c6230265-055f-4af1-9712-4481061886db Co-authored-by: Amp <amp@ampcode.com>
This commit is contained in:
@@ -6,7 +6,7 @@ import (
|
||||
)
|
||||
|
||||
func TestLogRotation(t *testing.T) {
|
||||
|
||||
|
||||
// Set small max size for testing (1 MB)
|
||||
os.Setenv("BEADS_DAEMON_LOG_MAX_SIZE", "1")
|
||||
os.Setenv("BEADS_DAEMON_LOG_MAX_BACKUPS", "2")
|
||||
@@ -18,18 +18,18 @@ func TestLogRotation(t *testing.T) {
|
||||
os.Unsetenv("BEADS_DAEMON_LOG_MAX_AGE")
|
||||
os.Unsetenv("BEADS_DAEMON_LOG_COMPRESS")
|
||||
}()
|
||||
|
||||
|
||||
// Test env parsing
|
||||
maxSize := getEnvInt("BEADS_DAEMON_LOG_MAX_SIZE", 10)
|
||||
if maxSize != 1 {
|
||||
t.Errorf("Expected max size 1, got %d", maxSize)
|
||||
}
|
||||
|
||||
|
||||
maxBackups := getEnvInt("BEADS_DAEMON_LOG_MAX_BACKUPS", 3)
|
||||
if maxBackups != 2 {
|
||||
t.Errorf("Expected max backups 2, got %d", maxBackups)
|
||||
}
|
||||
|
||||
|
||||
compress := getEnvBool("BEADS_DAEMON_LOG_COMPRESS", true)
|
||||
if compress {
|
||||
t.Errorf("Expected compress false, got true")
|
||||
@@ -49,7 +49,7 @@ func TestGetEnvInt(t *testing.T) {
|
||||
{"zero", "0", 10, 0},
|
||||
{"negative", "-5", 10, -5},
|
||||
}
|
||||
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
if tt.envValue != "" {
|
||||
@@ -58,7 +58,7 @@ func TestGetEnvInt(t *testing.T) {
|
||||
} else {
|
||||
os.Unsetenv("TEST_INT")
|
||||
}
|
||||
|
||||
|
||||
result := getEnvInt("TEST_INT", tt.defaultValue)
|
||||
if result != tt.expected {
|
||||
t.Errorf("Expected %d, got %d", tt.expected, result)
|
||||
@@ -82,7 +82,7 @@ func TestGetEnvBool(t *testing.T) {
|
||||
{"0 string", "0", true, false},
|
||||
{"invalid string", "invalid", true, false},
|
||||
}
|
||||
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
if tt.envValue != "" {
|
||||
@@ -91,7 +91,7 @@ func TestGetEnvBool(t *testing.T) {
|
||||
} else {
|
||||
os.Unsetenv("TEST_BOOL")
|
||||
}
|
||||
|
||||
|
||||
result := getEnvBool("TEST_BOOL", tt.defaultValue)
|
||||
if result != tt.expected {
|
||||
t.Errorf("Expected %v, got %v", tt.expected, result)
|
||||
@@ -106,22 +106,22 @@ func TestLogFileRotationDefaults(t *testing.T) {
|
||||
os.Unsetenv("BEADS_DAEMON_LOG_MAX_BACKUPS")
|
||||
os.Unsetenv("BEADS_DAEMON_LOG_MAX_AGE")
|
||||
os.Unsetenv("BEADS_DAEMON_LOG_COMPRESS")
|
||||
|
||||
|
||||
maxSize := getEnvInt("BEADS_DAEMON_LOG_MAX_SIZE", 10)
|
||||
if maxSize != 10 {
|
||||
t.Errorf("Expected default max size 10, got %d", maxSize)
|
||||
}
|
||||
|
||||
|
||||
maxBackups := getEnvInt("BEADS_DAEMON_LOG_MAX_BACKUPS", 3)
|
||||
if maxBackups != 3 {
|
||||
t.Errorf("Expected default max backups 3, got %d", maxBackups)
|
||||
}
|
||||
|
||||
|
||||
maxAge := getEnvInt("BEADS_DAEMON_LOG_MAX_AGE", 7)
|
||||
if maxAge != 7 {
|
||||
t.Errorf("Expected default max age 7, got %d", maxAge)
|
||||
}
|
||||
|
||||
|
||||
compress := getEnvBool("BEADS_DAEMON_LOG_COMPRESS", true)
|
||||
if !compress {
|
||||
t.Errorf("Expected default compress true, got false")
|
||||
|
||||
Reference in New Issue
Block a user