mirror of
https://github.com/ipfs/kubo.git
synced 2025-07-02 03:28:25 +08:00
namesys: add test for publish with cache size 0
License: MIT Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>
This commit is contained in:
@ -7,6 +7,11 @@ import (
|
||||
context "context"
|
||||
|
||||
path "github.com/ipfs/go-ipfs/path"
|
||||
offroute "github.com/ipfs/go-ipfs/routing/offline"
|
||||
"github.com/ipfs/go-ipfs/unixfs"
|
||||
|
||||
ds "gx/ipfs/QmRWDav6mzWseLWeYfVd5fvUKiVe9xNH29YfMF438fG364/go-datastore"
|
||||
ci "gx/ipfs/QmfWDLQjGjVe4fr5CoztYW2DYYjRysMJrFe1RCsXLPTf46/go-libp2p-crypto"
|
||||
)
|
||||
|
||||
type mockResolver struct {
|
||||
@ -69,3 +74,19 @@ func TestNamesysResolution(t *testing.T) {
|
||||
testResolution(t, r, "/ipns/QmY3hE8xgFCjGcz6PHgnvJz5HZi1BaKRfPkn1ghZUcYMjD", 2, "/ipns/QmbCMUZw6JFeZ7Wp9jkzbye3Fzp2GGcPgC3nmeUjfVF87n", ErrResolveRecursion)
|
||||
testResolution(t, r, "/ipns/QmY3hE8xgFCjGcz6PHgnvJz5HZi1BaKRfPkn1ghZUcYMjD", 3, "/ipns/QmatmE9msSfkKxoffpHwNLNKgwZG8eT9Bud6YoPab52vpy", ErrResolveRecursion)
|
||||
}
|
||||
|
||||
func TestPublishWithCache0(t *testing.T) {
|
||||
dst := ds.NewMapDatastore()
|
||||
priv, _, err := ci.GenerateKeyPair(ci.RSA, 1024)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
routing := offroute.NewOfflineRouter(dst, priv)
|
||||
|
||||
nsys := NewNameSystem(routing, dst, 0)
|
||||
p, err := path.ParsePath(unixfs.EmptyDirNode().Cid().String())
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
nsys.Publish(context.Background(), priv, p)
|
||||
}
|
||||
|
Reference in New Issue
Block a user