2019-12-17 13:06:30 +00:00
|
|
|
// Copyright (C) 2019 Storj Labs, Inc.
|
|
|
|
// See LICENSE for copying information.
|
|
|
|
|
|
|
|
package testplanet_test
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
|
2019-12-27 11:48:47 +00:00
|
|
|
"storj.io/common/identity"
|
|
|
|
"storj.io/common/identity/testidentity"
|
|
|
|
"storj.io/common/peertls/tlsopts"
|
|
|
|
"storj.io/common/rpc"
|
|
|
|
"storj.io/common/storj"
|
|
|
|
"storj.io/common/testcontext"
|
2019-12-17 13:06:30 +00:00
|
|
|
"storj.io/storj/private/testplanet"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestOptions_ServerOption_Peer_CA_Whitelist(t *testing.T) {
|
|
|
|
testplanet.Run(t, testplanet.Config{
|
|
|
|
SatelliteCount: 0, StorageNodeCount: 2, UplinkCount: 0,
|
|
|
|
}, func(t *testing.T, ctx *testcontext.Context, planet *testplanet.Planet) {
|
2020-05-19 16:49:13 +01:00
|
|
|
sn := planet.StorageNodes[1]
|
2019-12-17 13:06:30 +00:00
|
|
|
testidentity.CompleteIdentityVersionsTest(t, func(t *testing.T, version storj.IDVersion, ident *identity.FullIdentity) {
|
|
|
|
tlsOptions, err := tlsopts.NewOptions(ident, tlsopts.Config{
|
|
|
|
PeerIDVersions: "*",
|
|
|
|
}, nil)
|
|
|
|
require.NoError(t, err)
|
|
|
|
|
|
|
|
dialer := rpc.NewDefaultDialer(tlsOptions)
|
|
|
|
|
2020-05-19 16:49:13 +01:00
|
|
|
conn, err := dialer.DialNodeURL(ctx, sn.NodeURL())
|
2019-12-17 13:06:30 +00:00
|
|
|
assert.NotNil(t, conn)
|
|
|
|
assert.NoError(t, err)
|
|
|
|
|
|
|
|
assert.NoError(t, conn.Close())
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|