Making RPC Upgrade mode reloadable. (#11144)
- Making RPC Upgrade mode reloadable. - Add suggestions from code review - remove spurious comment - switch to require(t,...) form for test. - Add to changelog
This commit is contained in:
parent
655ac2719f
commit
29e7d46dd9
|
@ -0,0 +1,3 @@
|
|||
```release-note:improvement
|
||||
agent: Added `tls -> rpc_upgrade_mode` to be reloaded on SIGHUP
|
||||
```
|
|
@ -1098,6 +1098,10 @@ func (a *Agent) ShouldReload(newConfig *Config) (agent, http bool) {
|
|||
agent = true
|
||||
}
|
||||
|
||||
if a.config.TLSConfig.RPCUpgradeMode != newConfig.TLSConfig.RPCUpgradeMode {
|
||||
agent = true
|
||||
}
|
||||
|
||||
return agent, http
|
||||
}
|
||||
|
||||
|
|
|
@ -1296,6 +1296,27 @@ func TestServer_ShouldReload_ShouldHandleMultipleChanges(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestServer_ShouldReload_ReturnTrueForRPCUpgradeModeChanges(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
sameAgentConfig := &Config{
|
||||
TLSConfig: &config.TLSConfig{
|
||||
RPCUpgradeMode: true,
|
||||
},
|
||||
}
|
||||
|
||||
agent := NewTestAgent(t, t.Name(), func(c *Config) {
|
||||
c.TLSConfig = &config.TLSConfig{
|
||||
RPCUpgradeMode: false,
|
||||
}
|
||||
})
|
||||
defer agent.Shutdown()
|
||||
|
||||
shouldReloadAgent, shouldReloadHTTP := agent.ShouldReload(sameAgentConfig)
|
||||
require.True(t, shouldReloadAgent)
|
||||
require.False(t, shouldReloadHTTP)
|
||||
}
|
||||
|
||||
func TestAgent_ProxyRPC_Dev(t *testing.T) {
|
||||
t.Parallel()
|
||||
agent := NewTestAgent(t, t.Name(), nil)
|
||||
|
|
Loading…
Reference in New Issue