2fc4d61610
* implement contact.checkin method * add batching to update uptime checks * rm batching * rm other unneeded things * fix lint * fix unit test * changes per CR comments * couple more CR changes * add identity check into grpcOpt * fix lint * why do you fix the test * revert test change * stop contact chore for repair test * put node in cache * comment out contact chore. See what happens * Revert "comment out contact chore. See what happens" This reverts commit 2e45008e36a50e0a842ae455ac83de77093d4daa. * try stopping contact earlier * stop contact chore in uplink_test * replace self on chore with *RoutingTable for access to latest node info * Revert "stop contact chore in uplink_test" This reverts commit 302db70f4071112d1b9f7ee0279225ea12757723. * Revert "try stopping contact earlier" This reverts commit 806cc3b82f9d598899dafd83da9315a1cb0cb43c. * Revert "stop contact chore for repair test" This reverts commit dd34de1cfdfc09b972186c9ab9a4f1e822446b79.
49 lines
1.2 KiB
Go
49 lines
1.2 KiB
Go
// Copyright (C) 2019 Storj Labs, Inc.
|
|
// See LICENSE for copying information.
|
|
|
|
package contact_test
|
|
|
|
import (
|
|
"crypto/tls"
|
|
"crypto/x509"
|
|
"net"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
"google.golang.org/grpc/credentials"
|
|
"google.golang.org/grpc/peer"
|
|
|
|
"storj.io/storj/internal/testcontext"
|
|
"storj.io/storj/internal/testplanet"
|
|
"storj.io/storj/pkg/pb"
|
|
)
|
|
|
|
func TestSatelliteContactEndpoint(t *testing.T) {
|
|
testplanet.Run(t, testplanet.Config{
|
|
SatelliteCount: 1, StorageNodeCount: 1, UplinkCount: 0,
|
|
}, func(t *testing.T, ctx *testcontext.Context, planet *testplanet.Planet) {
|
|
nodeDossier := planet.StorageNodes[0].Local()
|
|
ident := planet.StorageNodes[0].Identity
|
|
|
|
grpcPeer := peer.Peer{
|
|
Addr: &net.TCPAddr{
|
|
IP: net.ParseIP(nodeDossier.Address.GetAddress()),
|
|
Port: 5,
|
|
},
|
|
AuthInfo: credentials.TLSInfo{
|
|
State: tls.ConnectionState{
|
|
PeerCertificates: []*x509.Certificate{ident.Leaf, ident.CA},
|
|
},
|
|
},
|
|
}
|
|
peerCtx := peer.NewContext(ctx, &grpcPeer)
|
|
resp, err := planet.Satellites[0].Contact.Endpoint.Checkin(peerCtx, &pb.CheckinRequest{
|
|
Address: nodeDossier.Address,
|
|
Capacity: &nodeDossier.Capacity,
|
|
Operator: &nodeDossier.Operator,
|
|
})
|
|
require.NoError(t, err)
|
|
require.NotNil(t, resp)
|
|
})
|
|
}
|