Merge branch 'master' of https://github.com/katiebayes/consul
This commit is contained in:
commit
6e684217f8
|
@ -29,6 +29,8 @@ import (
|
|||
"github.com/hashicorp/consul/lib"
|
||||
"github.com/hashicorp/consul/logger"
|
||||
"github.com/hashicorp/consul/types"
|
||||
"github.com/hashicorp/consul/watch"
|
||||
multierror "github.com/hashicorp/go-multierror"
|
||||
"github.com/hashicorp/go-sockaddr/template"
|
||||
"github.com/hashicorp/go-uuid"
|
||||
"github.com/hashicorp/raft"
|
||||
|
@ -141,6 +143,10 @@ type Agent struct {
|
|||
shutdownCh chan struct{}
|
||||
shutdownLock sync.Mutex
|
||||
|
||||
// retryJoinCh transports errors from the retry join
|
||||
// attempts.
|
||||
retryJoinCh chan error
|
||||
|
||||
// endpoints lets you override RPC endpoints for testing. Not all
|
||||
// agent methods use this, so use with care and never override
|
||||
// outside of a unit test.
|
||||
|
@ -195,6 +201,7 @@ func NewAgent(c *Config) (*Agent, error) {
|
|||
eventCh: make(chan serf.UserEvent, 1024),
|
||||
eventBuf: make([]*UserEvent, 256),
|
||||
reloadCh: make(chan chan error),
|
||||
retryJoinCh: make(chan error),
|
||||
shutdownCh: make(chan struct{}),
|
||||
endpoints: make(map[string]string),
|
||||
dnsAddrs: dnsAddrs,
|
||||
|
@ -303,6 +310,11 @@ func (a *Agent) Start() error {
|
|||
}
|
||||
a.httpServers = append(a.httpServers, srv)
|
||||
}
|
||||
|
||||
// start retry join
|
||||
go a.retryJoin()
|
||||
go a.retryJoinWan()
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -325,7 +337,7 @@ func (a *Agent) listenAndServeDNS() error {
|
|||
|
||||
err := s.ListenAndServe(p.Net, p.Addr, func() { notif <- p })
|
||||
if err != nil && !strings.Contains(err.Error(), "accept") {
|
||||
a.logger.Printf("[ERR] agent: Error starting DNS server %s (%s): ", p.Addr, p.Net, err)
|
||||
a.logger.Printf("[ERR] agent: Error starting DNS server %s (%s): %v", p.Addr, p.Net, err)
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
@ -1065,15 +1077,10 @@ func (a *Agent) Shutdown() error {
|
|||
// no longer sufficient to check for an HTTPS server.
|
||||
a.logger.Printf("[INFO] agent: Stopping %s server %s", strings.ToUpper(srv.proto), srv.Addr)
|
||||
|
||||
// old behavior: just die
|
||||
// srv.Close()
|
||||
|
||||
// graceful shutdown
|
||||
// todo(fs): we are timing out every time. Need to find out why.
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 100*time.Millisecond)
|
||||
ctx, cancel := context.WithTimeout(context.Background(), time.Second)
|
||||
defer cancel()
|
||||
srv.Shutdown(ctx)
|
||||
<-ctx.Done()
|
||||
if ctx.Err() == context.DeadlineExceeded {
|
||||
a.logger.Printf("[WARN] agent: Timeout stopping %s server %s", strings.ToUpper(srv.proto), srv.Addr)
|
||||
}
|
||||
|
@ -1127,6 +1134,12 @@ func (a *Agent) ReloadCh() chan chan error {
|
|||
return a.reloadCh
|
||||
}
|
||||
|
||||
// RetryJoinCh is a channel that transports errors
|
||||
// from the retry join process.
|
||||
func (a *Agent) RetryJoinCh() <-chan error {
|
||||
return a.retryJoinCh
|
||||
}
|
||||
|
||||
// ShutdownCh is used to return a channel that can be
|
||||
// selected to wait for the agent to perform a shutdown.
|
||||
func (a *Agent) ShutdownCh() <-chan struct{} {
|
||||
|
@ -1817,6 +1830,10 @@ func (a *Agent) purgeCheckState(checkID types.CheckID) error {
|
|||
return err
|
||||
}
|
||||
|
||||
func (a *Agent) GossipEncrypted() bool {
|
||||
return a.delegate.Encrypted()
|
||||
}
|
||||
|
||||
// Stats is used to get various debugging state from the sub-systems
|
||||
func (a *Agent) Stats() map[string]map[string]string {
|
||||
toString := func(v uint64) string {
|
||||
|
@ -2095,15 +2112,6 @@ func (a *Agent) loadMetadata(conf *Config) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// parseMetaPair parses a key/value pair of the form key:value
|
||||
func parseMetaPair(raw string) (string, string) {
|
||||
pair := strings.SplitN(raw, ":", 2)
|
||||
if len(pair) == 2 {
|
||||
return pair[0], pair[1]
|
||||
}
|
||||
return pair[0], ""
|
||||
}
|
||||
|
||||
// unloadMetadata resets the local metadata state
|
||||
func (a *Agent) unloadMetadata() {
|
||||
a.state.Lock()
|
||||
|
@ -2235,3 +2243,65 @@ func (a *Agent) getEndpoint(endpoint string) string {
|
|||
}
|
||||
return endpoint
|
||||
}
|
||||
|
||||
func (a *Agent) ReloadConfig(newCfg *Config) (bool, error) {
|
||||
var errs error
|
||||
|
||||
// Bulk update the services and checks
|
||||
a.PauseSync()
|
||||
defer a.ResumeSync()
|
||||
|
||||
// Snapshot the current state, and restore it afterwards
|
||||
snap := a.snapshotCheckState()
|
||||
defer a.restoreCheckState(snap)
|
||||
|
||||
// First unload all checks, services, and metadata. This lets us begin the reload
|
||||
// with a clean slate.
|
||||
if err := a.unloadServices(); err != nil {
|
||||
errs = multierror.Append(errs, fmt.Errorf("Failed unloading services: %s", err))
|
||||
return false, errs
|
||||
}
|
||||
if err := a.unloadChecks(); err != nil {
|
||||
errs = multierror.Append(errs, fmt.Errorf("Failed unloading checks: %s", err))
|
||||
return false, errs
|
||||
}
|
||||
a.unloadMetadata()
|
||||
|
||||
// Reload service/check definitions and metadata.
|
||||
if err := a.loadServices(newCfg); err != nil {
|
||||
errs = multierror.Append(errs, fmt.Errorf("Failed reloading services: %s", err))
|
||||
return false, errs
|
||||
}
|
||||
if err := a.loadChecks(newCfg); err != nil {
|
||||
errs = multierror.Append(errs, fmt.Errorf("Failed reloading checks: %s", err))
|
||||
return false, errs
|
||||
}
|
||||
if err := a.loadMetadata(newCfg); err != nil {
|
||||
errs = multierror.Append(errs, fmt.Errorf("Failed reloading metadata: %s", err))
|
||||
return false, errs
|
||||
}
|
||||
|
||||
// Get the new client listener addr
|
||||
httpAddr, err := newCfg.ClientListener(a.config.Addresses.HTTP, a.config.Ports.HTTP)
|
||||
if err != nil {
|
||||
errs = multierror.Append(errs, fmt.Errorf("Failed to determine HTTP address: %v", err))
|
||||
}
|
||||
|
||||
// Deregister the old watches
|
||||
for _, wp := range a.config.WatchPlans {
|
||||
wp.Stop()
|
||||
}
|
||||
|
||||
// Register the new watches
|
||||
for _, wp := range newCfg.WatchPlans {
|
||||
go func(wp *watch.Plan) {
|
||||
wp.Handler = makeWatchHandler(a.LogOutput, wp.Exempt["handler"])
|
||||
wp.LogOutput = a.LogOutput
|
||||
if err := wp.Run(httpAddr.String()); err != nil {
|
||||
errs = multierror.Append(errs, fmt.Errorf("Error running watch: %v", err))
|
||||
}
|
||||
}(wp)
|
||||
}
|
||||
|
||||
return true, errs
|
||||
}
|
||||
|
|
|
@ -17,7 +17,6 @@ import (
|
|||
"github.com/armon/go-metrics/circonus"
|
||||
"github.com/armon/go-metrics/datadog"
|
||||
"github.com/hashicorp/consul/command/base"
|
||||
"github.com/hashicorp/consul/consul"
|
||||
"github.com/hashicorp/consul/consul/structs"
|
||||
"github.com/hashicorp/consul/ipaddr"
|
||||
"github.com/hashicorp/consul/lib"
|
||||
|
@ -29,9 +28,6 @@ import (
|
|||
"github.com/mitchellh/cli"
|
||||
)
|
||||
|
||||
// gracefulTimeout controls how long we wait before forcefully terminating
|
||||
var gracefulTimeout = 5 * time.Second
|
||||
|
||||
// validDatacenter is used to validate a datacenter
|
||||
var validDatacenter = regexp.MustCompile("^[a-zA-Z0-9_-]+$")
|
||||
|
||||
|
@ -49,7 +45,6 @@ type Command struct {
|
|||
args []string
|
||||
logFilter *logutils.LevelFilter
|
||||
logOutput io.Writer
|
||||
agent *Agent
|
||||
}
|
||||
|
||||
// readConfig is responsible for setup of our configuration using
|
||||
|
@ -216,7 +211,7 @@ func (cmd *Command) readConfig() *Config {
|
|||
if len(nodeMeta) > 0 {
|
||||
cmdCfg.Meta = make(map[string]string)
|
||||
for _, entry := range nodeMeta {
|
||||
key, value := parseMetaPair(entry)
|
||||
key, value := ParseMetaPair(entry)
|
||||
cmdCfg.Meta[key] = value
|
||||
}
|
||||
}
|
||||
|
@ -470,14 +465,37 @@ func (cmd *Command) checkpointResults(results *checkpoint.CheckResponse, err err
|
|||
}
|
||||
}
|
||||
|
||||
func (cmd *Command) startupUpdateCheck(config *Config) {
|
||||
version := config.Version
|
||||
if config.VersionPrerelease != "" {
|
||||
version += fmt.Sprintf("-%s", config.VersionPrerelease)
|
||||
}
|
||||
updateParams := &checkpoint.CheckParams{
|
||||
Product: "consul",
|
||||
Version: version,
|
||||
}
|
||||
if !config.DisableAnonymousSignature {
|
||||
updateParams.SignatureFile = filepath.Join(config.DataDir, "checkpoint-signature")
|
||||
}
|
||||
|
||||
// Schedule a periodic check with expected interval of 24 hours
|
||||
checkpoint.CheckInterval(updateParams, 24*time.Hour, cmd.checkpointResults)
|
||||
|
||||
// Do an immediate check within the next 30 seconds
|
||||
go func() {
|
||||
time.Sleep(lib.RandomStagger(30 * time.Second))
|
||||
cmd.checkpointResults(checkpoint.Check(updateParams))
|
||||
}()
|
||||
}
|
||||
|
||||
// startupJoin is invoked to handle any joins specified to take place at start time
|
||||
func (cmd *Command) startupJoin(cfg *Config) error {
|
||||
func (cmd *Command) startupJoin(agent *Agent, cfg *Config) error {
|
||||
if len(cfg.StartJoin) == 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
cmd.UI.Output("Joining cluster...")
|
||||
n, err := cmd.agent.JoinLAN(cfg.StartJoin)
|
||||
n, err := agent.JoinLAN(cfg.StartJoin)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -487,13 +505,13 @@ func (cmd *Command) startupJoin(cfg *Config) error {
|
|||
}
|
||||
|
||||
// startupJoinWan is invoked to handle any joins -wan specified to take place at start time
|
||||
func (cmd *Command) startupJoinWan(cfg *Config) error {
|
||||
func (cmd *Command) startupJoinWan(agent *Agent, cfg *Config) error {
|
||||
if len(cfg.StartJoinWan) == 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
cmd.UI.Output("Joining -wan cluster...")
|
||||
n, err := cmd.agent.JoinWAN(cfg.StartJoinWan)
|
||||
n, err := agent.JoinWAN(cfg.StartJoinWan)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -502,116 +520,147 @@ func (cmd *Command) startupJoinWan(cfg *Config) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// retryJoin is used to handle retrying a join until it succeeds or all
|
||||
// retries are exhausted.
|
||||
func (cmd *Command) retryJoin(cfg *Config, errCh chan<- struct{}) {
|
||||
ec2Enabled := cfg.RetryJoinEC2.TagKey != "" && cfg.RetryJoinEC2.TagValue != ""
|
||||
gceEnabled := cfg.RetryJoinGCE.TagValue != ""
|
||||
azureEnabled := cfg.RetryJoinAzure.TagName != "" && cfg.RetryJoinAzure.TagValue != ""
|
||||
|
||||
if len(cfg.RetryJoin) == 0 && !ec2Enabled && !gceEnabled && !azureEnabled {
|
||||
return
|
||||
func statsiteSink(config *Config, hostname string) (metrics.MetricSink, error) {
|
||||
if config.Telemetry.StatsiteAddr == "" {
|
||||
return nil, nil
|
||||
}
|
||||
return metrics.NewStatsiteSink(config.Telemetry.StatsiteAddr)
|
||||
}
|
||||
|
||||
logger := cmd.agent.logger
|
||||
logger.Printf("[INFO] agent: Joining cluster...")
|
||||
func statsdSink(config *Config, hostname string) (metrics.MetricSink, error) {
|
||||
if config.Telemetry.StatsdAddr == "" {
|
||||
return nil, nil
|
||||
}
|
||||
return metrics.NewStatsdSink(config.Telemetry.StatsdAddr)
|
||||
}
|
||||
|
||||
attempt := 0
|
||||
for {
|
||||
var servers []string
|
||||
var err error
|
||||
switch {
|
||||
case ec2Enabled:
|
||||
servers, err = cfg.discoverEc2Hosts(logger)
|
||||
func dogstatdSink(config *Config, hostname string) (metrics.MetricSink, error) {
|
||||
if config.Telemetry.DogStatsdAddr == "" {
|
||||
return nil, nil
|
||||
}
|
||||
sink, err := datadog.NewDogStatsdSink(config.Telemetry.DogStatsdAddr, hostname)
|
||||
if err != nil {
|
||||
logger.Printf("[ERROR] agent: Unable to query EC2 instances: %s", err)
|
||||
return nil, err
|
||||
}
|
||||
logger.Printf("[INFO] agent: Discovered %d servers from EC2", len(servers))
|
||||
case gceEnabled:
|
||||
servers, err = cfg.discoverGCEHosts(logger)
|
||||
if err != nil {
|
||||
logger.Printf("[ERROR] agent: Unable to query GCE instances: %s", err)
|
||||
}
|
||||
logger.Printf("[INFO] agent: Discovered %d servers from GCE", len(servers))
|
||||
case azureEnabled:
|
||||
servers, err = cfg.discoverAzureHosts(logger)
|
||||
if err != nil {
|
||||
logger.Printf("[ERROR] agent: Unable to query Azure instances: %s", err)
|
||||
}
|
||||
logger.Printf("[INFO] agent: Discovered %d servers from Azure", len(servers))
|
||||
sink.SetTags(config.Telemetry.DogStatsdTags)
|
||||
return sink, nil
|
||||
}
|
||||
|
||||
servers = append(servers, cfg.RetryJoin...)
|
||||
if len(servers) == 0 {
|
||||
err = fmt.Errorf("No servers to join")
|
||||
func circonusSink(config *Config, hostname string) (metrics.MetricSink, error) {
|
||||
if config.Telemetry.CirconusAPIToken == "" && config.Telemetry.CirconusCheckSubmissionURL == "" {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
cfg := &circonus.Config{}
|
||||
cfg.Interval = config.Telemetry.CirconusSubmissionInterval
|
||||
cfg.CheckManager.API.TokenKey = config.Telemetry.CirconusAPIToken
|
||||
cfg.CheckManager.API.TokenApp = config.Telemetry.CirconusAPIApp
|
||||
cfg.CheckManager.API.URL = config.Telemetry.CirconusAPIURL
|
||||
cfg.CheckManager.Check.SubmissionURL = config.Telemetry.CirconusCheckSubmissionURL
|
||||
cfg.CheckManager.Check.ID = config.Telemetry.CirconusCheckID
|
||||
cfg.CheckManager.Check.ForceMetricActivation = config.Telemetry.CirconusCheckForceMetricActivation
|
||||
cfg.CheckManager.Check.InstanceID = config.Telemetry.CirconusCheckInstanceID
|
||||
cfg.CheckManager.Check.SearchTag = config.Telemetry.CirconusCheckSearchTag
|
||||
cfg.CheckManager.Check.DisplayName = config.Telemetry.CirconusCheckDisplayName
|
||||
cfg.CheckManager.Check.Tags = config.Telemetry.CirconusCheckTags
|
||||
cfg.CheckManager.Broker.ID = config.Telemetry.CirconusBrokerID
|
||||
cfg.CheckManager.Broker.SelectTag = config.Telemetry.CirconusBrokerSelectTag
|
||||
|
||||
if cfg.CheckManager.Check.DisplayName == "" {
|
||||
cfg.CheckManager.Check.DisplayName = "Consul"
|
||||
}
|
||||
|
||||
if cfg.CheckManager.API.TokenApp == "" {
|
||||
cfg.CheckManager.API.TokenApp = "consul"
|
||||
}
|
||||
|
||||
if cfg.CheckManager.Check.SearchTag == "" {
|
||||
cfg.CheckManager.Check.SearchTag = "service:consul"
|
||||
}
|
||||
|
||||
sink, err := circonus.NewCirconusSink(cfg)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
sink.Start()
|
||||
return sink, nil
|
||||
}
|
||||
|
||||
func startupTelemetry(config *Config) error {
|
||||
// Setup telemetry
|
||||
// Aggregate on 10 second intervals for 1 minute. Expose the
|
||||
// metrics over stderr when there is a SIGUSR1 received.
|
||||
memSink := metrics.NewInmemSink(10*time.Second, time.Minute)
|
||||
metrics.DefaultInmemSignal(memSink)
|
||||
metricsConf := metrics.DefaultConfig(config.Telemetry.StatsitePrefix)
|
||||
metricsConf.EnableHostname = !config.Telemetry.DisableHostname
|
||||
|
||||
var sinks metrics.FanoutSink
|
||||
addSink := func(name string, fn func(*Config, string) (metrics.MetricSink, error)) error {
|
||||
s, err := fn(config, metricsConf.HostName)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if s != nil {
|
||||
sinks = append(sinks, s)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
if err := addSink("statsite", statsiteSink); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := addSink("statsd", statsdSink); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := addSink("dogstatd", dogstatdSink); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := addSink("circonus", circonusSink); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if len(sinks) > 0 {
|
||||
sinks = append(sinks, memSink)
|
||||
metrics.NewGlobal(metricsConf, sinks)
|
||||
} else {
|
||||
n, err := cmd.agent.JoinLAN(servers)
|
||||
if err == nil {
|
||||
logger.Printf("[INFO] agent: Join completed. Synced with %d initial agents", n)
|
||||
return
|
||||
metricsConf.EnableHostname = false
|
||||
metrics.NewGlobal(metricsConf, memSink)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
attempt++
|
||||
if cfg.RetryMaxAttempts > 0 && attempt > cfg.RetryMaxAttempts {
|
||||
logger.Printf("[ERROR] agent: max join retry exhausted, exiting")
|
||||
close(errCh)
|
||||
return
|
||||
func (cmd *Command) registerWatches(config *Config) error {
|
||||
var err error
|
||||
|
||||
var httpAddr net.Addr
|
||||
if config.Ports.HTTP != -1 {
|
||||
httpAddr, err = config.ClientListener(config.Addresses.HTTP, config.Ports.HTTP)
|
||||
} else if config.Ports.HTTPS != -1 {
|
||||
httpAddr, err = config.ClientListener(config.Addresses.HTTPS, config.Ports.HTTPS)
|
||||
} else if len(config.WatchPlans) > 0 {
|
||||
return fmt.Errorf("Error: cannot use watches if both HTTP and HTTPS are disabled")
|
||||
}
|
||||
if err != nil {
|
||||
cmd.UI.Error(fmt.Sprintf("Failed to determine HTTP address: %v", err))
|
||||
}
|
||||
|
||||
logger.Printf("[WARN] agent: Join failed: %v, retrying in %v", err,
|
||||
cfg.RetryInterval)
|
||||
time.Sleep(cfg.RetryInterval)
|
||||
// Register the watches
|
||||
for _, wp := range config.WatchPlans {
|
||||
go func(wp *watch.Plan) {
|
||||
wp.Handler = makeWatchHandler(cmd.logOutput, wp.Exempt["handler"])
|
||||
wp.LogOutput = cmd.logOutput
|
||||
addr := httpAddr.String()
|
||||
// If it's a unix socket, prefix with unix:// so the client initializes correctly
|
||||
if httpAddr.Network() == "unix" {
|
||||
addr = "unix://" + addr
|
||||
}
|
||||
if err := wp.Run(addr); err != nil {
|
||||
cmd.UI.Error(fmt.Sprintf("Error running watch: %v", err))
|
||||
}
|
||||
|
||||
// retryJoinWan is used to handle retrying a join -wan until it succeeds or all
|
||||
// retries are exhausted.
|
||||
func (cmd *Command) retryJoinWan(cfg *Config, errCh chan<- struct{}) {
|
||||
if len(cfg.RetryJoinWan) == 0 {
|
||||
return
|
||||
}(wp)
|
||||
}
|
||||
|
||||
logger := cmd.agent.logger
|
||||
logger.Printf("[INFO] agent: Joining WAN cluster...")
|
||||
|
||||
attempt := 0
|
||||
for {
|
||||
n, err := cmd.agent.JoinWAN(cfg.RetryJoinWan)
|
||||
if err == nil {
|
||||
logger.Printf("[INFO] agent: Join -wan completed. Synced with %d initial agents", n)
|
||||
return
|
||||
}
|
||||
|
||||
attempt++
|
||||
if cfg.RetryMaxAttemptsWan > 0 && attempt > cfg.RetryMaxAttemptsWan {
|
||||
logger.Printf("[ERROR] agent: max join -wan retry exhausted, exiting")
|
||||
close(errCh)
|
||||
return
|
||||
}
|
||||
|
||||
logger.Printf("[WARN] agent: Join -wan failed: %v, retrying in %v", err,
|
||||
cfg.RetryIntervalWan)
|
||||
time.Sleep(cfg.RetryIntervalWan)
|
||||
}
|
||||
}
|
||||
|
||||
// gossipEncrypted determines if the consul instance is using symmetric
|
||||
// encryption keys to protect gossip protocol messages.
|
||||
func (cmd *Command) gossipEncrypted() bool {
|
||||
if cmd.agent.config.EncryptKey != "" {
|
||||
return true
|
||||
}
|
||||
|
||||
server, ok := cmd.agent.delegate.(*consul.Server)
|
||||
if ok {
|
||||
return server.KeyManagerLAN() != nil || server.KeyManagerWAN() != nil
|
||||
}
|
||||
client, ok := cmd.agent.delegate.(*consul.Client)
|
||||
if ok {
|
||||
return client != nil && client.KeyManagerLAN() != nil
|
||||
}
|
||||
panic(fmt.Sprintf("delegate is neither server nor client: %T", cmd.agent.delegate))
|
||||
return nil
|
||||
}
|
||||
|
||||
func (cmd *Command) Run(args []string) int {
|
||||
|
@ -642,97 +691,10 @@ func (cmd *Command) Run(args []string) int {
|
|||
cmd.logFilter = logFilter
|
||||
cmd.logOutput = logOutput
|
||||
|
||||
// Setup telemetry
|
||||
// Aggregate on 10 second intervals for 1 minute. Expose the
|
||||
// metrics over stderr when there is a SIGUSR1 received.
|
||||
inm := metrics.NewInmemSink(10*time.Second, time.Minute)
|
||||
metrics.DefaultInmemSignal(inm)
|
||||
metricsConf := metrics.DefaultConfig(config.Telemetry.StatsitePrefix)
|
||||
metricsConf.EnableHostname = !config.Telemetry.DisableHostname
|
||||
|
||||
// Configure the statsite sink
|
||||
var fanout metrics.FanoutSink
|
||||
if config.Telemetry.StatsiteAddr != "" {
|
||||
sink, err := metrics.NewStatsiteSink(config.Telemetry.StatsiteAddr)
|
||||
if err != nil {
|
||||
cmd.UI.Error(fmt.Sprintf("Failed to start statsite sink. Got: %s", err))
|
||||
if err := startupTelemetry(config); err != nil {
|
||||
cmd.UI.Error(err.Error())
|
||||
return 1
|
||||
}
|
||||
fanout = append(fanout, sink)
|
||||
}
|
||||
|
||||
// Configure the statsd sink
|
||||
if config.Telemetry.StatsdAddr != "" {
|
||||
sink, err := metrics.NewStatsdSink(config.Telemetry.StatsdAddr)
|
||||
if err != nil {
|
||||
cmd.UI.Error(fmt.Sprintf("Failed to start statsd sink. Got: %s", err))
|
||||
return 1
|
||||
}
|
||||
fanout = append(fanout, sink)
|
||||
}
|
||||
|
||||
// Configure the DogStatsd sink
|
||||
if config.Telemetry.DogStatsdAddr != "" {
|
||||
var tags []string
|
||||
|
||||
if config.Telemetry.DogStatsdTags != nil {
|
||||
tags = config.Telemetry.DogStatsdTags
|
||||
}
|
||||
|
||||
sink, err := datadog.NewDogStatsdSink(config.Telemetry.DogStatsdAddr, metricsConf.HostName)
|
||||
if err != nil {
|
||||
cmd.UI.Error(fmt.Sprintf("Failed to start DogStatsd sink. Got: %s", err))
|
||||
return 1
|
||||
}
|
||||
sink.SetTags(tags)
|
||||
fanout = append(fanout, sink)
|
||||
}
|
||||
|
||||
if config.Telemetry.CirconusAPIToken != "" || config.Telemetry.CirconusCheckSubmissionURL != "" {
|
||||
cfg := &circonus.Config{}
|
||||
cfg.Interval = config.Telemetry.CirconusSubmissionInterval
|
||||
cfg.CheckManager.API.TokenKey = config.Telemetry.CirconusAPIToken
|
||||
cfg.CheckManager.API.TokenApp = config.Telemetry.CirconusAPIApp
|
||||
cfg.CheckManager.API.URL = config.Telemetry.CirconusAPIURL
|
||||
cfg.CheckManager.Check.SubmissionURL = config.Telemetry.CirconusCheckSubmissionURL
|
||||
cfg.CheckManager.Check.ID = config.Telemetry.CirconusCheckID
|
||||
cfg.CheckManager.Check.ForceMetricActivation = config.Telemetry.CirconusCheckForceMetricActivation
|
||||
cfg.CheckManager.Check.InstanceID = config.Telemetry.CirconusCheckInstanceID
|
||||
cfg.CheckManager.Check.SearchTag = config.Telemetry.CirconusCheckSearchTag
|
||||
cfg.CheckManager.Check.DisplayName = config.Telemetry.CirconusCheckDisplayName
|
||||
cfg.CheckManager.Check.Tags = config.Telemetry.CirconusCheckTags
|
||||
cfg.CheckManager.Broker.ID = config.Telemetry.CirconusBrokerID
|
||||
cfg.CheckManager.Broker.SelectTag = config.Telemetry.CirconusBrokerSelectTag
|
||||
|
||||
if cfg.CheckManager.Check.DisplayName == "" {
|
||||
cfg.CheckManager.Check.DisplayName = "Consul"
|
||||
}
|
||||
|
||||
if cfg.CheckManager.API.TokenApp == "" {
|
||||
cfg.CheckManager.API.TokenApp = "consul"
|
||||
}
|
||||
|
||||
if cfg.CheckManager.Check.SearchTag == "" {
|
||||
cfg.CheckManager.Check.SearchTag = "service:consul"
|
||||
}
|
||||
|
||||
sink, err := circonus.NewCirconusSink(cfg)
|
||||
if err != nil {
|
||||
cmd.UI.Error(fmt.Sprintf("Failed to start Circonus sink. Got: %s", err))
|
||||
return 1
|
||||
}
|
||||
sink.Start()
|
||||
fanout = append(fanout, sink)
|
||||
}
|
||||
|
||||
// Initialize the global sink
|
||||
if len(fanout) > 0 {
|
||||
fanout = append(fanout, inm)
|
||||
metrics.NewGlobal(metricsConf, fanout)
|
||||
} else {
|
||||
metricsConf.EnableHostname = false
|
||||
metrics.NewGlobal(metricsConf, inm)
|
||||
}
|
||||
|
||||
// Create the agent
|
||||
cmd.UI.Output("Starting Consul agent...")
|
||||
|
@ -743,85 +705,34 @@ func (cmd *Command) Run(args []string) int {
|
|||
}
|
||||
agent.LogOutput = logOutput
|
||||
agent.LogWriter = logWriter
|
||||
|
||||
if err := agent.Start(); err != nil {
|
||||
cmd.UI.Error(fmt.Sprintf("Error starting agent: %s", err))
|
||||
return 1
|
||||
}
|
||||
cmd.agent = agent
|
||||
defer agent.Shutdown()
|
||||
|
||||
// Setup update checking
|
||||
if !config.DisableUpdateCheck {
|
||||
version := config.Version
|
||||
if config.VersionPrerelease != "" {
|
||||
version += fmt.Sprintf("-%s", config.VersionPrerelease)
|
||||
}
|
||||
updateParams := &checkpoint.CheckParams{
|
||||
Product: "consul",
|
||||
Version: version,
|
||||
}
|
||||
if !config.DisableAnonymousSignature {
|
||||
updateParams.SignatureFile = filepath.Join(config.DataDir, "checkpoint-signature")
|
||||
cmd.startupUpdateCheck(config)
|
||||
}
|
||||
|
||||
// Schedule a periodic check with expected interval of 24 hours
|
||||
checkpoint.CheckInterval(updateParams, 24*time.Hour, cmd.checkpointResults)
|
||||
|
||||
// Do an immediate check within the next 30 seconds
|
||||
go func() {
|
||||
time.Sleep(lib.RandomStagger(30 * time.Second))
|
||||
cmd.checkpointResults(checkpoint.Check(updateParams))
|
||||
}()
|
||||
}
|
||||
|
||||
defer cmd.agent.Shutdown()
|
||||
|
||||
// Join startup nodes if specified
|
||||
if err := cmd.startupJoin(config); err != nil {
|
||||
if err := cmd.startupJoin(agent, config); err != nil {
|
||||
cmd.UI.Error(err.Error())
|
||||
return 1
|
||||
}
|
||||
|
||||
// Join startup nodes if specified
|
||||
if err := cmd.startupJoinWan(config); err != nil {
|
||||
if err := cmd.startupJoinWan(agent, config); err != nil {
|
||||
cmd.UI.Error(err.Error())
|
||||
return 1
|
||||
}
|
||||
|
||||
// Get the new client http listener addr
|
||||
var httpAddr net.Addr
|
||||
if config.Ports.HTTP != -1 {
|
||||
httpAddr, err = config.ClientListener(config.Addresses.HTTP, config.Ports.HTTP)
|
||||
} else if config.Ports.HTTPS != -1 {
|
||||
httpAddr, err = config.ClientListener(config.Addresses.HTTPS, config.Ports.HTTPS)
|
||||
} else if len(config.WatchPlans) > 0 {
|
||||
cmd.UI.Error("Error: cannot use watches if both HTTP and HTTPS are disabled")
|
||||
if err := cmd.registerWatches(config); err != nil {
|
||||
cmd.UI.Error(err.Error())
|
||||
return 1
|
||||
}
|
||||
if err != nil {
|
||||
cmd.UI.Error(fmt.Sprintf("Failed to determine HTTP address: %v", err))
|
||||
}
|
||||
|
||||
// Register the watches
|
||||
for _, wp := range config.WatchPlans {
|
||||
go func(wp *watch.Plan) {
|
||||
wp.Handler = makeWatchHandler(logOutput, wp.Exempt["handler"])
|
||||
wp.LogOutput = cmd.logOutput
|
||||
addr := httpAddr.String()
|
||||
// If it's a unix socket, prefix with unix:// so the client initializes correctly
|
||||
if httpAddr.Network() == "unix" {
|
||||
addr = "unix://" + addr
|
||||
}
|
||||
if err := wp.Run(addr); err != nil {
|
||||
cmd.UI.Error(fmt.Sprintf("Error running watch: %v", err))
|
||||
}
|
||||
}(wp)
|
||||
}
|
||||
|
||||
// Figure out if gossip is encrypted
|
||||
gossipEncrypted := cmd.agent.delegate.Encrypted()
|
||||
|
||||
// Let the agent know we've finished registration
|
||||
cmd.agent.StartSync()
|
||||
agent.StartSync()
|
||||
|
||||
cmd.UI.Output("Consul agent running!")
|
||||
cmd.UI.Info(fmt.Sprintf(" Version: '%s'", cmd.HumanVersion))
|
||||
|
@ -834,64 +745,47 @@ func (cmd *Command) Run(args []string) int {
|
|||
cmd.UI.Info(fmt.Sprintf(" Cluster Addr: %v (LAN: %d, WAN: %d)", config.AdvertiseAddr,
|
||||
config.Ports.SerfLan, config.Ports.SerfWan))
|
||||
cmd.UI.Info(fmt.Sprintf("Gossip encrypt: %v, RPC-TLS: %v, TLS-Incoming: %v",
|
||||
gossipEncrypted, config.VerifyOutgoing, config.VerifyIncoming))
|
||||
agent.GossipEncrypted(), config.VerifyOutgoing, config.VerifyIncoming))
|
||||
|
||||
// Enable log streaming
|
||||
cmd.UI.Info("")
|
||||
cmd.UI.Output("Log data will now stream in as it occurs:\n")
|
||||
logGate.Flush()
|
||||
|
||||
// Start retry join process
|
||||
errCh := make(chan struct{})
|
||||
go cmd.retryJoin(config, errCh)
|
||||
|
||||
// Start retry -wan join process
|
||||
errWanCh := make(chan struct{})
|
||||
go cmd.retryJoinWan(config, errWanCh)
|
||||
|
||||
// Wait for exit
|
||||
return cmd.handleSignals(config, errCh, errWanCh)
|
||||
}
|
||||
|
||||
// handleSignals blocks until we get an exit-causing signal
|
||||
func (cmd *Command) handleSignals(cfg *Config, retryJoin <-chan struct{}, retryJoinWan <-chan struct{}) int {
|
||||
// wait for signal
|
||||
signalCh := make(chan os.Signal, 4)
|
||||
signal.Notify(signalCh, os.Interrupt, syscall.SIGTERM, syscall.SIGHUP)
|
||||
signal.Notify(signalCh, os.Interrupt, syscall.SIGTERM, syscall.SIGHUP, syscall.SIGPIPE)
|
||||
|
||||
// Wait for a signal
|
||||
WAIT:
|
||||
for {
|
||||
var sig os.Signal
|
||||
var reloadErrCh chan error
|
||||
select {
|
||||
case s := <-signalCh:
|
||||
sig = s
|
||||
case ch := <-cmd.agent.reloadCh:
|
||||
case ch := <-agent.ReloadCh():
|
||||
sig = syscall.SIGHUP
|
||||
reloadErrCh = ch
|
||||
case <-cmd.ShutdownCh:
|
||||
sig = os.Interrupt
|
||||
case <-retryJoin:
|
||||
case err := <-agent.RetryJoinCh():
|
||||
cmd.UI.Error(err.Error())
|
||||
return 1
|
||||
case <-retryJoinWan:
|
||||
return 1
|
||||
case <-cmd.agent.ShutdownCh():
|
||||
// Agent is already shutdown!
|
||||
case <-agent.ShutdownCh():
|
||||
// Agent is already down!
|
||||
return 0
|
||||
}
|
||||
|
||||
// Skip SIGPIPE signals and skip logging whenever such signal is received as well
|
||||
if sig == syscall.SIGPIPE {
|
||||
goto WAIT
|
||||
}
|
||||
switch sig {
|
||||
case syscall.SIGPIPE:
|
||||
continue
|
||||
|
||||
case syscall.SIGHUP:
|
||||
cmd.UI.Output(fmt.Sprintf("Caught signal: %v", sig))
|
||||
|
||||
// Check if this is a SIGHUP
|
||||
if sig == syscall.SIGHUP {
|
||||
conf, err := cmd.handleReload(cfg)
|
||||
conf, err := cmd.handleReload(agent, config)
|
||||
if conf != nil {
|
||||
cfg = conf
|
||||
config = conf
|
||||
}
|
||||
if err != nil {
|
||||
cmd.UI.Error(err.Error())
|
||||
|
@ -900,34 +794,26 @@ WAIT:
|
|||
if reloadErrCh != nil {
|
||||
reloadErrCh <- err
|
||||
}
|
||||
goto WAIT
|
||||
}
|
||||
|
||||
// Check if we should do a graceful leave
|
||||
graceful := false
|
||||
if sig == os.Interrupt && !(*cfg.SkipLeaveOnInt) {
|
||||
graceful = true
|
||||
} else if sig == syscall.SIGTERM && (*cfg.LeaveOnTerm) {
|
||||
graceful = true
|
||||
}
|
||||
default:
|
||||
cmd.UI.Output(fmt.Sprintf("Caught signal: %v", sig))
|
||||
|
||||
// Bail fast if not doing a graceful leave
|
||||
graceful := (sig == os.Interrupt && !(*config.SkipLeaveOnInt)) || (sig == syscall.SIGTERM && (*config.LeaveOnTerm))
|
||||
if !graceful {
|
||||
return 1
|
||||
}
|
||||
|
||||
// Attempt a graceful leave
|
||||
gracefulCh := make(chan struct{})
|
||||
cmd.UI.Output("Gracefully shutting down agent...")
|
||||
gracefulCh := make(chan struct{})
|
||||
go func() {
|
||||
if err := cmd.agent.Leave(); err != nil {
|
||||
if err := agent.Leave(); err != nil {
|
||||
cmd.UI.Error(fmt.Sprintf("Error: %s", err))
|
||||
return
|
||||
}
|
||||
close(gracefulCh)
|
||||
}()
|
||||
|
||||
// Wait for leave or another signal
|
||||
gracefulTimeout := 5 * time.Second
|
||||
select {
|
||||
case <-signalCh:
|
||||
return 1
|
||||
|
@ -937,19 +823,21 @@ WAIT:
|
|||
return 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// handleReload is invoked when we should reload our configs, e.g. SIGHUP
|
||||
func (cmd *Command) handleReload(cfg *Config) (*Config, error) {
|
||||
func (cmd *Command) handleReload(agent *Agent, cfg *Config) (*Config, error) {
|
||||
cmd.UI.Output("Reloading configuration...")
|
||||
var errs error
|
||||
newConf := cmd.readConfig()
|
||||
if newConf == nil {
|
||||
newCfg := cmd.readConfig()
|
||||
if newCfg == nil {
|
||||
errs = multierror.Append(errs, fmt.Errorf("Failed to reload configs"))
|
||||
return cfg, errs
|
||||
}
|
||||
|
||||
// Change the log level
|
||||
minLevel := logutils.LogLevel(strings.ToUpper(newConf.LogLevel))
|
||||
minLevel := logutils.LogLevel(strings.ToUpper(newCfg.LogLevel))
|
||||
if logger.ValidateLevelFilter(minLevel, cmd.logFilter) {
|
||||
cmd.logFilter.SetMinLevel(minLevel)
|
||||
} else {
|
||||
|
@ -958,66 +846,14 @@ func (cmd *Command) handleReload(cfg *Config) (*Config, error) {
|
|||
minLevel, cmd.logFilter.Levels))
|
||||
|
||||
// Keep the current log level
|
||||
newConf.LogLevel = cfg.LogLevel
|
||||
newCfg.LogLevel = cfg.LogLevel
|
||||
}
|
||||
|
||||
// Bulk update the services and checks
|
||||
cmd.agent.PauseSync()
|
||||
defer cmd.agent.ResumeSync()
|
||||
|
||||
// Snapshot the current state, and restore it afterwards
|
||||
snap := cmd.agent.snapshotCheckState()
|
||||
defer cmd.agent.restoreCheckState(snap)
|
||||
|
||||
// First unload all checks, services, and metadata. This lets us begin the reload
|
||||
// with a clean slate.
|
||||
if err := cmd.agent.unloadServices(); err != nil {
|
||||
errs = multierror.Append(errs, fmt.Errorf("Failed unloading services: %s", err))
|
||||
return nil, errs
|
||||
ok, errs := agent.ReloadConfig(newCfg)
|
||||
if ok {
|
||||
return newCfg, errs
|
||||
}
|
||||
if err := cmd.agent.unloadChecks(); err != nil {
|
||||
errs = multierror.Append(errs, fmt.Errorf("Failed unloading checks: %s", err))
|
||||
return nil, errs
|
||||
}
|
||||
cmd.agent.unloadMetadata()
|
||||
|
||||
// Reload service/check definitions and metadata.
|
||||
if err := cmd.agent.loadServices(newConf); err != nil {
|
||||
errs = multierror.Append(errs, fmt.Errorf("Failed reloading services: %s", err))
|
||||
return nil, errs
|
||||
}
|
||||
if err := cmd.agent.loadChecks(newConf); err != nil {
|
||||
errs = multierror.Append(errs, fmt.Errorf("Failed reloading checks: %s", err))
|
||||
return nil, errs
|
||||
}
|
||||
if err := cmd.agent.loadMetadata(newConf); err != nil {
|
||||
errs = multierror.Append(errs, fmt.Errorf("Failed reloading metadata: %s", err))
|
||||
return nil, errs
|
||||
}
|
||||
|
||||
// Get the new client listener addr
|
||||
httpAddr, err := newConf.ClientListener(cfg.Addresses.HTTP, cfg.Ports.HTTP)
|
||||
if err != nil {
|
||||
errs = multierror.Append(errs, fmt.Errorf("Failed to determine HTTP address: %v", err))
|
||||
}
|
||||
|
||||
// Deregister the old watches
|
||||
for _, wp := range cfg.WatchPlans {
|
||||
wp.Stop()
|
||||
}
|
||||
|
||||
// Register the new watches
|
||||
for _, wp := range newConf.WatchPlans {
|
||||
go func(wp *watch.Plan) {
|
||||
wp.Handler = makeWatchHandler(cmd.logOutput, wp.Exempt["handler"])
|
||||
wp.LogOutput = cmd.logOutput
|
||||
if err := wp.Run(httpAddr.String()); err != nil {
|
||||
errs = multierror.Append(errs, fmt.Errorf("Error running watch: %v", err))
|
||||
}
|
||||
}(wp)
|
||||
}
|
||||
|
||||
return newConf, errs
|
||||
return cfg, errs
|
||||
}
|
||||
|
||||
func (cmd *Command) Synopsis() string {
|
||||
|
|
|
@ -2079,3 +2079,12 @@ func (d dirEnts) Less(i, j int) bool {
|
|||
func (d dirEnts) Swap(i, j int) {
|
||||
d[i], d[j] = d[j], d[i]
|
||||
}
|
||||
|
||||
// ParseMetaPair parses a key/value pair of the form key:value
|
||||
func ParseMetaPair(raw string) (string, string) {
|
||||
pair := strings.SplitN(raw, ":", 2)
|
||||
if len(pair) == 2 {
|
||||
return pair[0], pair[1]
|
||||
}
|
||||
return pair[0], ""
|
||||
}
|
||||
|
|
|
@ -420,7 +420,7 @@ func (s *HTTPServer) parseMetaFilter(req *http.Request) map[string]string {
|
|||
if filterList, ok := req.URL.Query()["node-meta"]; ok {
|
||||
filters := make(map[string]string)
|
||||
for _, filter := range filterList {
|
||||
key, value := parseMetaPair(filter)
|
||||
key, value := ParseMetaPair(filter)
|
||||
filters[key] = value
|
||||
}
|
||||
return filters
|
||||
|
|
|
@ -0,0 +1,97 @@
|
|||
package agent
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"time"
|
||||
)
|
||||
|
||||
// RetryJoin is used to handle retrying a join until it succeeds or all
|
||||
// retries are exhausted.
|
||||
func (a *Agent) retryJoin() {
|
||||
cfg := a.config
|
||||
|
||||
ec2Enabled := cfg.RetryJoinEC2.TagKey != "" && cfg.RetryJoinEC2.TagValue != ""
|
||||
gceEnabled := cfg.RetryJoinGCE.TagValue != ""
|
||||
azureEnabled := cfg.RetryJoinAzure.TagName != "" && cfg.RetryJoinAzure.TagValue != ""
|
||||
|
||||
if len(cfg.RetryJoin) == 0 && !ec2Enabled && !gceEnabled && !azureEnabled {
|
||||
return
|
||||
}
|
||||
|
||||
a.logger.Printf("[INFO] agent: Joining cluster...")
|
||||
attempt := 0
|
||||
for {
|
||||
var servers []string
|
||||
var err error
|
||||
switch {
|
||||
case ec2Enabled:
|
||||
servers, err = cfg.discoverEc2Hosts(a.logger)
|
||||
if err != nil {
|
||||
a.logger.Printf("[ERROR] agent: Unable to query EC2 instances: %s", err)
|
||||
}
|
||||
a.logger.Printf("[INFO] agent: Discovered %d servers from EC2", len(servers))
|
||||
case gceEnabled:
|
||||
servers, err = cfg.discoverGCEHosts(a.logger)
|
||||
if err != nil {
|
||||
a.logger.Printf("[ERROR] agent: Unable to query GCE instances: %s", err)
|
||||
}
|
||||
a.logger.Printf("[INFO] agent: Discovered %d servers from GCE", len(servers))
|
||||
case azureEnabled:
|
||||
servers, err = cfg.discoverAzureHosts(a.logger)
|
||||
if err != nil {
|
||||
a.logger.Printf("[ERROR] agent: Unable to query Azure instances: %s", err)
|
||||
}
|
||||
a.logger.Printf("[INFO] agent: Discovered %d servers from Azure", len(servers))
|
||||
}
|
||||
|
||||
servers = append(servers, cfg.RetryJoin...)
|
||||
if len(servers) == 0 {
|
||||
err = fmt.Errorf("No servers to join")
|
||||
} else {
|
||||
n, err := a.JoinLAN(servers)
|
||||
if err == nil {
|
||||
a.logger.Printf("[INFO] agent: Join completed. Synced with %d initial agents", n)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
attempt++
|
||||
if cfg.RetryMaxAttempts > 0 && attempt > cfg.RetryMaxAttempts {
|
||||
a.retryJoinCh <- fmt.Errorf("agent: max join retry exhausted, exiting")
|
||||
return
|
||||
}
|
||||
|
||||
a.logger.Printf("[WARN] agent: Join failed: %v, retrying in %v", err, cfg.RetryInterval)
|
||||
time.Sleep(cfg.RetryInterval)
|
||||
}
|
||||
}
|
||||
|
||||
// RetryJoinWan is used to handle retrying a join -wan until it succeeds or all
|
||||
// retries are exhausted.
|
||||
func (a *Agent) retryJoinWan() {
|
||||
cfg := a.config
|
||||
|
||||
if len(cfg.RetryJoinWan) == 0 {
|
||||
return
|
||||
}
|
||||
|
||||
a.logger.Printf("[INFO] agent: Joining WAN cluster...")
|
||||
|
||||
attempt := 0
|
||||
for {
|
||||
n, err := a.JoinWAN(cfg.RetryJoinWan)
|
||||
if err == nil {
|
||||
a.logger.Printf("[INFO] agent: Join -wan completed. Synced with %d initial agents", n)
|
||||
return
|
||||
}
|
||||
|
||||
attempt++
|
||||
if cfg.RetryMaxAttemptsWan > 0 && attempt > cfg.RetryMaxAttemptsWan {
|
||||
a.retryJoinCh <- fmt.Errorf("agent: max join -wan retry exhausted, exiting")
|
||||
return
|
||||
}
|
||||
|
||||
a.logger.Printf("[WARN] agent: Join -wan failed: %v, retrying in %v", err, cfg.RetryIntervalWan)
|
||||
time.Sleep(cfg.RetryIntervalWan)
|
||||
}
|
||||
}
|
|
@ -120,11 +120,9 @@ func (a *TestAgent) Start() *TestAgent {
|
|||
}
|
||||
id := UniqueID()
|
||||
|
||||
// since the ports are written into the data files we pick random ports
|
||||
// only once and try a number of times to start with them.
|
||||
for i := 10; i >= 0; i-- {
|
||||
pickRandomPorts(a.Config)
|
||||
|
||||
for i := 10; i >= 0; i-- {
|
||||
// write the keyring
|
||||
if a.Key != "" {
|
||||
writeKey := func(key, filename string) {
|
||||
|
@ -163,6 +161,16 @@ func (a *TestAgent) Start() *TestAgent {
|
|||
fmt.Println(id, a.Name, "retrying in", wait)
|
||||
time.Sleep(wait)
|
||||
}
|
||||
|
||||
// Clean out the data dir if we are responsible for it before we
|
||||
// try again, since the old ports may have gotten written to
|
||||
// the data dir, such as in the Raft configuration.
|
||||
if a.DataDir != "" {
|
||||
if err := os.RemoveAll(a.DataDir); err != nil {
|
||||
fmt.Println(id, a.Name, "Error resetting data dir:", err)
|
||||
runtime.Goexit()
|
||||
}
|
||||
}
|
||||
}
|
||||
if !a.NoInitialSync {
|
||||
a.Agent.StartSync()
|
||||
|
|
|
@ -14,7 +14,6 @@ import (
|
|||
)
|
||||
|
||||
func TestACLEndpoint_Apply(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir1, s1 := testServerWithConfig(t, func(c *Config) {
|
||||
c.ACLDatacenter = "dc1"
|
||||
c.ACLMasterToken = "root"
|
||||
|
@ -75,7 +74,6 @@ func TestACLEndpoint_Apply(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestACLEndpoint_Update_PurgeCache(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir1, s1 := testServerWithConfig(t, func(c *Config) {
|
||||
c.ACLDatacenter = "dc1"
|
||||
c.ACLMasterToken = "root"
|
||||
|
@ -154,7 +152,6 @@ func TestACLEndpoint_Update_PurgeCache(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestACLEndpoint_Apply_CustomID(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir1, s1 := testServerWithConfig(t, func(c *Config) {
|
||||
c.ACLDatacenter = "dc1"
|
||||
c.ACLMasterToken = "root"
|
||||
|
@ -202,7 +199,6 @@ func TestACLEndpoint_Apply_CustomID(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestACLEndpoint_Apply_Denied(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir1, s1 := testServerWithConfig(t, func(c *Config) {
|
||||
c.ACLDatacenter = "dc1"
|
||||
})
|
||||
|
@ -229,7 +225,6 @@ func TestACLEndpoint_Apply_Denied(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestACLEndpoint_Apply_DeleteAnon(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir1, s1 := testServerWithConfig(t, func(c *Config) {
|
||||
c.ACLDatacenter = "dc1"
|
||||
c.ACLMasterToken = "root"
|
||||
|
@ -259,7 +254,6 @@ func TestACLEndpoint_Apply_DeleteAnon(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestACLEndpoint_Apply_RootChange(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir1, s1 := testServerWithConfig(t, func(c *Config) {
|
||||
c.ACLDatacenter = "dc1"
|
||||
c.ACLMasterToken = "root"
|
||||
|
@ -289,7 +283,6 @@ func TestACLEndpoint_Apply_RootChange(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestACLEndpoint_Get(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir1, s1 := testServerWithConfig(t, func(c *Config) {
|
||||
c.ACLDatacenter = "dc1"
|
||||
c.ACLMasterToken = "root"
|
||||
|
@ -337,7 +330,6 @@ func TestACLEndpoint_Get(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestACLEndpoint_GetPolicy(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir1, s1 := testServerWithConfig(t, func(c *Config) {
|
||||
c.ACLDatacenter = "dc1"
|
||||
c.ACLMasterToken = "root"
|
||||
|
@ -395,7 +387,6 @@ func TestACLEndpoint_GetPolicy(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestACLEndpoint_List(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir1, s1 := testServerWithConfig(t, func(c *Config) {
|
||||
c.ACLDatacenter = "dc1"
|
||||
c.ACLMasterToken = "root"
|
||||
|
@ -457,7 +448,6 @@ func TestACLEndpoint_List(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestACLEndpoint_List_Denied(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir1, s1 := testServerWithConfig(t, func(c *Config) {
|
||||
c.ACLDatacenter = "dc1"
|
||||
})
|
||||
|
@ -479,7 +469,6 @@ func TestACLEndpoint_List_Denied(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestACLEndpoint_ReplicationStatus(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir1, s1 := testServerWithConfig(t, func(c *Config) {
|
||||
c.ACLDatacenter = "dc2"
|
||||
c.ACLReplicationToken = "secret"
|
||||
|
|
|
@ -18,7 +18,6 @@ import (
|
|||
)
|
||||
|
||||
func TestCatalog_Register(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir1, s1 := testServer(t)
|
||||
defer os.RemoveAll(dir1)
|
||||
defer s1.Shutdown()
|
||||
|
@ -48,7 +47,6 @@ func TestCatalog_Register(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestCatalog_RegisterService_InvalidAddress(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir1, s1 := testServer(t)
|
||||
defer os.RemoveAll(dir1)
|
||||
defer s1.Shutdown()
|
||||
|
@ -78,7 +76,6 @@ func TestCatalog_RegisterService_InvalidAddress(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestCatalog_Register_NodeID(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir1, s1 := testServer(t)
|
||||
defer os.RemoveAll(dir1)
|
||||
defer s1.Shutdown()
|
||||
|
@ -114,7 +111,6 @@ func TestCatalog_Register_NodeID(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestCatalog_Register_ACLDeny(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir1, s1 := testServerWithConfig(t, func(c *Config) {
|
||||
c.ACLDatacenter = "dc1"
|
||||
c.ACLMasterToken = "root"
|
||||
|
@ -216,7 +212,6 @@ service "foo" {
|
|||
}
|
||||
|
||||
func TestCatalog_Register_ForwardLeader(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir1, s1 := testServer(t)
|
||||
defer os.RemoveAll(dir1)
|
||||
defer s1.Shutdown()
|
||||
|
@ -260,7 +255,6 @@ func TestCatalog_Register_ForwardLeader(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestCatalog_Register_ForwardDC(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir1, s1 := testServer(t)
|
||||
defer os.RemoveAll(dir1)
|
||||
defer s1.Shutdown()
|
||||
|
@ -293,7 +287,6 @@ func TestCatalog_Register_ForwardDC(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestCatalog_Deregister(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir1, s1 := testServer(t)
|
||||
defer os.RemoveAll(dir1)
|
||||
defer s1.Shutdown()
|
||||
|
@ -319,7 +312,6 @@ func TestCatalog_Deregister(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestCatalog_Deregister_ACLDeny(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir1, s1 := testServerWithConfig(t, func(c *Config) {
|
||||
c.ACLDatacenter = "dc1"
|
||||
c.ACLMasterToken = "root"
|
||||
|
@ -531,7 +523,6 @@ service "service" {
|
|||
}
|
||||
|
||||
func TestCatalog_ListDatacenters(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir1, s1 := testServer(t)
|
||||
defer os.RemoveAll(dir1)
|
||||
defer s1.Shutdown()
|
||||
|
@ -565,7 +556,6 @@ func TestCatalog_ListDatacenters(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestCatalog_ListDatacenters_DistanceSort(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir1, s1 := testServer(t)
|
||||
defer os.RemoveAll(dir1)
|
||||
defer s1.Shutdown()
|
||||
|
@ -604,7 +594,6 @@ func TestCatalog_ListDatacenters_DistanceSort(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestCatalog_ListNodes(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir1, s1 := testServer(t)
|
||||
defer os.RemoveAll(dir1)
|
||||
defer s1.Shutdown()
|
||||
|
@ -646,7 +635,6 @@ func TestCatalog_ListNodes(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestCatalog_ListNodes_NodeMetaFilter(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir1, s1 := testServer(t)
|
||||
defer os.RemoveAll(dir1)
|
||||
defer s1.Shutdown()
|
||||
|
@ -709,7 +697,6 @@ func TestCatalog_ListNodes_NodeMetaFilter(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestCatalog_ListNodes_StaleRaad(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir1, s1 := testServer(t)
|
||||
defer os.RemoveAll(dir1)
|
||||
defer s1.Shutdown()
|
||||
|
@ -774,7 +761,6 @@ func TestCatalog_ListNodes_StaleRaad(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestCatalog_ListNodes_ConsistentRead_Fail(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir1, s1 := testServer(t)
|
||||
defer os.RemoveAll(dir1)
|
||||
defer s1.Shutdown()
|
||||
|
@ -821,7 +807,6 @@ func TestCatalog_ListNodes_ConsistentRead_Fail(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestCatalog_ListNodes_ConsistentRead(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir1, s1 := testServer(t)
|
||||
defer os.RemoveAll(dir1)
|
||||
defer s1.Shutdown()
|
||||
|
@ -866,7 +851,6 @@ func TestCatalog_ListNodes_ConsistentRead(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestCatalog_ListNodes_DistanceSort(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir1, s1 := testServer(t)
|
||||
defer os.RemoveAll(dir1)
|
||||
defer s1.Shutdown()
|
||||
|
@ -957,7 +941,6 @@ func TestCatalog_ListNodes_DistanceSort(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestCatalog_ListNodes_ACLFilter(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir1, s1 := testServerWithConfig(t, func(c *Config) {
|
||||
c.ACLDatacenter = "dc1"
|
||||
c.ACLMasterToken = "root"
|
||||
|
@ -1058,7 +1041,6 @@ func Benchmark_Catalog_ListNodes(t *testing.B) {
|
|||
}
|
||||
|
||||
func TestCatalog_ListServices(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir1, s1 := testServer(t)
|
||||
defer os.RemoveAll(dir1)
|
||||
defer s1.Shutdown()
|
||||
|
@ -1109,7 +1091,6 @@ func TestCatalog_ListServices(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestCatalog_ListServices_NodeMetaFilter(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir1, s1 := testServer(t)
|
||||
defer os.RemoveAll(dir1)
|
||||
defer s1.Shutdown()
|
||||
|
@ -1173,7 +1154,6 @@ func TestCatalog_ListServices_NodeMetaFilter(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestCatalog_ListServices_Blocking(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir1, s1 := testServer(t)
|
||||
defer os.RemoveAll(dir1)
|
||||
defer s1.Shutdown()
|
||||
|
@ -1232,7 +1212,6 @@ func TestCatalog_ListServices_Blocking(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestCatalog_ListServices_Timeout(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir1, s1 := testServer(t)
|
||||
defer os.RemoveAll(dir1)
|
||||
defer s1.Shutdown()
|
||||
|
@ -1274,7 +1253,6 @@ func TestCatalog_ListServices_Timeout(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestCatalog_ListServices_Stale(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir1, s1 := testServer(t)
|
||||
defer os.RemoveAll(dir1)
|
||||
defer s1.Shutdown()
|
||||
|
@ -1312,7 +1290,6 @@ func TestCatalog_ListServices_Stale(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestCatalog_ListServiceNodes(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir1, s1 := testServer(t)
|
||||
defer os.RemoveAll(dir1)
|
||||
defer s1.Shutdown()
|
||||
|
@ -1362,7 +1339,6 @@ func TestCatalog_ListServiceNodes(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestCatalog_ListServiceNodes_NodeMetaFilter(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir1, s1 := testServer(t)
|
||||
defer os.RemoveAll(dir1)
|
||||
defer s1.Shutdown()
|
||||
|
@ -1463,7 +1439,6 @@ func TestCatalog_ListServiceNodes_NodeMetaFilter(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestCatalog_ListServiceNodes_DistanceSort(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir1, s1 := testServer(t)
|
||||
defer os.RemoveAll(dir1)
|
||||
defer s1.Shutdown()
|
||||
|
@ -1551,7 +1526,6 @@ func TestCatalog_ListServiceNodes_DistanceSort(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestCatalog_NodeServices(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir1, s1 := testServer(t)
|
||||
defer os.RemoveAll(dir1)
|
||||
defer s1.Shutdown()
|
||||
|
@ -1602,7 +1576,6 @@ func TestCatalog_NodeServices(t *testing.T) {
|
|||
|
||||
// Used to check for a regression against a known bug
|
||||
func TestCatalog_Register_FailedCase1(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir1, s1 := testServer(t)
|
||||
defer os.RemoveAll(dir1)
|
||||
defer s1.Shutdown()
|
||||
|
@ -1722,7 +1695,6 @@ service "foo" {
|
|||
}
|
||||
|
||||
func TestCatalog_ListServices_FilterACL(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir, token, srv, codec := testACLFilterServer(t)
|
||||
defer os.RemoveAll(dir)
|
||||
defer srv.Shutdown()
|
||||
|
@ -1745,7 +1717,6 @@ func TestCatalog_ListServices_FilterACL(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestCatalog_ServiceNodes_FilterACL(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir, token, srv, codec := testACLFilterServer(t)
|
||||
defer os.RemoveAll(dir)
|
||||
defer srv.Shutdown()
|
||||
|
@ -1795,7 +1766,6 @@ func TestCatalog_ServiceNodes_FilterACL(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestCatalog_NodeServices_ACLDeny(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir1, s1 := testServerWithConfig(t, func(c *Config) {
|
||||
c.ACLDatacenter = "dc1"
|
||||
c.ACLMasterToken = "root"
|
||||
|
@ -1871,7 +1841,6 @@ node "%s" {
|
|||
}
|
||||
|
||||
func TestCatalog_NodeServices_FilterACL(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir, token, srv, codec := testACLFilterServer(t)
|
||||
defer os.RemoveAll(dir)
|
||||
defer srv.Shutdown()
|
||||
|
|
|
@ -42,7 +42,6 @@ func verifyCoordinatesEqual(t *testing.T, a, b *coordinate.Coordinate) {
|
|||
}
|
||||
|
||||
func TestCoordinate_Update(t *testing.T) {
|
||||
t.Parallel()
|
||||
name := fmt.Sprintf("Node %d", getPort())
|
||||
dir1, config1 := testServerConfig(t, name)
|
||||
defer os.RemoveAll(dir1)
|
||||
|
@ -199,7 +198,6 @@ func TestCoordinate_Update(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestCoordinate_Update_ACLDeny(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir1, s1 := testServerWithConfig(t, func(c *Config) {
|
||||
c.ACLDatacenter = "dc1"
|
||||
c.ACLMasterToken = "root"
|
||||
|
@ -281,7 +279,6 @@ node "node1" {
|
|||
}
|
||||
|
||||
func TestCoordinate_ListDatacenters(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir1, s1 := testServer(t)
|
||||
defer os.RemoveAll(dir1)
|
||||
defer s1.Shutdown()
|
||||
|
@ -312,7 +309,6 @@ func TestCoordinate_ListDatacenters(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestCoordinate_ListNodes(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir1, s1 := testServer(t)
|
||||
defer os.RemoveAll(dir1)
|
||||
defer s1.Shutdown()
|
||||
|
@ -385,7 +381,6 @@ func TestCoordinate_ListNodes(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestCoordinate_ListNodes_ACLFilter(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir1, s1 := testServerWithConfig(t, func(c *Config) {
|
||||
c.ACLDatacenter = "dc1"
|
||||
c.ACLMasterToken = "root"
|
||||
|
|
|
@ -13,7 +13,6 @@ import (
|
|||
)
|
||||
|
||||
func TestHealth_ChecksInState(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir1, s1 := testServer(t)
|
||||
defer os.RemoveAll(dir1)
|
||||
defer s1.Shutdown()
|
||||
|
@ -60,7 +59,6 @@ func TestHealth_ChecksInState(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestHealth_ChecksInState_NodeMetaFilter(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir1, s1 := testServer(t)
|
||||
defer os.RemoveAll(dir1)
|
||||
defer s1.Shutdown()
|
||||
|
@ -156,7 +154,6 @@ func TestHealth_ChecksInState_NodeMetaFilter(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestHealth_ChecksInState_DistanceSort(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir1, s1 := testServer(t)
|
||||
defer os.RemoveAll(dir1)
|
||||
defer s1.Shutdown()
|
||||
|
@ -234,7 +231,6 @@ func TestHealth_ChecksInState_DistanceSort(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestHealth_NodeChecks(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir1, s1 := testServer(t)
|
||||
defer os.RemoveAll(dir1)
|
||||
defer s1.Shutdown()
|
||||
|
@ -276,7 +272,6 @@ func TestHealth_NodeChecks(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestHealth_ServiceChecks(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir1, s1 := testServer(t)
|
||||
defer os.RemoveAll(dir1)
|
||||
defer s1.Shutdown()
|
||||
|
@ -323,7 +318,6 @@ func TestHealth_ServiceChecks(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestHealth_ServiceChecks_NodeMetaFilter(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir1, s1 := testServer(t)
|
||||
defer os.RemoveAll(dir1)
|
||||
defer s1.Shutdown()
|
||||
|
@ -429,7 +423,6 @@ func TestHealth_ServiceChecks_NodeMetaFilter(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestHealth_ServiceChecks_DistanceSort(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir1, s1 := testServer(t)
|
||||
defer os.RemoveAll(dir1)
|
||||
defer s1.Shutdown()
|
||||
|
@ -518,7 +511,6 @@ func TestHealth_ServiceChecks_DistanceSort(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestHealth_ServiceNodes(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir1, s1 := testServer(t)
|
||||
defer os.RemoveAll(dir1)
|
||||
defer s1.Shutdown()
|
||||
|
@ -602,7 +594,6 @@ func TestHealth_ServiceNodes(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestHealth_ServiceNodes_NodeMetaFilter(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir1, s1 := testServer(t)
|
||||
defer os.RemoveAll(dir1)
|
||||
defer s1.Shutdown()
|
||||
|
@ -733,7 +724,6 @@ func TestHealth_ServiceNodes_NodeMetaFilter(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestHealth_ServiceNodes_DistanceSort(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir1, s1 := testServer(t)
|
||||
defer os.RemoveAll(dir1)
|
||||
defer s1.Shutdown()
|
||||
|
@ -822,7 +812,6 @@ func TestHealth_ServiceNodes_DistanceSort(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestHealth_NodeChecks_FilterACL(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir, token, srv, codec := testACLFilterServer(t)
|
||||
defer os.RemoveAll(dir)
|
||||
defer srv.Shutdown()
|
||||
|
@ -858,7 +847,6 @@ func TestHealth_NodeChecks_FilterACL(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestHealth_ServiceChecks_FilterACL(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir, token, srv, codec := testACLFilterServer(t)
|
||||
defer os.RemoveAll(dir)
|
||||
defer srv.Shutdown()
|
||||
|
@ -901,7 +889,6 @@ func TestHealth_ServiceChecks_FilterACL(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestHealth_ServiceNodes_FilterACL(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir, token, srv, codec := testACLFilterServer(t)
|
||||
defer os.RemoveAll(dir)
|
||||
defer srv.Shutdown()
|
||||
|
@ -937,7 +924,6 @@ func TestHealth_ServiceNodes_FilterACL(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestHealth_ChecksInState_FilterACL(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir, token, srv, codec := testACLFilterServer(t)
|
||||
defer os.RemoveAll(dir)
|
||||
defer srv.Shutdown()
|
||||
|
|
|
@ -13,7 +13,6 @@ import (
|
|||
)
|
||||
|
||||
func TestInternal_NodeInfo(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir1, s1 := testServer(t)
|
||||
defer os.RemoveAll(dir1)
|
||||
defer s1.Shutdown()
|
||||
|
@ -67,7 +66,6 @@ func TestInternal_NodeInfo(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestInternal_NodeDump(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir1, s1 := testServer(t)
|
||||
defer os.RemoveAll(dir1)
|
||||
defer s1.Shutdown()
|
||||
|
@ -159,7 +157,6 @@ func TestInternal_NodeDump(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestInternal_KeyringOperation(t *testing.T) {
|
||||
t.Parallel()
|
||||
key1 := "H1dfkSZOVnP/JUnaBfTzXg=="
|
||||
keyBytes1, err := base64.StdEncoding.DecodeString(key1)
|
||||
if err != nil {
|
||||
|
@ -242,7 +239,6 @@ func TestInternal_KeyringOperation(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestInternal_NodeInfo_FilterACL(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir, token, srv, codec := testACLFilterServer(t)
|
||||
defer os.RemoveAll(dir)
|
||||
defer srv.Shutdown()
|
||||
|
@ -293,7 +289,6 @@ func TestInternal_NodeInfo_FilterACL(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestInternal_NodeDump_FilterACL(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir, token, srv, codec := testACLFilterServer(t)
|
||||
defer os.RemoveAll(dir)
|
||||
defer srv.Shutdown()
|
||||
|
@ -343,7 +338,6 @@ func TestInternal_NodeDump_FilterACL(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestInternal_EventFire_Token(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir, srv := testServerWithConfig(t, func(c *Config) {
|
||||
c.ACLDatacenter = "dc1"
|
||||
c.ACLMasterToken = "root"
|
||||
|
|
|
@ -13,7 +13,6 @@ import (
|
|||
)
|
||||
|
||||
func TestKVS_Apply(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir1, s1 := testServer(t)
|
||||
defer os.RemoveAll(dir1)
|
||||
defer s1.Shutdown()
|
||||
|
@ -70,7 +69,6 @@ func TestKVS_Apply(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestKVS_Apply_ACLDeny(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir1, s1 := testServerWithConfig(t, func(c *Config) {
|
||||
c.ACLDatacenter = "dc1"
|
||||
c.ACLMasterToken = "root"
|
||||
|
@ -133,7 +131,6 @@ func TestKVS_Apply_ACLDeny(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestKVS_Get(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir1, s1 := testServer(t)
|
||||
defer os.RemoveAll(dir1)
|
||||
defer s1.Shutdown()
|
||||
|
@ -181,7 +178,6 @@ func TestKVS_Get(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestKVS_Get_ACLDeny(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir1, s1 := testServerWithConfig(t, func(c *Config) {
|
||||
c.ACLDatacenter = "dc1"
|
||||
c.ACLMasterToken = "root"
|
||||
|
@ -227,7 +223,6 @@ func TestKVS_Get_ACLDeny(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestKVSEndpoint_List(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir1, s1 := testServer(t)
|
||||
defer os.RemoveAll(dir1)
|
||||
defer s1.Shutdown()
|
||||
|
@ -299,7 +294,6 @@ func TestKVSEndpoint_List(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestKVSEndpoint_List_Blocking(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir1, s1 := testServer(t)
|
||||
defer os.RemoveAll(dir1)
|
||||
defer s1.Shutdown()
|
||||
|
@ -395,7 +389,6 @@ func TestKVSEndpoint_List_Blocking(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestKVSEndpoint_List_ACLDeny(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir1, s1 := testServerWithConfig(t, func(c *Config) {
|
||||
c.ACLDatacenter = "dc1"
|
||||
c.ACLMasterToken = "root"
|
||||
|
@ -480,7 +473,6 @@ func TestKVSEndpoint_List_ACLDeny(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestKVSEndpoint_ListKeys(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir1, s1 := testServer(t)
|
||||
defer os.RemoveAll(dir1)
|
||||
defer s1.Shutdown()
|
||||
|
@ -550,7 +542,6 @@ func TestKVSEndpoint_ListKeys(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestKVSEndpoint_ListKeys_ACLDeny(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir1, s1 := testServerWithConfig(t, func(c *Config) {
|
||||
c.ACLDatacenter = "dc1"
|
||||
c.ACLMasterToken = "root"
|
||||
|
@ -629,7 +620,6 @@ func TestKVSEndpoint_ListKeys_ACLDeny(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestKVS_Apply_LockDelay(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir1, s1 := testServer(t)
|
||||
defer os.RemoveAll(dir1)
|
||||
defer s1.Shutdown()
|
||||
|
@ -699,7 +689,6 @@ func TestKVS_Apply_LockDelay(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestKVS_Issue_1626(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir1, s1 := testServer(t)
|
||||
defer os.RemoveAll(dir1)
|
||||
defer s1.Shutdown()
|
||||
|
|
|
@ -14,7 +14,6 @@ import (
|
|||
)
|
||||
|
||||
func TestOperator_Autopilot_GetConfiguration(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir1, s1 := testServerWithConfig(t, func(c *Config) {
|
||||
c.AutopilotConfig.CleanupDeadServers = false
|
||||
})
|
||||
|
@ -39,7 +38,6 @@ func TestOperator_Autopilot_GetConfiguration(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestOperator_Autopilot_GetConfiguration_ACLDeny(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir1, s1 := testServerWithConfig(t, func(c *Config) {
|
||||
c.ACLDatacenter = "dc1"
|
||||
c.ACLMasterToken = "root"
|
||||
|
@ -97,7 +95,6 @@ func TestOperator_Autopilot_GetConfiguration_ACLDeny(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestOperator_Autopilot_SetConfiguration(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir1, s1 := testServerWithConfig(t, func(c *Config) {
|
||||
c.AutopilotConfig.CleanupDeadServers = false
|
||||
})
|
||||
|
@ -133,7 +130,6 @@ func TestOperator_Autopilot_SetConfiguration(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestOperator_Autopilot_SetConfiguration_ACLDeny(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir1, s1 := testServerWithConfig(t, func(c *Config) {
|
||||
c.ACLDatacenter = "dc1"
|
||||
c.ACLMasterToken = "root"
|
||||
|
@ -201,7 +197,6 @@ func TestOperator_Autopilot_SetConfiguration_ACLDeny(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestOperator_ServerHealth(t *testing.T) {
|
||||
t.Parallel()
|
||||
conf := func(c *Config) {
|
||||
c.Datacenter = "dc1"
|
||||
c.Bootstrap = false
|
||||
|
@ -259,7 +254,6 @@ func TestOperator_ServerHealth(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestOperator_ServerHealth_UnsupportedRaftVersion(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir1, s1 := testServerWithConfig(t, func(c *Config) {
|
||||
c.Datacenter = "dc1"
|
||||
c.Bootstrap = true
|
||||
|
|
|
@ -14,7 +14,6 @@ import (
|
|||
)
|
||||
|
||||
func TestOperator_RaftGetConfiguration(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir1, s1 := testServer(t)
|
||||
defer os.RemoveAll(dir1)
|
||||
defer s1.Shutdown()
|
||||
|
@ -57,7 +56,6 @@ func TestOperator_RaftGetConfiguration(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestOperator_RaftGetConfiguration_ACLDeny(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir1, s1 := testServerWithConfig(t, func(c *Config) {
|
||||
c.ACLDatacenter = "dc1"
|
||||
c.ACLMasterToken = "root"
|
||||
|
@ -134,7 +132,6 @@ func TestOperator_RaftGetConfiguration_ACLDeny(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestOperator_RaftRemovePeerByAddress(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir1, s1 := testServer(t)
|
||||
defer os.RemoveAll(dir1)
|
||||
defer s1.Shutdown()
|
||||
|
@ -193,7 +190,6 @@ func TestOperator_RaftRemovePeerByAddress(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestOperator_RaftRemovePeerByAddress_ACLDeny(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir1, s1 := testServerWithConfig(t, func(c *Config) {
|
||||
c.ACLDatacenter = "dc1"
|
||||
c.ACLMasterToken = "root"
|
||||
|
@ -249,7 +245,6 @@ func TestOperator_RaftRemovePeerByAddress_ACLDeny(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestOperator_RaftRemovePeerByID(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir1, s1 := testServerWithConfig(t, func(c *Config) {
|
||||
c.RaftConfig.ProtocolVersion = 3
|
||||
})
|
||||
|
@ -310,7 +305,6 @@ func TestOperator_RaftRemovePeerByID(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestOperator_RaftRemovePeerByID_ACLDeny(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir1, s1 := testServerWithConfig(t, func(c *Config) {
|
||||
c.ACLDatacenter = "dc1"
|
||||
c.ACLMasterToken = "root"
|
||||
|
|
|
@ -21,7 +21,6 @@ import (
|
|||
)
|
||||
|
||||
func TestPreparedQuery_Apply(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir1, s1 := testServer(t)
|
||||
defer os.RemoveAll(dir1)
|
||||
defer s1.Shutdown()
|
||||
|
@ -182,7 +181,6 @@ func TestPreparedQuery_Apply(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestPreparedQuery_Apply_ACLDeny(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir1, s1 := testServerWithConfig(t, func(c *Config) {
|
||||
c.ACLDatacenter = "dc1"
|
||||
c.ACLMasterToken = "root"
|
||||
|
@ -464,7 +462,6 @@ func TestPreparedQuery_Apply_ACLDeny(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestPreparedQuery_Apply_ForwardLeader(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir1, s1 := testServerWithConfig(t, func(c *Config) {
|
||||
c.Bootstrap = false
|
||||
})
|
||||
|
@ -532,7 +529,6 @@ func TestPreparedQuery_Apply_ForwardLeader(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestPreparedQuery_parseQuery(t *testing.T) {
|
||||
t.Parallel()
|
||||
query := &structs.PreparedQuery{}
|
||||
|
||||
err := parseQuery(query, true)
|
||||
|
@ -621,7 +617,6 @@ func TestPreparedQuery_parseQuery(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestPreparedQuery_ACLDeny_Catchall_Template(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir1, s1 := testServerWithConfig(t, func(c *Config) {
|
||||
c.ACLDatacenter = "dc1"
|
||||
c.ACLMasterToken = "root"
|
||||
|
@ -835,7 +830,6 @@ func TestPreparedQuery_ACLDeny_Catchall_Template(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestPreparedQuery_Get(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir1, s1 := testServerWithConfig(t, func(c *Config) {
|
||||
c.ACLDatacenter = "dc1"
|
||||
c.ACLMasterToken = "root"
|
||||
|
@ -1087,7 +1081,6 @@ func TestPreparedQuery_Get(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestPreparedQuery_List(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir1, s1 := testServerWithConfig(t, func(c *Config) {
|
||||
c.ACLDatacenter = "dc1"
|
||||
c.ACLMasterToken = "root"
|
||||
|
@ -1294,7 +1287,6 @@ func TestPreparedQuery_List(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestPreparedQuery_Explain(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir1, s1 := testServerWithConfig(t, func(c *Config) {
|
||||
c.ACLDatacenter = "dc1"
|
||||
c.ACLMasterToken = "root"
|
||||
|
@ -1430,7 +1422,6 @@ func TestPreparedQuery_Explain(t *testing.T) {
|
|||
// walk through the different cases once we have it up. This is broken into
|
||||
// sections so it's still pretty easy to read.
|
||||
func TestPreparedQuery_Execute(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir1, s1 := testServerWithConfig(t, func(c *Config) {
|
||||
c.ACLDatacenter = "dc1"
|
||||
c.ACLMasterToken = "root"
|
||||
|
@ -2452,7 +2443,6 @@ func TestPreparedQuery_Execute(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestPreparedQuery_Execute_ForwardLeader(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir1, s1 := testServer(t)
|
||||
defer os.RemoveAll(dir1)
|
||||
defer s1.Shutdown()
|
||||
|
@ -2581,7 +2571,6 @@ func TestPreparedQuery_Execute_ForwardLeader(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestPreparedQuery_tagFilter(t *testing.T) {
|
||||
t.Parallel()
|
||||
testNodes := func() structs.CheckServiceNodes {
|
||||
return structs.CheckServiceNodes{
|
||||
structs.CheckServiceNode{
|
||||
|
@ -2673,7 +2662,6 @@ func TestPreparedQuery_tagFilter(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestPreparedQuery_Wrapper(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir1, s1 := testServerWithConfig(t, func(c *Config) {
|
||||
c.ACLDatacenter = "dc1"
|
||||
c.ACLMasterToken = "root"
|
||||
|
@ -2760,7 +2748,6 @@ func (m *mockQueryServer) ForwardDC(method, dc string, args interface{}, reply i
|
|||
}
|
||||
|
||||
func TestPreparedQuery_queryFailover(t *testing.T) {
|
||||
t.Parallel()
|
||||
query := &structs.PreparedQuery{
|
||||
Name: "test",
|
||||
Service: structs.ServiceQuery{
|
||||
|
|
|
@ -120,7 +120,6 @@ func testServerWithConfig(t *testing.T, cb func(c *Config)) (string, *Server) {
|
|||
}
|
||||
|
||||
func TestServer_StartStop(t *testing.T) {
|
||||
t.Parallel()
|
||||
// Start up a server and then stop it.
|
||||
dir1, s1 := testServer(t)
|
||||
defer os.RemoveAll(dir1)
|
||||
|
@ -135,7 +134,6 @@ func TestServer_StartStop(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestServer_JoinLAN(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir1, s1 := testServer(t)
|
||||
defer os.RemoveAll(dir1)
|
||||
defer s1.Shutdown()
|
||||
|
@ -157,7 +155,6 @@ func TestServer_JoinLAN(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestServer_JoinWAN(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir1, s1 := testServer(t)
|
||||
defer os.RemoveAll(dir1)
|
||||
defer s1.Shutdown()
|
||||
|
@ -189,7 +186,6 @@ func TestServer_JoinWAN(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestServer_JoinWAN_Flood(t *testing.T) {
|
||||
t.Parallel()
|
||||
// Set up two servers in a WAN.
|
||||
dir1, s1 := testServer(t)
|
||||
defer os.RemoveAll(dir1)
|
||||
|
@ -227,7 +223,6 @@ func TestServer_JoinWAN_Flood(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestServer_JoinSeparateLanAndWanAddresses(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir1, s1 := testServer(t)
|
||||
defer os.RemoveAll(dir1)
|
||||
defer s1.Shutdown()
|
||||
|
@ -305,7 +300,6 @@ func TestServer_JoinSeparateLanAndWanAddresses(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestServer_LeaveLeader(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir1, s1 := testServer(t)
|
||||
defer os.RemoveAll(dir1)
|
||||
defer s1.Shutdown()
|
||||
|
@ -341,7 +335,6 @@ func TestServer_LeaveLeader(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestServer_Leave(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir1, s1 := testServer(t)
|
||||
defer os.RemoveAll(dir1)
|
||||
defer s1.Shutdown()
|
||||
|
@ -377,7 +370,6 @@ func TestServer_Leave(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestServer_RPC(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir1, s1 := testServer(t)
|
||||
defer os.RemoveAll(dir1)
|
||||
defer s1.Shutdown()
|
||||
|
@ -389,7 +381,6 @@ func TestServer_RPC(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestServer_JoinLAN_TLS(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir1, conf1 := testServerConfig(t, "a.testco.internal")
|
||||
conf1.VerifyIncoming = true
|
||||
conf1.VerifyOutgoing = true
|
||||
|
@ -431,7 +422,6 @@ func TestServer_JoinLAN_TLS(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestServer_Expect(t *testing.T) {
|
||||
t.Parallel()
|
||||
// All test servers should be in expect=3 mode, except for the 3rd one,
|
||||
// but one with expect=0 can cause a bootstrap to occur from the other
|
||||
// servers as currently implemented.
|
||||
|
@ -494,7 +484,6 @@ func TestServer_Expect(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestServer_BadExpect(t *testing.T) {
|
||||
t.Parallel()
|
||||
// this one is in expect=3 mode
|
||||
dir1, s1 := testServerDCExpect(t, "dc1", 3)
|
||||
defer os.RemoveAll(dir1)
|
||||
|
@ -541,7 +530,6 @@ func (r *fakeGlobalResp) New() interface{} {
|
|||
}
|
||||
|
||||
func TestServer_globalRPCErrors(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir1, s1 := testServerDC(t, "dc1")
|
||||
defer os.RemoveAll(dir1)
|
||||
defer s1.Shutdown()
|
||||
|
@ -562,7 +550,6 @@ func TestServer_globalRPCErrors(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestServer_Encrypted(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir1, s1 := testServer(t)
|
||||
defer os.RemoveAll(dir1)
|
||||
defer s1.Shutdown()
|
||||
|
@ -610,7 +597,6 @@ func testVerifyRPC(s1, s2 *Server, t *testing.T) (bool, error) {
|
|||
}
|
||||
|
||||
func TestServer_TLSToNoTLS(t *testing.T) {
|
||||
t.Parallel()
|
||||
// Set up a server with no TLS configured
|
||||
dir1, s1 := testServer(t)
|
||||
defer os.RemoveAll(dir1)
|
||||
|
@ -638,7 +624,6 @@ func TestServer_TLSToNoTLS(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestServer_TLSForceOutgoingToNoTLS(t *testing.T) {
|
||||
t.Parallel()
|
||||
// Set up a server with no TLS configured
|
||||
dir1, s1 := testServer(t)
|
||||
defer os.RemoveAll(dir1)
|
||||
|
@ -664,7 +649,6 @@ func TestServer_TLSForceOutgoingToNoTLS(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestServer_TLSToFullVerify(t *testing.T) {
|
||||
t.Parallel()
|
||||
// Set up a server with TLS and VerifyIncoming set
|
||||
dir1, s1 := testServerWithConfig(t, func(c *Config) {
|
||||
c.CAFile = "../test/client_certs/rootca.crt"
|
||||
|
|
|
@ -13,7 +13,6 @@ import (
|
|||
)
|
||||
|
||||
func TestSession_Apply(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir1, s1 := testServer(t)
|
||||
defer os.RemoveAll(dir1)
|
||||
defer s1.Shutdown()
|
||||
|
@ -73,7 +72,6 @@ func TestSession_Apply(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestSession_DeleteApply(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir1, s1 := testServer(t)
|
||||
defer os.RemoveAll(dir1)
|
||||
defer s1.Shutdown()
|
||||
|
@ -137,7 +135,6 @@ func TestSession_DeleteApply(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestSession_Apply_ACLDeny(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir1, s1 := testServerWithConfig(t, func(c *Config) {
|
||||
c.ACLDatacenter = "dc1"
|
||||
c.ACLMasterToken = "root"
|
||||
|
@ -232,7 +229,6 @@ session "foo" {
|
|||
}
|
||||
|
||||
func TestSession_Get(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir1, s1 := testServer(t)
|
||||
defer os.RemoveAll(dir1)
|
||||
defer s1.Shutdown()
|
||||
|
@ -276,7 +272,6 @@ func TestSession_Get(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestSession_List(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir1, s1 := testServer(t)
|
||||
defer os.RemoveAll(dir1)
|
||||
defer s1.Shutdown()
|
||||
|
@ -328,7 +323,6 @@ func TestSession_List(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestSession_Get_List_NodeSessions_ACLFilter(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir1, s1 := testServerWithConfig(t, func(c *Config) {
|
||||
c.ACLDatacenter = "dc1"
|
||||
c.ACLMasterToken = "root"
|
||||
|
@ -497,7 +491,6 @@ session "foo" {
|
|||
}
|
||||
|
||||
func TestSession_ApplyTimers(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir1, s1 := testServer(t)
|
||||
defer os.RemoveAll(dir1)
|
||||
defer s1.Shutdown()
|
||||
|
@ -539,7 +532,6 @@ func TestSession_ApplyTimers(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestSession_Renew(t *testing.T) {
|
||||
t.Parallel()
|
||||
ttl := 250 * time.Millisecond
|
||||
TTL := ttl.String()
|
||||
|
||||
|
@ -703,7 +695,6 @@ func TestSession_Renew(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestSession_Renew_ACLDeny(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir1, s1 := testServerWithConfig(t, func(c *Config) {
|
||||
c.ACLDatacenter = "dc1"
|
||||
c.ACLMasterToken = "root"
|
||||
|
@ -782,7 +773,6 @@ session "foo" {
|
|||
}
|
||||
|
||||
func TestSession_NodeSessions(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir1, s1 := testServer(t)
|
||||
defer os.RemoveAll(dir1)
|
||||
defer s1.Shutdown()
|
||||
|
@ -841,7 +831,6 @@ func TestSession_NodeSessions(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestSession_Apply_BadTTL(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir1, s1 := testServer(t)
|
||||
defer os.RemoveAll(dir1)
|
||||
defer s1.Shutdown()
|
||||
|
|
|
@ -147,7 +147,6 @@ func verifySnapshot(t *testing.T, s *Server, dc, token string) {
|
|||
}
|
||||
|
||||
func TestSnapshot(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir1, s1 := testServer(t)
|
||||
defer os.RemoveAll(dir1)
|
||||
defer s1.Shutdown()
|
||||
|
@ -157,7 +156,6 @@ func TestSnapshot(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestSnapshot_LeaderState(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir1, s1 := testServer(t)
|
||||
defer os.RemoveAll(dir1)
|
||||
defer s1.Shutdown()
|
||||
|
@ -240,7 +238,6 @@ func TestSnapshot_LeaderState(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestSnapshot_ACLDeny(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir1, s1 := testServerWithConfig(t, func(c *Config) {
|
||||
c.ACLDatacenter = "dc1"
|
||||
c.ACLMasterToken = "root"
|
||||
|
@ -286,7 +283,6 @@ func TestSnapshot_ACLDeny(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestSnapshot_Forward_Leader(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir1, s1 := testServerWithConfig(t, func(c *Config) {
|
||||
c.Bootstrap = true
|
||||
})
|
||||
|
@ -313,7 +309,6 @@ func TestSnapshot_Forward_Leader(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestSnapshot_Forward_Datacenter(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir1, s1 := testServerDC(t, "dc1")
|
||||
defer os.RemoveAll(dir1)
|
||||
defer s1.Shutdown()
|
||||
|
@ -342,7 +337,6 @@ func TestSnapshot_Forward_Datacenter(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestSnapshot_AllowStale(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir1, s1 := testServerWithConfig(t, func(c *Config) {
|
||||
c.Bootstrap = false
|
||||
})
|
||||
|
|
|
@ -24,7 +24,6 @@ func rpcClient(t *testing.T, s *Server) rpc.ClientCodec {
|
|||
}
|
||||
|
||||
func TestStatusLeader(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir1, s1 := testServer(t)
|
||||
defer os.RemoveAll(dir1)
|
||||
defer s1.Shutdown()
|
||||
|
@ -51,7 +50,6 @@ func TestStatusLeader(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestStatusPeers(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir1, s1 := testServer(t)
|
||||
defer os.RemoveAll(dir1)
|
||||
defer s1.Shutdown()
|
||||
|
|
|
@ -15,7 +15,6 @@ import (
|
|||
)
|
||||
|
||||
func TestTxn_CheckNotExists(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir1, s1 := testServer(t)
|
||||
defer os.RemoveAll(dir1)
|
||||
defer s1.Shutdown()
|
||||
|
@ -67,7 +66,6 @@ func TestTxn_CheckNotExists(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestTxn_Apply(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir1, s1 := testServer(t)
|
||||
defer os.RemoveAll(dir1)
|
||||
defer s1.Shutdown()
|
||||
|
@ -154,7 +152,6 @@ func TestTxn_Apply(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestTxn_Apply_ACLDeny(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir1, s1 := testServerWithConfig(t, func(c *Config) {
|
||||
c.ACLDatacenter = "dc1"
|
||||
c.ACLMasterToken = "root"
|
||||
|
@ -326,7 +323,6 @@ func TestTxn_Apply_ACLDeny(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestTxn_Apply_LockDelay(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir1, s1 := testServer(t)
|
||||
defer os.RemoveAll(dir1)
|
||||
defer s1.Shutdown()
|
||||
|
@ -412,7 +408,6 @@ func TestTxn_Apply_LockDelay(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestTxn_Read(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir1, s1 := testServer(t)
|
||||
defer os.RemoveAll(dir1)
|
||||
defer s1.Shutdown()
|
||||
|
@ -478,7 +473,6 @@ func TestTxn_Read(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestTxn_Read_ACLDeny(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir1, s1 := testServerWithConfig(t, func(c *Config) {
|
||||
c.ACLDatacenter = "dc1"
|
||||
c.ACLMasterToken = "root"
|
||||
|
|
Loading…
Reference in New Issue