feat: sample workflow phase latency
This commit is contained in:
@@ -90,6 +90,12 @@ func TestIntegrationOperationalSnapshot(t *testing.T) {
|
||||
}
|
||||
}
|
||||
f.exec("UPDATE pulse_tasks SET state='SUCCEEDED', completed_at=UTC_TIMESTAMP(6), updated_at=UTC_TIMESTAMP(6), revision=revision+1 WHERE namespace_id=? AND id=?", f.resources.NamespaceID, task.ID)
|
||||
for _, event := range []struct {
|
||||
revision uint64
|
||||
typeName string
|
||||
}{{2, "task.started"}, {3, "task.succeeded"}} {
|
||||
f.exec("INSERT INTO orbit_events(namespace_id,id,aggregate_kind,aggregate_id,aggregate_revision,type,payload,occurred_at) VALUES (?,?,'task',?,?,?,'{}',UTC_TIMESTAMP(6))", f.resources.NamespaceID, executionID(t), task.ID, event.revision, event.typeName)
|
||||
}
|
||||
completed, err := ReadOperationalSnapshot(ctx, db)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
@@ -97,6 +103,9 @@ func TestIntegrationOperationalSnapshot(t *testing.T) {
|
||||
if completed.TaskTerminalLatencySeconds < 0 || completed.TaskTerminalLatencyMaxSeconds < 0 {
|
||||
t.Fatalf("negative terminal latency: %#v", completed)
|
||||
}
|
||||
if completed.TaskAcceptToStartLatencySeconds < 0 || completed.TaskAcceptToTerminalLatencySeconds < 0 {
|
||||
t.Fatalf("negative task phase latency: %#v", completed)
|
||||
}
|
||||
|
||||
cancelled, cancelNow := context.WithCancel(ctx)
|
||||
cancelNow()
|
||||
|
||||
Reference in New Issue
Block a user