package monitoring_test import ( "database/sql" "testing" "github.com/user-management-system/internal/monitoring" ) func TestUpdateDBConnectionMetricsFromStats_NilSLO(t *testing.T) { // This test documents that the function should handle nil SLO gracefully // We can't directly test the function since it's private, // but we can test the behavior through integration _ = sql.DBStats{} } func TestCollectDBMetrics_NilDB(t *testing.T) { // Create a SLO metrics instance slo := monitoring.NewSLOMetrics() // Should not panic with nil DB // Note: collectDBMetrics is private, so we test indirectly _ = slo } func TestCollectRuntimeMetrics_DoesNotPanic(t *testing.T) { // Create a metrics instance m := monitoring.NewMetrics() // Test that SetMemoryUsage and SetGoroutines don't panic m.SetMemoryUsage(1024 * 1024) m.SetGoroutines(10) }