tailer struct was incorrect and used incorrect channel

This commit is contained in:
2026-05-18 01:14:57 -06:00
parent 66c6ed7793
commit 9b0610b879
5 changed files with 21 additions and 8 deletions
+6 -2
View File
@@ -5,6 +5,7 @@ import (
"errors"
"fmt"
"io"
"log/slog"
"net/http"
"net/http/httptest"
"os"
@@ -22,6 +23,8 @@ func newTestServer(t *testing.T, handler http.HandlerFunc) *httptest.Server {
func newTestCache(t *testing.T, mirrorURLs []string) *Cache {
t.Helper()
// set slog to debug
slog.SetLogLoggerLevel(slog.LevelDebug)
mirroredRepos := []string{"core", "extra"}
c, err := NewCache(t.TempDir(), mirrorURLs, mirroredRepos)
if err != nil {
@@ -33,7 +36,6 @@ func newTestCache(t *testing.T, mirrorURLs []string) *Cache {
func TestCacheHit(t *testing.T) {
const expected = "This is fake file contents"
c := newTestCache(t, []string{"http://example.com/"})
tmpFileName := "fakeFile"
err := c.cr.WriteFile(tmpFileName, []byte(expected), 0644)
@@ -78,10 +80,12 @@ func TestCacheMissExists(t *testing.T) {
c := newTestCache(t, []string{svr.URL + "/"})
_, err := c.Fetch("fakefile")
cf, err := c.Fetch("fakefile")
if err != nil {
t.Fatalf("Fetch failed %v", err)
}
io.Copy(io.Discard, cf.Reader)
cf.Reader.Close()
data, err := c.cr.ReadFile("fakefile")
if err != nil {