package metrics import ( "testing" "github.com/stretchr/testify/assert" ) func TestRecordWorkflowStarted(t *testing.T) { // Should not panic assert.NotPanics(t, func() { RecordWorkflowStarted("TestWorkflow") }) } func TestRecordWorkflowCompleted(t *testing.T) { // Should not panic assert.NotPanics(t, func() { RecordWorkflowCompleted("TestWorkflow", "success", 1.5) }) } func TestRecordActivityStarted(t *testing.T) { // Should not panic assert.NotPanics(t, func() { RecordActivityStarted("TestActivity") }) } func TestRecordActivityCompleted(t *testing.T) { // Should not panic assert.NotPanics(t, func() { RecordActivityCompleted("TestActivity", "success", 0.5) }) } func TestRecordActivityRetry(t *testing.T) { // Should not panic assert.NotPanics(t, func() { RecordActivityRetry("TestActivity") }) } func TestRecordLLMAPICall(t *testing.T) { // Should not panic assert.NotPanics(t, func() { RecordLLMAPICall("claude-opus", "success", 2.0) }) } func TestRecordGitOperation(t *testing.T) { // Should not panic assert.NotPanics(t, func() { RecordGitOperation("clone", "success", 5.0) }) } func TestRecordJudgeDecision(t *testing.T) { // Should not panic assert.NotPanics(t, func() { RecordJudgeDecision("approve") }) } func TestRecordTemporalConnectionError(t *testing.T) { // Should not panic assert.NotPanics(t, func() { RecordTemporalConnectionError("connection_timeout") }) } func TestRecordCacheHit(t *testing.T) { // Should not panic assert.NotPanics(t, func() { RecordCacheHit("llm_response") }) } func TestRecordCacheMiss(t *testing.T) { // Should not panic assert.NotPanics(t, func() { RecordCacheMiss("llm_response") }) } func TestUpdateTasksInProgress(t *testing.T) { // Should not panic assert.NotPanics(t, func() { UpdateTasksInProgress("T0", 5.0) }) } // TestMetricsExist verifies all metrics are registered func TestMetricsExist(t *testing.T) { assert.NotNil(t, WorkflowExecutionsStarted) assert.NotNil(t, WorkflowExecutionsCompleted) assert.NotNil(t, WorkflowDuration) assert.NotNil(t, ActivityExecutionsStarted) assert.NotNil(t, ActivityExecutionsCompleted) assert.NotNil(t, ActivityDuration) assert.NotNil(t, ActivityRetries) assert.NotNil(t, LLMAPICallsTotal) assert.NotNil(t, LLMAPILatency) assert.NotNil(t, GitOperationsTotal) assert.NotNil(t, GitOperationsDuration) assert.NotNil(t, TasksInProgress) assert.NotNil(t, JudgeDecisionsTotal) assert.NotNil(t, TemporalConnectionErrors) assert.NotNil(t, CacheHits) assert.NotNil(t, CacheMisses) }