Skip to content

Commit

Permalink
Issue #446 Adding peername to PinInfo
Browse files Browse the repository at this point in the history
Removed unnecessary peername assignment
Modified tests according to the changes made to add peername to PinInfo

License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
  • Loading branch information
kishansagathiya committed Sep 12, 2018
1 parent ed0fca7 commit 0c32b4f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ func testingCluster(t *testing.T) (*Cluster, *mockAPI, *mockConnector, state.Sta
api := &mockAPI{}
ipfs := &mockConnector{}
st := mapstate.NewMapState()
tracker := makePinTracker(t, clusterCfg.ID, maptrackerCfg, statelesstrackerCfg)
tracker := makePinTracker(t, clusterCfg.ID, maptrackerCfg, statelesstrackerCfg, clusterCfg.Peername)

raftcon, _ := raft.NewConsensus(host, consensusCfg, st, false)

Expand Down
8 changes: 4 additions & 4 deletions ipfscluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ func createComponents(t *testing.T, i int, clusterSecret []byte, staging bool) (
ipfs, err := ipfshttp.NewConnector(ipfshttpCfg)
checkErr(t, err)
state := mapstate.NewMapState()
tracker := makePinTracker(t, clusterCfg.ID, maptrackerCfg, statelesstrackerCfg)
tracker := makePinTracker(t, clusterCfg.ID, maptrackerCfg, statelesstrackerCfg, clusterCfg.Peername)

mon := makeMonitor(t, host, bmonCfg, psmonCfg)

Expand Down Expand Up @@ -191,13 +191,13 @@ func makeMonitor(t *testing.T, h host.Host, bmonCfg *basic.Config, psmonCfg *pub
return mon
}

func makePinTracker(t *testing.T, pid peer.ID, mptCfg *maptracker.Config, sptCfg *stateless.Config) PinTracker {
func makePinTracker(t *testing.T, pid peer.ID, mptCfg *maptracker.Config, sptCfg *stateless.Config, peerName string) PinTracker {
var ptrkr PinTracker
switch ptracker {
case "map":
ptrkr = maptracker.NewMapPinTracker(mptCfg, pid)
ptrkr = maptracker.NewMapPinTracker(mptCfg, pid, peerName)
case "stateless":
ptrkr = stateless.New(sptCfg, pid)
ptrkr = stateless.New(sptCfg, pid, peerName)
default:
panic("bad pintracker")
}
Expand Down
1 change: 0 additions & 1 deletion rpc_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@ func (rpcapi *RPCAPI) Status(ctx context.Context, in api.PinSerial, out *api.Glo
func (rpcapi *RPCAPI) StatusLocal(ctx context.Context, in api.PinSerial, out *api.PinInfoSerial) error {
c := in.ToPin().Cid
pinfo := rpcapi.c.StatusLocal(c)
pinfo.PeerName = rpcapi.c.config.Peername
*out = pinfo.ToSerial()
return nil
}
Expand Down

0 comments on commit 0c32b4f

Please sign in to comment.