private/testplanet: try using multiple localhosts
Rather than starting all servers on 127.0.0.1 start them on a random local host to try avoid port exhaustion. The port exhaustion is just a guess. Change-Id: Ibf31d6a017852238d836291d703642b44ff66c0c
This commit is contained in:
parent
53de525721
commit
19a2555126
@ -183,6 +183,7 @@ pipeline {
|
|||||||
}
|
}
|
||||||
stage('Tests') {
|
stage('Tests') {
|
||||||
environment {
|
environment {
|
||||||
|
STORJ_TEST_HOST = '127.0.0.20;127.0.0.21;127.0.0.22;127.0.0.23;127.0.0.24;127.0.0.25'
|
||||||
STORJ_TEST_COCKROACH = 'cockroach://root@localhost:26256/testcockroach?sslmode=disable;' +
|
STORJ_TEST_COCKROACH = 'cockroach://root@localhost:26256/testcockroach?sslmode=disable;' +
|
||||||
'cockroach://root@localhost:26257/testcockroach?sslmode=disable;' +
|
'cockroach://root@localhost:26257/testcockroach?sslmode=disable;' +
|
||||||
'cockroach://root@localhost:26258/testcockroach?sslmode=disable;' +
|
'cockroach://root@localhost:26258/testcockroach?sslmode=disable;' +
|
||||||
|
@ -20,6 +20,13 @@
|
|||||||
// STORJ_TEST_COCKROACH=omit
|
// STORJ_TEST_COCKROACH=omit
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
|
// Host
|
||||||
|
//
|
||||||
|
// It's possible to change the listing host with:
|
||||||
|
//
|
||||||
|
// STORJ_TEST_HOST=127.0.0.2;127.0.0.3
|
||||||
|
//
|
||||||
|
//
|
||||||
// Debugging
|
// Debugging
|
||||||
//
|
//
|
||||||
// For debugging, it's possible to set STORJ_TEST_MONKIT to get a trace per test.
|
// For debugging, it's possible to set STORJ_TEST_MONKIT to get a trace per test.
|
||||||
|
@ -12,6 +12,7 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"runtime/pprof"
|
"runtime/pprof"
|
||||||
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@ -25,6 +26,7 @@ import (
|
|||||||
"storj.io/common/pb"
|
"storj.io/common/pb"
|
||||||
"storj.io/common/storj"
|
"storj.io/common/storj"
|
||||||
"storj.io/common/testcontext"
|
"storj.io/common/testcontext"
|
||||||
|
"storj.io/common/testrand"
|
||||||
"storj.io/private/dbutil/pgutil"
|
"storj.io/private/dbutil/pgutil"
|
||||||
"storj.io/storj/satellite/overlay"
|
"storj.io/storj/satellite/overlay"
|
||||||
"storj.io/storj/satellite/satellitedb/satellitedbtest"
|
"storj.io/storj/satellite/satellitedb/satellitedbtest"
|
||||||
@ -59,6 +61,7 @@ type Config struct {
|
|||||||
Reconfigure Reconfigure
|
Reconfigure Reconfigure
|
||||||
|
|
||||||
Name string
|
Name string
|
||||||
|
Host string
|
||||||
NonParallel bool
|
NonParallel bool
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -132,6 +135,14 @@ func NewCustom(ctx *testcontext.Context, log *zap.Logger, config Config, satelli
|
|||||||
config.IdentityVersion = &version
|
config.IdentityVersion = &version
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if config.Host == "" {
|
||||||
|
config.Host = "127.0.0.1"
|
||||||
|
if hostlist := os.Getenv("STORJ_TEST_HOST"); hostlist != "" {
|
||||||
|
hosts := strings.Split(hostlist, ";")
|
||||||
|
config.Host = hosts[testrand.Intn(len(hosts))]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
planet := &Planet{
|
planet := &Planet{
|
||||||
ctx: ctx,
|
ctx: ctx,
|
||||||
log: log,
|
log: log,
|
||||||
@ -359,9 +370,14 @@ func (planet *Planet) NewIdentity() (*identity.FullIdentity, error) {
|
|||||||
return planet.identities.NewIdentity()
|
return planet.identities.NewIdentity()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NewListenAddress returns an address for listening.
|
||||||
|
func (planet *Planet) NewListenAddress() string {
|
||||||
|
return net.JoinHostPort(planet.config.Host, "0")
|
||||||
|
}
|
||||||
|
|
||||||
// NewListener creates a new listener.
|
// NewListener creates a new listener.
|
||||||
func (planet *Planet) NewListener() (net.Listener, error) {
|
func (planet *Planet) NewListener() (net.Listener, error) {
|
||||||
return net.Listen("tcp", "127.0.0.1:0")
|
return net.Listen("tcp", planet.NewListenAddress())
|
||||||
}
|
}
|
||||||
|
|
||||||
// WriteWhitelist writes the pregenerated signer's CA cert to a "CA whitelist", PEM-encoded.
|
// WriteWhitelist writes the pregenerated signer's CA cert to a "CA whitelist", PEM-encoded.
|
||||||
|
@ -455,10 +455,10 @@ func (planet *Planet) newSatellite(ctx context.Context, prefix string, index int
|
|||||||
config.Metainfo.SegmentLoop.ListLimit = 0
|
config.Metainfo.SegmentLoop.ListLimit = 0
|
||||||
|
|
||||||
// Actual testplanet-specific configuration
|
// Actual testplanet-specific configuration
|
||||||
config.Server.Address = "127.0.0.1:0"
|
config.Server.Address = planet.NewListenAddress()
|
||||||
config.Server.PrivateAddress = "127.0.0.1:0"
|
config.Server.PrivateAddress = planet.NewListenAddress()
|
||||||
config.Admin.Address = "127.0.0.1:0"
|
config.Admin.Address = planet.NewListenAddress()
|
||||||
config.Console.Address = "127.0.0.1:0"
|
config.Console.Address = planet.NewListenAddress()
|
||||||
config.Server.Config.PeerCAWhitelistPath = planet.whitelistPath
|
config.Server.Config.PeerCAWhitelistPath = planet.whitelistPath
|
||||||
config.Server.Config.UsePeerCAWhitelist = true
|
config.Server.Config.UsePeerCAWhitelist = true
|
||||||
config.Version = planet.NewVersionConfig()
|
config.Version = planet.NewVersionConfig()
|
||||||
|
@ -118,8 +118,8 @@ func (planet *Planet) newStorageNode(ctx context.Context, prefix string, index,
|
|||||||
|
|
||||||
config := storagenode.Config{
|
config := storagenode.Config{
|
||||||
Server: server.Config{
|
Server: server.Config{
|
||||||
Address: "127.0.0.1:0",
|
Address: planet.NewListenAddress(),
|
||||||
PrivateAddress: "127.0.0.1:0",
|
PrivateAddress: planet.NewListenAddress(),
|
||||||
|
|
||||||
Config: tlsopts.Config{
|
Config: tlsopts.Config{
|
||||||
RevocationDBURL: "bolt://" + filepath.Join(storageDir, "revocation.db"),
|
RevocationDBURL: "bolt://" + filepath.Join(storageDir, "revocation.db"),
|
||||||
@ -157,7 +157,7 @@ func (planet *Planet) newStorageNode(ctx context.Context, prefix string, index,
|
|||||||
StorageSync: defaultInterval,
|
StorageSync: defaultInterval,
|
||||||
},
|
},
|
||||||
Console: consoleserver.Config{
|
Console: consoleserver.Config{
|
||||||
Address: "127.0.0.1:0",
|
Address: planet.NewListenAddress(),
|
||||||
StaticDir: filepath.Join(developmentRoot, "web/storagenode/"),
|
StaticDir: filepath.Join(developmentRoot, "web/storagenode/"),
|
||||||
},
|
},
|
||||||
Storage2: piecestore.Config{
|
Storage2: piecestore.Config{
|
||||||
|
@ -36,7 +36,7 @@ func (planet *Planet) newVersionControlServer() (peer *versioncontrol.Peer, err
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
config := &versioncontrol.Config{
|
config := &versioncontrol.Config{
|
||||||
Address: "127.0.0.1:0",
|
Address: planet.NewListenAddress(),
|
||||||
Versions: versioncontrol.OldVersionConfig{
|
Versions: versioncontrol.OldVersionConfig{
|
||||||
Satellite: "v0.0.1",
|
Satellite: "v0.0.1",
|
||||||
Storagenode: "v0.0.1",
|
Storagenode: "v0.0.1",
|
||||||
|
Loading…
Reference in New Issue
Block a user