fix(test): update log assertions for debug logging and field expansion

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
dailz
2026-04-10 11:13:13 +08:00
parent 824d9e816f
commit 34ba617cbf
3 changed files with 66 additions and 66 deletions

View File

@@ -506,13 +506,13 @@ func TestJobService_SubmitJob_SuccessLog(t *testing.T) {
}
entries := recorded.All()
if len(entries) != 1 {
t.Fatalf("expected 1 log entry, got %d", len(entries))
if len(entries) != 3 {
t.Fatalf("expected 3 log entries, got %d", len(entries))
}
if entries[0].Level != zapcore.InfoLevel {
t.Errorf("expected InfoLevel, got %v", entries[0].Level)
if entries[2].Level != zapcore.InfoLevel {
t.Errorf("expected InfoLevel, got %v", entries[2].Level)
}
fields := entries[0].ContextMap()
fields := entries[2].ContextMap()
if fields["job_name"] != "log-test-job" {
t.Errorf("expected job_name=log-test-job, got %v", fields["job_name"])
}
@@ -539,13 +539,13 @@ func TestJobService_SubmitJob_ErrorLog(t *testing.T) {
}
entries := recorded.All()
if len(entries) != 1 {
t.Fatalf("expected 1 log entry, got %d", len(entries))
if len(entries) != 3 {
t.Fatalf("expected 3 log entries, got %d", len(entries))
}
if entries[0].Level != zapcore.ErrorLevel {
t.Errorf("expected ErrorLevel, got %v", entries[0].Level)
if entries[2].Level != zapcore.ErrorLevel {
t.Errorf("expected ErrorLevel, got %v", entries[2].Level)
}
fields := entries[0].ContextMap()
fields := entries[2].ContextMap()
if fields["operation"] != "submit" {
t.Errorf("expected operation=submit, got %v", fields["operation"])
}
@@ -568,13 +568,13 @@ func TestJobService_CancelJob_SuccessLog(t *testing.T) {
}
entries := recorded.All()
if len(entries) != 1 {
t.Fatalf("expected 1 log entry, got %d", len(entries))
if len(entries) != 3 {
t.Fatalf("expected 3 log entries, got %d", len(entries))
}
if entries[0].Level != zapcore.InfoLevel {
t.Errorf("expected InfoLevel, got %v", entries[0].Level)
if entries[2].Level != zapcore.InfoLevel {
t.Errorf("expected InfoLevel, got %v", entries[2].Level)
}
fields := entries[0].ContextMap()
fields := entries[2].ContextMap()
if fields["job_id"] != "555" {
t.Errorf("expected job_id=555, got %v", fields["job_id"])
}
@@ -594,13 +594,13 @@ func TestJobService_CancelJob_ErrorLog(t *testing.T) {
}
entries := recorded.All()
if len(entries) != 1 {
t.Fatalf("expected 1 log entry, got %d", len(entries))
if len(entries) != 3 {
t.Fatalf("expected 3 log entries, got %d", len(entries))
}
if entries[0].Level != zapcore.ErrorLevel {
t.Errorf("expected ErrorLevel, got %v", entries[0].Level)
if entries[2].Level != zapcore.ErrorLevel {
t.Errorf("expected ErrorLevel, got %v", entries[2].Level)
}
fields := entries[0].ContextMap()
fields := entries[2].ContextMap()
if fields["operation"] != "cancel" {
t.Errorf("expected operation=cancel, got %v", fields["operation"])
}
@@ -626,13 +626,13 @@ func TestJobService_GetJobs_ErrorLog(t *testing.T) {
}
entries := recorded.All()
if len(entries) != 1 {
t.Fatalf("expected 1 log entry, got %d", len(entries))
if len(entries) != 3 {
t.Fatalf("expected 3 log entries, got %d", len(entries))
}
if entries[0].Level != zapcore.ErrorLevel {
t.Errorf("expected ErrorLevel, got %v", entries[0].Level)
if entries[2].Level != zapcore.ErrorLevel {
t.Errorf("expected ErrorLevel, got %v", entries[2].Level)
}
fields := entries[0].ContextMap()
fields := entries[2].ContextMap()
if fields["operation"] != "get_jobs" {
t.Errorf("expected operation=get_jobs, got %v", fields["operation"])
}
@@ -655,13 +655,13 @@ func TestJobService_GetJob_ErrorLog(t *testing.T) {
}
entries := recorded.All()
if len(entries) != 1 {
t.Fatalf("expected 1 log entry, got %d", len(entries))
if len(entries) != 3 {
t.Fatalf("expected 3 log entries, got %d", len(entries))
}
if entries[0].Level != zapcore.ErrorLevel {
t.Errorf("expected ErrorLevel, got %v", entries[0].Level)
if entries[2].Level != zapcore.ErrorLevel {
t.Errorf("expected ErrorLevel, got %v", entries[2].Level)
}
fields := entries[0].ContextMap()
fields := entries[2].ContextMap()
if fields["operation"] != "get_job" {
t.Errorf("expected operation=get_job, got %v", fields["operation"])
}
@@ -687,13 +687,13 @@ func TestJobService_GetJobHistory_ErrorLog(t *testing.T) {
}
entries := recorded.All()
if len(entries) != 1 {
t.Fatalf("expected 1 log entry, got %d", len(entries))
if len(entries) != 3 {
t.Fatalf("expected 3 log entries, got %d", len(entries))
}
if entries[0].Level != zapcore.ErrorLevel {
t.Errorf("expected ErrorLevel, got %v", entries[0].Level)
if entries[2].Level != zapcore.ErrorLevel {
t.Errorf("expected ErrorLevel, got %v", entries[2].Level)
}
fields := entries[0].ContextMap()
fields := entries[2].ContextMap()
if fields["operation"] != "get_job_history" {
t.Errorf("expected operation=get_job_history, got %v", fields["operation"])
}