1
0
mirror of https://github.com/amir20/dozzle.git synced 2025-12-25 06:49:23 +01:00

perf: fixes an issue with too many containers (#3144)

This commit is contained in:
Amir Raminfar
2024-07-24 06:58:21 -07:00
committed by GitHub
parent 4aa315a471
commit 082bed2382
16 changed files with 136 additions and 173 deletions

View File

@@ -50,7 +50,7 @@ func Test_handler_streamLogs_happy(t *testing.T) {
ID: "localhost",
})
mockedClient.On("ListContainers").Return([]docker.Container{
{ID: id, Name: "test", Host: "localhost"},
{ID: id, Name: "test", Host: "localhost", State: "running"},
}, nil)
mockedClient.On("ContainerEvents", mock.Anything, mock.AnythingOfType("chan<- docker.ContainerEvent")).Return(nil).Run(func(args mock.Arguments) {
time.Sleep(50 * time.Millisecond)
@@ -93,7 +93,7 @@ func Test_handler_streamLogs_happy_with_id(t *testing.T) {
})
mockedClient.On("ListContainers").Return([]docker.Container{
{ID: id, Name: "test", Host: "localhost"},
{ID: id, Name: "test", Host: "localhost", State: "running"},
}, nil)
mockedClient.On("ContainerEvents", mock.Anything, mock.AnythingOfType("chan<- docker.ContainerEvent")).Return(nil).Run(func(args mock.Arguments) {
@@ -132,7 +132,7 @@ func Test_handler_streamLogs_happy_container_stopped(t *testing.T) {
ID: "localhost",
})
mockedClient.On("ListContainers").Return([]docker.Container{
{ID: id, Name: "test", Host: "localhost"},
{ID: id, Name: "test", Host: "localhost", State: "running"},
}, nil)
mockedClient.On("ContainerEvents", mock.Anything, mock.AnythingOfType("chan<- docker.ContainerEvent")).Return(nil)
@@ -201,7 +201,7 @@ func Test_handler_streamLogs_error_reading(t *testing.T) {
ID: "localhost",
})
mockedClient.On("ListContainers").Return([]docker.Container{
{ID: id, Name: "test", Host: "localhost"},
{ID: id, Name: "test", Host: "localhost", State: "running"},
}, nil)
mockedClient.On("ContainerEvents", mock.Anything, mock.AnythingOfType("chan<- docker.ContainerEvent")).Return(nil)
@@ -224,7 +224,7 @@ func Test_handler_streamLogs_error_std(t *testing.T) {
ID: "localhost",
})
mockedClient.On("ListContainers").Return([]docker.Container{
{ID: id, Name: "test", Host: "localhost"},
{ID: id, Name: "test", Host: "localhost", State: "running"},
}, nil)
mockedClient.On("ContainerEvents", mock.Anything, mock.AnythingOfType("chan<- docker.ContainerEvent")).Return(nil).
Run(func(args mock.Arguments) {
@@ -265,7 +265,7 @@ func Test_handler_between_dates(t *testing.T) {
ID: "localhost",
})
mockedClient.On("ListContainers").Return([]docker.Container{
{ID: id, Name: "test", Host: "localhost"},
{ID: id, Name: "test", Host: "localhost", State: "running"},
}, nil)
mockedClient.On("ContainerEvents", mock.Anything, mock.AnythingOfType("chan<- docker.ContainerEvent")).Return(nil)