(t *testing.T)
| 133 | } |
| 134 | |
| 135 | func TestQueue_Close(t *testing.T) { |
| 136 | q := New[*testMessage]("test", 10) |
| 137 | |
| 138 | var count atomic.Int32 |
| 139 | q.RegisterHandler(func(ctx context.Context, msg *testMessage) error { |
| 140 | count.Add(1) |
| 141 | return nil |
| 142 | }) |
| 143 | |
| 144 | // Send some messages |
| 145 | for i := range 5 { |
| 146 | q.Send(context.Background(), &testMessage{ID: i}) |
| 147 | } |
| 148 | |
| 149 | // Close and wait |
| 150 | q.Close() |
| 151 | |
| 152 | // All messages should have been processed |
| 153 | if count.Load() != 5 { |
| 154 | t.Errorf("expected 5 messages processed, got %d", count.Load()) |
| 155 | } |
| 156 | |
| 157 | // Sending after close should not panic |
| 158 | q.Send(context.Background(), &testMessage{ID: 99}) |
| 159 | } |
| 160 | |
| 161 | func TestQueue_ConcurrentSend(t *testing.T) { |
| 162 | q := New[*testMessage]("test", 100) |
nothing calls this directly
no test coverage detected