This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
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)
|
||||
}
|
||||
}
|
||||
@@ -71,7 +71,7 @@ const (
|
||||
TransportLocal = "local"
|
||||
)
|
||||
|
||||
func (c Config) validate() error {
|
||||
func (c *Config) validate() error {
|
||||
missing := make([]string, 0, 6)
|
||||
if c.Transport == TransportLocal {
|
||||
// fixture 通道没有 ssh,但必须有显式隔离根:否则"本地目录"会被当成云端。
|
||||
|
||||
Reference in New Issue
Block a user