mirror of
https://github.com/amir20/dozzle.git
synced 2026-06-23 04:10:12 +00:00
fix: resolve race condition in TestContainerStore_die (#4591)
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -81,10 +81,12 @@ func TestContainerStore_die(t *testing.T) {
|
||||
},
|
||||
}, nil)
|
||||
|
||||
ready := make(chan struct{})
|
||||
client.On("ContainerEvents", mock.Anything, mock.AnythingOfType("chan<- container.ContainerEvent")).Return(nil).
|
||||
Run(func(args mock.Arguments) {
|
||||
ctx := args.Get(0).(context.Context)
|
||||
events := args.Get(1).(chan<- ContainerEvent)
|
||||
<-ready
|
||||
events <- ContainerEvent{
|
||||
Name: "die",
|
||||
ActorID: "1234",
|
||||
@@ -110,6 +112,7 @@ func TestContainerStore_die(t *testing.T) {
|
||||
// Wait until we get the event
|
||||
events := make(chan ContainerEvent)
|
||||
store.SubscribeEvents(t.Context(), events)
|
||||
close(ready)
|
||||
<-events
|
||||
|
||||
containers, _ := store.ListContainers(ContainerLabels{})
|
||||
|
||||
Reference in New Issue
Block a user