go vet fixes
License: MIT Signed-off-by: Hector Sanjuan <hector@protocol.ai>
This commit is contained in:
parent
8e45ce64c2
commit
37046dc925
|
@ -20,6 +20,7 @@ var logger = logging.Logger("numpinalloc")
|
|||
// Allocator implements ipfscluster.Allocate.
|
||||
type Allocator struct{}
|
||||
|
||||
// NewAllocator returns an initialized Allocator
|
||||
func NewAllocator() *Allocator {
|
||||
return &Allocator{}
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ func TestTrackerFromString(t *testing.T) {
|
|||
testcases := []string{"bug", "cluster_error", "pin_error", "unpin_error", "pinned", "pinning", "unpinning", "unpinned", "remote"}
|
||||
for i, tc := range testcases {
|
||||
if TrackerStatusFromString(tc).String() != TrackerStatus(i).String() {
|
||||
t.Errorf("%s does not match %s", tc, i)
|
||||
t.Errorf("%s does not match TrackerStatus %d", tc, i)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -69,6 +69,7 @@ func NewCluster(
|
|||
ctx, cancel := context.WithCancel(context.Background())
|
||||
host, err := makeHost(ctx, cfg)
|
||||
if err != nil {
|
||||
cancel()
|
||||
return nil, err
|
||||
}
|
||||
|
||||
|
|
|
@ -299,12 +299,12 @@ func TestClustersPin(t *testing.T) {
|
|||
j := rand.Intn(nClusters) // choose a random cluster peer
|
||||
err := clusters[j].Unpin(pinList[i].Cid)
|
||||
if err != nil {
|
||||
t.Errorf("error unpinning %s: %s", pinList[i], err)
|
||||
t.Errorf("error unpinning %s: %s", pinList[i].Cid, err)
|
||||
}
|
||||
// test re-unpin
|
||||
err = clusters[j].Unpin(pinList[i].Cid)
|
||||
if err != nil {
|
||||
t.Errorf("error re-unpinning %s: %s", pinList[i], err)
|
||||
t.Errorf("error re-unpinning %s: %s", pinList[i].Cid, err)
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -55,7 +55,9 @@ func (rpcapi *RPCAPI) PinList(in struct{}, out *[]api.CidArgSerial) error {
|
|||
|
||||
// Version runs Cluster.Version().
|
||||
func (rpcapi *RPCAPI) Version(in struct{}, out *api.Version) error {
|
||||
*out = api.Version{rpcapi.c.Version()}
|
||||
*out = api.Version{
|
||||
Version: rpcapi.c.Version(),
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
@ -2,10 +2,13 @@ package test
|
|||
|
||||
import peer "github.com/libp2p/go-libp2p-peer"
|
||||
|
||||
// Common variables used all arround tests.
|
||||
var (
|
||||
TestCid1 = "QmP63DkAFEnDYNjDYBpyNDfttu1fvUw99x1brscPzpqmmq"
|
||||
TestCid2 = "QmP63DkAFEnDYNjDYBpyNDfttu1fvUw99x1brscPzpqmma"
|
||||
TestCid3 = "QmP63DkAFEnDYNjDYBpyNDfttu1fvUw99x1brscPzpqmmb"
|
||||
TestCid1 = "QmP63DkAFEnDYNjDYBpyNDfttu1fvUw99x1brscPzpqmmq"
|
||||
TestCid2 = "QmP63DkAFEnDYNjDYBpyNDfttu1fvUw99x1brscPzpqmma"
|
||||
TestCid3 = "QmP63DkAFEnDYNjDYBpyNDfttu1fvUw99x1brscPzpqmmb"
|
||||
// ErrorCid is meant to be used as a Cid which causes errors. i.e. the
|
||||
// ipfs mock fails when pinning this CID.
|
||||
ErrorCid = "QmP63DkAFEnDYNjDYBpyNDfttu1fvUw99x1brscPzpqmmc"
|
||||
TestPeerID1, _ = peer.IDB58Decode("QmXZrtE5jQwXNqCJMfHUTQkvhQ4ZAnqMnmzFMJfLewuabc")
|
||||
TestPeerID2, _ = peer.IDB58Decode("QmUZ13osndQ5uL4tPWHXe3iBgBgq9gfewcBMSCAuMBsDJ6")
|
||||
|
|
|
@ -12,6 +12,8 @@ import (
|
|||
peer "github.com/libp2p/go-libp2p-peer"
|
||||
)
|
||||
|
||||
// ErrBadCid is returned when using ErrorCid. Operations with that CID always
|
||||
// fail.
|
||||
var ErrBadCid = errors.New("this is an expected error when using ErrorCid")
|
||||
|
||||
type mockService struct{}
|
||||
|
@ -73,7 +75,9 @@ func (mock *mockService) ID(in struct{}, out *api.IDSerial) error {
|
|||
}
|
||||
|
||||
func (mock *mockService) Version(in struct{}, out *api.Version) error {
|
||||
*out = api.Version{"0.0.mock"}
|
||||
*out = api.Version{
|
||||
Version: "0.0.mock",
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user