1
0
mirror of https://github.com/amir20/dozzle.git synced 2025-12-21 21:33:18 +01:00

chore: improves tests

This commit is contained in:
Amir Raminfar
2025-02-12 15:55:49 -08:00
parent 78c0e5fd7f
commit 9e028b9916
2 changed files with 2 additions and 4 deletions

View File

@@ -63,10 +63,8 @@ func TestContainerStore_List(t *testing.T) {
Stats: utils.NewRingBuffer[ContainerStat](300), Stats: utils.NewRingBuffer[ContainerStat](300),
}, nil) }, nil)
ctx, cancel := context.WithCancel(context.Background())
t.Cleanup(cancel)
collector := &fakeStatsCollector{} collector := &fakeStatsCollector{}
store := NewContainerStore(ctx, client, collector, ContainerLabels{}) store := NewContainerStore(t.Context(), client, collector, ContainerLabels{})
containers, _ := store.ListContainers(ContainerLabels{}) containers, _ := store.ListContainers(ContainerLabels{})
assert.Equal(t, containers[0].ID, "1234") assert.Equal(t, containers[0].ID, "1234")

View File

@@ -21,7 +21,7 @@ import (
) )
func Test_handler_streamLogs_happy(t *testing.T) { func Test_handler_streamLogs_happy(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background()) ctx, cancel := context.WithCancel(t.Context())
id := "123456" id := "123456"
req, err := http.NewRequestWithContext(ctx, "GET", "/api/hosts/localhost/containers/"+id+"/logs/stream", nil) req, err := http.NewRequestWithContext(ctx, "GET", "/api/hosts/localhost/containers/"+id+"/logs/stream", nil)