Consul test server fork without porter/rpc.ports
This commit is contained in:
parent
c01efb0a6d
commit
84f480528a
|
@ -150,7 +150,8 @@ deps: ## Install build and development dependencies
|
||||||
go get -u github.com/elazarl/go-bindata-assetfs/...
|
go get -u github.com/elazarl/go-bindata-assetfs/...
|
||||||
go get -u github.com/hashicorp/vault
|
go get -u github.com/hashicorp/vault
|
||||||
go get -u github.com/a8m/tree/cmd/tree
|
go get -u github.com/a8m/tree/cmd/tree
|
||||||
go get -u github.com/hashicorp/consul/test/porter/cmd/porter
|
## Unneeded since we use Consul's no-porter branch
|
||||||
|
##go get -u github.com/hashicorp/consul/test/porter/cmd/porter
|
||||||
|
|
||||||
.PHONY: check
|
.PHONY: check
|
||||||
check: ## Lint the source code
|
check: ## Lint the source code
|
||||||
|
|
43
vendor/github.com/hashicorp/consul/testutil/server.go
generated
vendored
43
vendor/github.com/hashicorp/consul/testutil/server.go
generated
vendored
|
@ -27,7 +27,6 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/hashicorp/consul/test/porter"
|
|
||||||
"github.com/hashicorp/consul/testutil/retry"
|
"github.com/hashicorp/consul/testutil/retry"
|
||||||
"github.com/hashicorp/go-cleanhttp"
|
"github.com/hashicorp/go-cleanhttp"
|
||||||
"github.com/hashicorp/go-uuid"
|
"github.com/hashicorp/go-uuid"
|
||||||
|
@ -48,6 +47,9 @@ type TestPortConfig struct {
|
||||||
SerfLan int `json:"serf_lan,omitempty"`
|
SerfLan int `json:"serf_lan,omitempty"`
|
||||||
SerfWan int `json:"serf_wan,omitempty"`
|
SerfWan int `json:"serf_wan,omitempty"`
|
||||||
Server int `json:"server,omitempty"`
|
Server int `json:"server,omitempty"`
|
||||||
|
|
||||||
|
// Deprecated
|
||||||
|
RPC int `json:"rpc,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// TestAddressConfig contains the bind addresses for various
|
// TestAddressConfig contains the bind addresses for various
|
||||||
|
@ -111,12 +113,8 @@ func defaultServerConfig() *TestServerConfig {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
ports, err := porter.RandomPorts(6)
|
|
||||||
if err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
return &TestServerConfig{
|
return &TestServerConfig{
|
||||||
NodeName: "node-" + nodeID,
|
NodeName: fmt.Sprintf("node%d", randomPort()),
|
||||||
NodeID: nodeID,
|
NodeID: nodeID,
|
||||||
DisableCheckpoint: true,
|
DisableCheckpoint: true,
|
||||||
Performance: &TestPerformanceConfig{
|
Performance: &TestPerformanceConfig{
|
||||||
|
@ -128,17 +126,28 @@ func defaultServerConfig() *TestServerConfig {
|
||||||
Bind: "127.0.0.1",
|
Bind: "127.0.0.1",
|
||||||
Addresses: &TestAddressConfig{},
|
Addresses: &TestAddressConfig{},
|
||||||
Ports: &TestPortConfig{
|
Ports: &TestPortConfig{
|
||||||
DNS: ports[0],
|
DNS: randomPort(),
|
||||||
HTTP: ports[1],
|
HTTP: randomPort(),
|
||||||
HTTPS: ports[2],
|
HTTPS: randomPort(),
|
||||||
SerfLan: ports[3],
|
SerfLan: randomPort(),
|
||||||
SerfWan: ports[4],
|
SerfWan: randomPort(),
|
||||||
Server: ports[5],
|
Server: randomPort(),
|
||||||
|
//RPC: randomPort(),
|
||||||
},
|
},
|
||||||
ReadyTimeout: 10 * time.Second,
|
ReadyTimeout: 10 * time.Second,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// randomPort asks the kernel for a random port to use.
|
||||||
|
func randomPort() int {
|
||||||
|
l, err := net.Listen("tcp", "127.0.0.1:0")
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
defer l.Close()
|
||||||
|
return l.Addr().(*net.TCPAddr).Port
|
||||||
|
}
|
||||||
|
|
||||||
// TestService is used to serialize a service definition.
|
// TestService is used to serialize a service definition.
|
||||||
type TestService struct {
|
type TestService struct {
|
||||||
ID string `json:",omitempty"`
|
ID string `json:",omitempty"`
|
||||||
|
@ -191,7 +200,15 @@ func NewTestServerConfig(cb ServerConfigCallback) (*TestServer, error) {
|
||||||
// configuring or starting the server, the server will NOT be running when the
|
// configuring or starting the server, the server will NOT be running when the
|
||||||
// function returns (thus you do not need to stop it).
|
// function returns (thus you do not need to stop it).
|
||||||
func NewTestServerConfigT(t *testing.T, cb ServerConfigCallback) (*TestServer, error) {
|
func NewTestServerConfigT(t *testing.T, cb ServerConfigCallback) (*TestServer, error) {
|
||||||
return newTestServerConfigT(t, cb)
|
var server *TestServer
|
||||||
|
retry.Run(t, func(r *retry.R) {
|
||||||
|
var err error
|
||||||
|
server, err = newTestServerConfigT(t, cb)
|
||||||
|
if err != nil {
|
||||||
|
r.Fatalf("failed starting test server: %v", err)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
return server, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// newTestServerConfigT is the internal helper for NewTestServerConfigT.
|
// newTestServerConfigT is the internal helper for NewTestServerConfigT.
|
||||||
|
|
4
vendor/github.com/hashicorp/consul/testutil/server_methods.go
generated
vendored
4
vendor/github.com/hashicorp/consul/testutil/server_methods.go
generated
vendored
|
@ -25,13 +25,13 @@ const (
|
||||||
|
|
||||||
// JoinLAN is used to join local datacenters together.
|
// JoinLAN is used to join local datacenters together.
|
||||||
func (s *TestServer) JoinLAN(t *testing.T, addr string) {
|
func (s *TestServer) JoinLAN(t *testing.T, addr string) {
|
||||||
resp := s.put(t, "/v1/agent/join/"+addr, nil)
|
resp := s.get(t, "/v1/agent/join/"+addr)
|
||||||
defer resp.Body.Close()
|
defer resp.Body.Close()
|
||||||
}
|
}
|
||||||
|
|
||||||
// JoinWAN is used to join remote datacenters together.
|
// JoinWAN is used to join remote datacenters together.
|
||||||
func (s *TestServer) JoinWAN(t *testing.T, addr string) {
|
func (s *TestServer) JoinWAN(t *testing.T, addr string) {
|
||||||
resp := s.put(t, "/v1/agent/join/"+addr+"?wan=1", nil)
|
resp := s.get(t, "/v1/agent/join/"+addr+"?wan=1")
|
||||||
resp.Body.Close()
|
resp.Body.Close()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
10
vendor/vendor.json
vendored
10
vendor/vendor.json
vendored
|
@ -767,16 +767,16 @@
|
||||||
"revisionTime": "2017-10-16T16:22:40Z"
|
"revisionTime": "2017-10-16T16:22:40Z"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"checksumSHA1": "srD5fzGnxoAqvR6oIE4JBJ1OuT8=",
|
"checksumSHA1": "AZh3opzONxPrOi+4Io2+OomdKgM=",
|
||||||
"path": "github.com/hashicorp/consul/testutil",
|
"path": "github.com/hashicorp/consul/testutil",
|
||||||
"revision": "51ea240df8476e02215d53fbfad5838bf0d44d21",
|
"revision": "745fd38728f28061c9f5bfe323d68ee25f2cd07b",
|
||||||
"revisionTime": "2017-10-16T16:22:40Z"
|
"revisionTime": "2017-10-16T23:19:35Z"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"checksumSHA1": "J8TTDc84MvAyXE/FrfgS+xc/b6s=",
|
"checksumSHA1": "J8TTDc84MvAyXE/FrfgS+xc/b6s=",
|
||||||
"path": "github.com/hashicorp/consul/testutil/retry",
|
"path": "github.com/hashicorp/consul/testutil/retry",
|
||||||
"revision": "51ea240df8476e02215d53fbfad5838bf0d44d21",
|
"revision": "745fd38728f28061c9f5bfe323d68ee25f2cd07b",
|
||||||
"revisionTime": "2017-10-16T16:22:40Z"
|
"revisionTime": "2017-10-16T23:19:35Z"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "github.com/hashicorp/errwrap",
|
"path": "github.com/hashicorp/errwrap",
|
||||||
|
|
Loading…
Reference in a new issue