( ctx context.Context, t *testing.T, catalog *catalog, op string, scope string, workspaceID string, agentName string, summary string, timestamp time.Time, )
| 215 | } |
| 216 | |
| 217 | func insertMemoryObservabilityEvent( |
| 218 | ctx context.Context, |
| 219 | t *testing.T, |
| 220 | catalog *catalog, |
| 221 | op string, |
| 222 | scope string, |
| 223 | workspaceID string, |
| 224 | agentName string, |
| 225 | summary string, |
| 226 | timestamp time.Time, |
| 227 | ) { |
| 228 | t.Helper() |
| 229 | |
| 230 | db, err := catalog.ensureDB(ctx) |
| 231 | if err != nil { |
| 232 | t.Fatalf("catalog.ensureDB() error = %v", err) |
| 233 | } |
| 234 | metadata, err := json.Marshal(map[string]string{memoryEventMetadataSummaryKey: summary}) |
| 235 | if err != nil { |
| 236 | t.Fatalf("json.Marshal(metadata) error = %v", err) |
| 237 | } |
| 238 | if _, err := db.ExecContext( |
| 239 | ctx, |
| 240 | `INSERT INTO memory_events ( |
| 241 | op, scope, agent_name, workspace_id, actor_kind, metadata, ts_ms |
| 242 | ) VALUES (?, ?, ?, ?, ?, ?, ?)`, |
| 243 | op, |
| 244 | nullStringForEmpty(scope), |
| 245 | agentName, |
| 246 | nullStringForEmpty(workspaceID), |
| 247 | "system", |
| 248 | string(metadata), |
| 249 | timeToUnixMillis(timestamp), |
| 250 | ); err != nil { |
| 251 | t.Fatalf("insert memory event error = %v", err) |
| 252 | } |
| 253 | } |
no test coverage detected