feat: persist cache effective upstream path
This commit is contained in:
23
internal/cache/store_test.go
vendored
23
internal/cache/store_test.go
vendored
@@ -5,6 +5,7 @@ import (
|
||||
"context"
|
||||
"io"
|
||||
"os"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
@@ -62,6 +63,28 @@ func TestStoreRemove(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestStorePersistsEffectiveUpstreamPath(t *testing.T) {
|
||||
store := newTestStore(t)
|
||||
locator := Locator{HubName: "docker", Path: "/v2/coredns/manifests/v1.13.1"}
|
||||
|
||||
_, err := store.Put(context.Background(), locator, strings.NewReader("body"), PutOptions{
|
||||
EffectiveUpstreamPath: "/v2/coredns/coredns/manifests/v1.13.1",
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatalf("put error: %v", err)
|
||||
}
|
||||
|
||||
result, err := store.Get(context.Background(), locator)
|
||||
if err != nil {
|
||||
t.Fatalf("get error: %v", err)
|
||||
}
|
||||
defer result.Reader.Close()
|
||||
|
||||
if result.Entry.EffectiveUpstreamPath != "/v2/coredns/coredns/manifests/v1.13.1" {
|
||||
t.Fatalf("unexpected effective upstream path: %q", result.Entry.EffectiveUpstreamPath)
|
||||
}
|
||||
}
|
||||
|
||||
func TestStoreIgnoresDirectories(t *testing.T) {
|
||||
store := newTestStore(t)
|
||||
locator := Locator{HubName: "ghcr", Path: "/v2"}
|
||||
|
||||
Reference in New Issue
Block a user