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:
Charlie Voiselle 2021-11-01 16:30:53 -04:00 committed by GitHub
parent 655ac2719f
commit 29e7d46dd9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 28 additions and 0 deletions

3
.changelog/11144.txt Normal file
View File

@ -0,0 +1,3 @@
```release-note:improvement
agent: Added `tls -> rpc_upgrade_mode` to be reloaded on SIGHUP
```

View File

@ -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
}

View File

@ -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)