| 1 | package bot |
| 2 | |
| 3 | import ( |
| 4 | "testing" |
| 5 | |
| 6 | "reasonix/internal/agent" |
| 7 | "reasonix/internal/control" |
| 8 | ) |
| 9 | |
| 10 | func mustBindBotControllerAuthority(t *testing.T, leases *control.SessionLeaseKeeper, ctrl *control.Controller) { |
| 11 | t.Helper() |
| 12 | if err := leases.BindControllerAuthority(ctrl); err != nil { |
| 13 | t.Fatalf("bind controller authority: %v", err) |
| 14 | } |
| 15 | } |
| 16 | |
| 17 | func mustAcquireAndReleaseBotSessionLease(t *testing.T, path string) { |
| 18 | t.Helper() |
| 19 | lease, err := agent.TryAcquireSessionLease(path) |
| 20 | if err != nil { |
| 21 | t.Fatalf("session lease was not released: %v", err) |
| 22 | } |
| 23 | lease.Release() |
| 24 | } |
| 25 |