mirror of https://github.com/status-im/consul.git
Disable TestAgent proxy execution properly
This commit is contained in:
parent
2e223ea2b7
commit
8aeb7bd206
|
@ -363,6 +363,7 @@ func (a *Agent) Start() error {
|
||||||
// create the proxy process manager and start it. This is purposely
|
// create the proxy process manager and start it. This is purposely
|
||||||
// done here after the local state above is loaded in so we can have
|
// done here after the local state above is loaded in so we can have
|
||||||
// a more accurate initial state view.
|
// a more accurate initial state view.
|
||||||
|
if !c.ConnectTestDisableManagedProxies {
|
||||||
a.proxyManager = proxy.NewManager()
|
a.proxyManager = proxy.NewManager()
|
||||||
a.proxyManager.AllowRoot = a.config.ConnectProxyAllowManagedRoot
|
a.proxyManager.AllowRoot = a.config.ConnectProxyAllowManagedRoot
|
||||||
a.proxyManager.State = a.State
|
a.proxyManager.State = a.State
|
||||||
|
@ -379,6 +380,7 @@ func (a *Agent) Start() error {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
go a.proxyManager.Run()
|
go a.proxyManager.Run()
|
||||||
|
}
|
||||||
|
|
||||||
// Start watching for critical services to deregister, based on their
|
// Start watching for critical services to deregister, based on their
|
||||||
// checks.
|
// checks.
|
||||||
|
|
|
@ -661,6 +661,16 @@ type RuntimeConfig struct {
|
||||||
// ConnectCAConfig is the config to use for the CA provider.
|
// ConnectCAConfig is the config to use for the CA provider.
|
||||||
ConnectCAConfig map[string]interface{}
|
ConnectCAConfig map[string]interface{}
|
||||||
|
|
||||||
|
// ConnectTestDisableManagedProxies is not exposed to public config but us
|
||||||
|
// used by TestAgent to prevent self-executing the test binary in the
|
||||||
|
// background if a managed proxy is created for a test. The only place we
|
||||||
|
// actually want to test processes really being spun up and managed is in
|
||||||
|
// `agent/proxy` and it does it at a lower level. Note that this still allows
|
||||||
|
// registering managed proxies via API and other methods, and still creates
|
||||||
|
// all the agent state for them, just doesn't actually start external
|
||||||
|
// processes up.
|
||||||
|
ConnectTestDisableManagedProxies bool
|
||||||
|
|
||||||
// DNSAddrs contains the list of TCP and UDP addresses the DNS server will
|
// DNSAddrs contains the list of TCP and UDP addresses the DNS server will
|
||||||
// bind to. If the DNS endpoint is disabled (ports.dns <= 0) the list is
|
// bind to. If the DNS endpoint is disabled (ports.dns <= 0) the list is
|
||||||
// empty.
|
// empty.
|
||||||
|
|
|
@ -4245,6 +4245,7 @@ func TestSanitize(t *testing.T) {
|
||||||
"ConnectProxyDefaultDaemonCommand": [],
|
"ConnectProxyDefaultDaemonCommand": [],
|
||||||
"ConnectProxyDefaultExecMode": "",
|
"ConnectProxyDefaultExecMode": "",
|
||||||
"ConnectProxyDefaultScriptCommand": [],
|
"ConnectProxyDefaultScriptCommand": [],
|
||||||
|
"ConnectTestDisableManagedProxies": false,
|
||||||
"ConsulCoordinateUpdateBatchSize": 0,
|
"ConsulCoordinateUpdateBatchSize": 0,
|
||||||
"ConsulCoordinateUpdateMaxBatches": 0,
|
"ConsulCoordinateUpdateMaxBatches": 0,
|
||||||
"ConsulCoordinateUpdatePeriod": "15s",
|
"ConsulCoordinateUpdatePeriod": "15s",
|
||||||
|
|
|
@ -352,16 +352,6 @@ func TestConfig(sources ...config.Source) *config.RuntimeConfig {
|
||||||
ca_config {
|
ca_config {
|
||||||
cluster_id = "` + connect.TestClusterID + `"
|
cluster_id = "` + connect.TestClusterID + `"
|
||||||
}
|
}
|
||||||
proxy_defaults {
|
|
||||||
// Generally we don't actually need to test real proxy startup except
|
|
||||||
// in the Daemon package which explicitly manages how it starts things
|
|
||||||
// so making this a no-op long running command like /bin/sleep would
|
|
||||||
// be fine, but there is no such thing on windows etc. We hackily rely
|
|
||||||
// on the fact that if the executable doesn't exist, the Daemon
|
|
||||||
// manager will get an exec error and retry it with a backoff beningly
|
|
||||||
// until tests pass.
|
|
||||||
daemon_command = ["/bin/sleep", "3600"]
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
performance {
|
performance {
|
||||||
raft_multiplier = 1
|
raft_multiplier = 1
|
||||||
|
@ -386,6 +376,10 @@ func TestConfig(sources ...config.Source) *config.RuntimeConfig {
|
||||||
fmt.Println("WARNING:", w)
|
fmt.Println("WARNING:", w)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Disable connect proxy execution since it causes all kinds of problems with
|
||||||
|
// self-executing tests etc.
|
||||||
|
cfg.ConnectTestDisableManagedProxies = true
|
||||||
|
|
||||||
return &cfg
|
return &cfg
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue