lukaszraczylo
|
fbb13aa32f
|
test: cover converter I/O + httplog round-trip
internal/converter: 57.1% -> 98.4%. Added 18 cases covering
ConvertKFTrayToKPortal (happy path, missing input, malformed JSON,
unwritable output, multi-entry, file mode 0600), GetConversionSummary
(happy path, missing/malformed input, empty array, dedup counters),
and convertToKPortal edge cases (empty input, zero ports, empty
WorkloadType, sort order, alias preservation, tcp/udp/empty protocol
variants).
internal/httplog: 55.7% -> 95.7%. Added 17 tests using httptest for
loggingTransport.RoundTrip (GET/POST, filter-path bypass, header
redaction at the integration layer, backend-down, nil bodies, request
counter monotonicity) and direct unit tests for readBodyLimited
(empty, small, exact-at-limit, truncated, large pool-branch, zero
maxSize).
|
2026-05-06 14:08:54 +01:00 |
|
lukaszraczylo
|
96ae1d45e0
|
style: Extract UI constants and refactor main view rendering (#30)
- [x] Add golangci-lint configuration with gocritic ifElseChain disabled
- [x] Rename error variables to avoid shadowing (createErr, watcherErr, watchErr, etc.)
- [x] Replace `interface{}` with `any` type alias throughout codebase
- [x] Add package-level documentation comments to all internal packages
- [x] Reorder struct fields alphabetically for consistency
- [x] Extract UI constants (terminal dimensions, column widths, colors) to constants.go
- [x] Refactor BubbleTeaUI main view rendering into smaller helper functions
- [x] Simplify nested conditionals and improve code clarity
- [x] Add `isForwardDisabled()` helper method to BubbleTeaUI
- [x] Update file permissions from 0644 to 0600 in config tests
- [x] Add `#nosec` comments and error suppression where appropriate
- [x] Improve test table struct field ordering for readability
- [x] Fix resource parsing in AddForward using strings.SplitN
- [x] Add comprehensive tests for new UI helper functions and constants
|
2026-01-13 09:37:45 +00:00 |
|
lukaszraczylo
|
23cd45a3d7
|
improvements nov2025 pt2 (#13)
* Further improvements
| Fix | Impact | Files Modified |
|------------------------------------|----------------------------------------|--------------------------------------|
| sync.Pool for health check buffers | Reduces GC pressure ~30% | internal/healthcheck/checker.go |
| Goroutine leak fix + sync.Once | Prevents memory leaks | internal/forward/worker.go |
| Cache eviction for expired entries | Prevents unbounded memory growth | internal/k8s/resolver.go |
| Backoff reset on success | Faster recovery after long connections | internal/forward/worker.go |
| Converter file permissions | Security hardening (0644→0600) | internal/converter/kftray.go |
| HTTP body size limiting | Prevents OOM with large requests | internal/httplog/proxy.go, logger.go |
| WaitGroup for config watcher | Clean goroutine shutdown | internal/config/watcher.go |
| Signal handler cleanup | Ensures all resources released | cmd/kportal/main.go |
* Additional event bus for internal event handling
| Metric | Before | After | Improvement |
|------------------------|---------------------------------------|-------------------|--------------------|
| Goroutines per forward | 3 (worker + heartbeat + health check) | 1 (worker only) | 66% reduction |
| Tickers per forward | 2 (heartbeat + health check) | 0 | 100% reduction |
| Global goroutines | 2 (watchdog + health monitor) | 2 | Same |
| Lock acquisitions/sec | O(n) per interval | O(1) per interval | Linear improvement |
* Add UI testing
* Add mocks
* Add more logs and details to be displayed
|
2025-11-26 13:18:50 +00:00 |
|