v0.3.0: fix HTTP client leak, add tests and CI pipeline
Reuse a single long-poll HTTP client instead of creating one per Events() call (~every 30s). Make TLS skip-verify configurable via syncthing_insecure_tls. Log previously swallowed config errors. Add unit tests for all monitor trackers, config, and state logic. Add CI workflow (vet, golangci-lint, govulncheck, go test -race). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
28
internal/monitor/conflicts_test.go
Normal file
28
internal/monitor/conflicts_test.go
Normal file
@@ -0,0 +1,28 @@
|
||||
package monitor
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestConflictTracker_IncrementAndCount(t *testing.T) {
|
||||
ct := NewConflictTracker()
|
||||
if ct.Count() != 0 {
|
||||
t.Fatalf("initial count should be 0, got %d", ct.Count())
|
||||
}
|
||||
|
||||
ct.Increment()
|
||||
ct.Increment()
|
||||
ct.Increment()
|
||||
|
||||
if ct.Count() != 3 {
|
||||
t.Errorf("expected 3, got %d", ct.Count())
|
||||
}
|
||||
}
|
||||
|
||||
func TestConflictTracker_SetCount(t *testing.T) {
|
||||
ct := NewConflictTracker()
|
||||
ct.Increment()
|
||||
ct.SetCount(42)
|
||||
|
||||
if ct.Count() != 42 {
|
||||
t.Errorf("expected 42 after SetCount, got %d", ct.Count())
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user