feat(work): persist agent execution state
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
package agent_execution_test
|
||||
|
||||
import (
|
||||
"os"
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestDurableAgentExecutionMigrationDefinesOwnedState(t *testing.T) {
|
||||
data, err := os.ReadFile("../../database/migrations/029_work_agent_execution_persistence.sql")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
sql := string(data)
|
||||
for _, table := range []string{
|
||||
"work.agent_dispatch_intents",
|
||||
"work.agent_leases",
|
||||
"work.agent_callback_heads",
|
||||
} {
|
||||
if !strings.Contains(sql, "CREATE TABLE IF NOT EXISTS "+table) {
|
||||
t.Fatalf("migration does not define %s", table)
|
||||
}
|
||||
}
|
||||
for _, marker := range []string{
|
||||
"UNIQUE",
|
||||
"CHECK (state IN ('ACTIVE','EXPIRED'))",
|
||||
"CHECK (fencing_token > 0)",
|
||||
} {
|
||||
if !strings.Contains(sql, marker) {
|
||||
t.Fatalf("migration/repository contract marker missing: %s", marker)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user