mirror of
https://github.com/amir20/dozzle.git
synced 2025-12-24 14:31:44 +01:00
@@ -2,6 +2,7 @@ package web
|
||||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
@@ -22,7 +23,7 @@ func Test_handler_streamEvents_happy(t *testing.T) {
|
||||
mockedClient := new(MockedClient)
|
||||
errChannel := make(chan error)
|
||||
|
||||
mockedClient.On("ListContainers").Return([]docker.Container{}, nil).Twice()
|
||||
mockedClient.On("ListContainers").Return([]docker.Container{}, nil)
|
||||
mockedClient.On("Events", mock.Anything, mock.AnythingOfType("chan<- docker.ContainerEvent")).Return(errChannel).Run(func(args mock.Arguments) {
|
||||
messages := args.Get(1).(chan<- docker.ContainerEvent)
|
||||
go func() {
|
||||
@@ -36,6 +37,7 @@ func Test_handler_streamEvents_happy(t *testing.T) {
|
||||
ActorID: "1234",
|
||||
Host: "localhost",
|
||||
}
|
||||
time.Sleep(100 * time.Millisecond)
|
||||
cancel()
|
||||
}()
|
||||
})
|
||||
@@ -44,7 +46,7 @@ func Test_handler_streamEvents_happy(t *testing.T) {
|
||||
Name: "test",
|
||||
Image: "test",
|
||||
Stats: utils.NewRingBuffer[docker.ContainerStat](300), // 300 seconds of stats
|
||||
}, nil).Once()
|
||||
}, nil)
|
||||
|
||||
clients := map[string]docker.Client{
|
||||
"localhost": mockedClient,
|
||||
|
||||
Reference in New Issue
Block a user