@@ -817,6 +817,21 @@ func TestConvertClientConfig(t *testing.T) {
817817 must .True (t , cc .DisableAllocationHookMetrics )
818818 },
819819 },
820+ {
821+ name : "rpc dial timeout default" ,
822+ assert : func (t * testing.T , cc * clientconfig.Config ) {
823+ must .Eq (t , 10 * time .Second , cc .RPCDialTimeout )
824+ },
825+ },
826+ {
827+ name : "rpc dial timeout override" ,
828+ modConfig : func (c * Config ) {
829+ c .RPC .DialTimeout = 25 * time .Second
830+ },
831+ assert : func (t * testing.T , cc * clientconfig.Config ) {
832+ must .Eq (t , 25 * time .Second , cc .RPCDialTimeout )
833+ },
834+ },
820835 }
821836 for _ , tc := range cases {
822837 t .Run (tc .name , func (t * testing.T ) {
@@ -842,6 +857,46 @@ func TestConvertClientConfig(t *testing.T) {
842857 }
843858}
844859
860+ // TestAgent_ServerConfig_RPCDialTimeout verifies that rpc.dial_timeout is
861+ // plumbed through to the nomad server config, falling back to the default
862+ // when unset.
863+ func TestAgent_ServerConfig_RPCDialTimeout (t * testing.T ) {
864+ ci .Parallel (t )
865+
866+ cases := []struct {
867+ name string
868+ modConfig func (* Config )
869+ expectedTO time.Duration
870+ }{
871+ {
872+ name : "default" ,
873+ expectedTO : 10 * time .Second ,
874+ },
875+ {
876+ name : "override" ,
877+ modConfig : func (c * Config ) {
878+ c .RPC .DialTimeout = 25 * time .Second
879+ },
880+ expectedTO : 25 * time .Second ,
881+ },
882+ }
883+
884+ for _ , tc := range cases {
885+ t .Run (tc .name , func (t * testing.T ) {
886+ conf := DevConfig (nil )
887+ require .NoError (t , conf .normalizeAddrs ())
888+ if tc .modConfig != nil {
889+ tc .modConfig (conf )
890+ }
891+
892+ nc , err := convertServerConfig (conf )
893+ must .NoError (t , err )
894+ must .NotNil (t , nc )
895+ must .Eq (t , tc .expectedTO , nc .RPCDialTimeout )
896+ })
897+ }
898+ }
899+
845900func TestAgent_ClientConfig_discovery (t * testing.T ) {
846901 ci .Parallel (t )
847902 conf := DefaultConfig ()
0 commit comments