1
0
mirror of https://github.com/amir20/dozzle.git synced 2025-12-27 07:31:46 +01:00

chore: updates tests

This commit is contained in:
Amir Raminfar
2024-02-02 16:20:08 -08:00
parent 454156ae2c
commit 19a83b7b62

View File

@@ -2,7 +2,6 @@ package web
import (
"context"
"time"
"net/http"
"net/http/httptest"
@@ -23,7 +22,7 @@ func Test_handler_streamEvents_happy(t *testing.T) {
mockedClient := new(MockedClient)
errChannel := make(chan error)
mockedClient.On("ListContainers").Return([]docker.Container{}, nil)
mockedClient.On("ListContainers").Return([]docker.Container{}, nil).Twice()
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() {
@@ -37,7 +36,6 @@ func Test_handler_streamEvents_happy(t *testing.T) {
ActorID: "1234",
Host: "localhost",
}
time.Sleep(100 * time.Millisecond)
cancel()
}()
})
@@ -46,7 +44,7 @@ func Test_handler_streamEvents_happy(t *testing.T) {
Name: "test",
Image: "test",
Stats: utils.NewRingBuffer[docker.ContainerStat](300), // 300 seconds of stats
}, nil)
}, nil).Once()
clients := map[string]docker.Client{
"localhost": mockedClient,