35 lines
870 B
Go
35 lines
870 B
Go
package libraryhandoff
|
|
|
|
import (
|
|
"context"
|
|
"testing"
|
|
"time"
|
|
)
|
|
|
|
func TestDefaultLimitsAllowRealBundleRoundTrip(t *testing.T) {
|
|
root, archive := newArchive(t)
|
|
id := seal(t, archive)
|
|
f := newFixture(t, root)
|
|
f.cfg.MaxBundleBytes = 0
|
|
f.cfg.OpTimeout = 0
|
|
h, err := New(f.cfg, time.Now)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
want := Identity{SnapshotID: id, Scope: "internal", TenantID: fixtureTenant, KnowledgeBaseID: fixtureKB}
|
|
if _, err := h.Push(context.Background(), want); err != nil {
|
|
t.Fatalf("omitted limits must allow a real bundle: %v", err)
|
|
}
|
|
fresh, _ := newArchive(t)
|
|
cfg := withLocalArchive(t, f, fresh)
|
|
cfg.MaxBundleBytes = 0
|
|
cfg.OpTimeout = 0
|
|
down, err := New(cfg, time.Now)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if _, err := down.Fetch(context.Background(), id); err != nil {
|
|
t.Fatalf("omitted limits must allow verified fetch: %v", err)
|
|
}
|
|
}
|