Add email to self node info (#2171)

This commit is contained in:
Kaloyan Raev 2019-06-11 16:30:28 +03:00 committed by GitHub
parent f624b213a3
commit 252c8ac189
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 26 additions and 1 deletions

View File

@ -139,6 +139,7 @@ func New(log *zap.Logger, full *identity.FullIdentity, db DB, config Config, ver
},
Type: pb.NodeType_BOOTSTRAP,
Operator: pb.NodeOperator{
Email: config.Operator.Email,
Wallet: config.Operator.Wallet,
},
Version: *pbVersion,

View File

@ -135,7 +135,7 @@ func (discovery *Discovery) refresh(ctx context.Context) (err error) {
discovery.log.Error("could not update node uptime in cache", zap.String("ID", ping.Id.String()), zap.Error(err))
}
// update wallet with correct info
// update node info
info, err := discovery.kad.FetchInfo(ctx, node.Node)
if err != nil {
discovery.log.Warn("could not fetch node info", zap.String("ID", ping.GetAddress().String()))

View File

@ -209,3 +209,25 @@ func TestIsVetted(t *testing.T) {
assert.False(t, reputable)
})
}
func TestNodeInfo(t *testing.T) {
testplanet.Run(t, testplanet.Config{
SatelliteCount: 1, StorageNodeCount: 1, UplinkCount: 0,
}, func(t *testing.T, ctx *testcontext.Context, planet *testplanet.Planet) {
planet.StorageNodes[0].Storage2.Monitor.Loop.Pause()
planet.Satellites[0].Discovery.Service.Refresh.Pause()
node, err := planet.Satellites[0].Overlay.Service.Get(ctx, planet.StorageNodes[0].ID())
require.NoError(t, err)
assert.Equal(t, pb.NodeType_STORAGE, node.Type)
assert.NotEmpty(t, node.Operator.Email)
assert.NotEmpty(t, node.Operator.Wallet)
assert.Equal(t, planet.StorageNodes[0].Local().Operator, node.Operator)
assert.NotEmpty(t, node.Capacity.FreeBandwidth)
assert.NotEmpty(t, node.Capacity.FreeDisk)
assert.Equal(t, planet.StorageNodes[0].Local().Capacity, node.Capacity)
assert.NotEmpty(t, node.Version.Version)
assert.Equal(t, planet.StorageNodes[0].Local().Version.Version, node.Version.Version)
})
}

View File

@ -278,6 +278,7 @@ func New(log *zap.Logger, full *identity.FullIdentity, db DB, config *Config, ve
},
Type: pb.NodeType_SATELLITE,
Operator: pb.NodeOperator{
Email: config.Operator.Email,
Wallet: config.Operator.Wallet,
},
Version: *pbVersion,

View File

@ -169,6 +169,7 @@ func New(log *zap.Logger, full *identity.FullIdentity, db DB, config Config, ver
},
Type: pb.NodeType_STORAGE,
Operator: pb.NodeOperator{
Email: config.Operator.Email,
Wallet: config.Operator.Wallet,
},
Version: *pbVersion,