| 195 | } |
| 196 | |
| 197 | func TestPathStore_Notify_AncestorNotification(t *testing.T) { |
| 198 | t.Parallel() |
| 199 | |
| 200 | ps := agentgit.NewPathStore() |
| 201 | chatID := uuid.New() |
| 202 | ancestorID := uuid.New() |
| 203 | |
| 204 | // Subscribe to the ancestor, then notify via the child. |
| 205 | ch, unsub := ps.Subscribe(ancestorID) |
| 206 | defer unsub() |
| 207 | |
| 208 | ps.Notify([]uuid.UUID{chatID, ancestorID}) |
| 209 | |
| 210 | ctx := testutil.Context(t, testutil.WaitShort) |
| 211 | select { |
| 212 | case <-ch: |
| 213 | // Success. |
| 214 | case <-ctx.Done(): |
| 215 | t.Fatal("ancestor subscriber did not receive notification") |
| 216 | } |
| 217 | |
| 218 | require.Nil(t, ps.GetPaths(ancestorID)) |
| 219 | } |
| 220 | |
| 221 | func TestPathStore_ConcurrentSafety(t *testing.T) { |
| 222 | t.Parallel() |