diff options
Diffstat (limited to 'internal/handler/websocket/handler_test.go')
| -rw-r--r-- | internal/handler/websocket/handler_test.go | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/internal/handler/websocket/handler_test.go b/internal/handler/websocket/handler_test.go index 9f02510..9982aea 100644 --- a/internal/handler/websocket/handler_test.go +++ b/internal/handler/websocket/handler_test.go | |||
| @@ -368,6 +368,13 @@ func TestAuthNotInAllowlist(t *testing.T) { | |||
| 368 | t.Errorf("Expected OK false for unauthorized pubkey, got false: %v", msg3[3]) | 368 | t.Errorf("Expected OK false for unauthorized pubkey, got false: %v", msg3[3]) |
| 369 | } | 369 | } |
| 370 | t.Logf("Unauthorized pubkey correctly rejected: %v", msg3[3]) | 370 | t.Logf("Unauthorized pubkey correctly rejected: %v", msg3[3]) |
| 371 | |||
| 372 | // Verify metrics tracked the unauthorized request | ||
| 373 | unauthorizedCount := ts.metrics.getRequestCount("EVENT", "unauthorized") | ||
| 374 | if unauthorizedCount == 0 { | ||
| 375 | t.Errorf("Expected unauthorized requests to be tracked in metrics, got 0") | ||
| 376 | } | ||
| 377 | t.Logf("Metrics: %d unauthorized requests tracked", unauthorizedCount) | ||
| 371 | } | 378 | } |
| 372 | 379 | ||
| 373 | // TestRateLimitByIP verifies that rate limiting works by IP | 380 | // TestRateLimitByIP verifies that rate limiting works by IP |
