(t *testing.T)
| 138 | } |
| 139 | |
| 140 | func TestConsensusConfig_ValidateBasic(t *testing.T) { |
| 141 | testcases := map[string]struct { |
| 142 | modify func(*ConsensusConfig) |
| 143 | expectErr bool |
| 144 | }{ |
| 145 | "TimeoutPropose": {func(c *ConsensusConfig) { c.TimeoutPropose = time.Second }, false}, |
| 146 | "TimeoutPropose negative": {func(c *ConsensusConfig) { c.TimeoutPropose = -1 }, true}, |
| 147 | "TimeoutProposeDelta": {func(c *ConsensusConfig) { c.TimeoutProposeDelta = time.Second }, false}, |
| 148 | "TimeoutProposeDelta negative": {func(c *ConsensusConfig) { c.TimeoutProposeDelta = -1 }, true}, |
| 149 | "TimeoutPrevote": {func(c *ConsensusConfig) { c.TimeoutPrevote = time.Second }, false}, |
| 150 | "TimeoutPrevote negative": {func(c *ConsensusConfig) { c.TimeoutPrevote = -1 }, true}, |
| 151 | "TimeoutPrevoteDelta": {func(c *ConsensusConfig) { c.TimeoutPrevoteDelta = time.Second }, false}, |
| 152 | "TimeoutPrevoteDelta negative": {func(c *ConsensusConfig) { c.TimeoutPrevoteDelta = -1 }, true}, |
| 153 | "TimeoutPrecommit": {func(c *ConsensusConfig) { c.TimeoutPrecommit = time.Second }, false}, |
| 154 | "TimeoutPrecommit negative": {func(c *ConsensusConfig) { c.TimeoutPrecommit = -1 }, true}, |
| 155 | "TimeoutPrecommitDelta": {func(c *ConsensusConfig) { c.TimeoutPrecommitDelta = time.Second }, false}, |
| 156 | "TimeoutPrecommitDelta negative": {func(c *ConsensusConfig) { c.TimeoutPrecommitDelta = -1 }, true}, |
| 157 | "TimeoutCommit": {func(c *ConsensusConfig) { c.TimeoutCommit = time.Second }, false}, |
| 158 | "TimeoutCommit negative": {func(c *ConsensusConfig) { c.TimeoutCommit = -1 }, true}, |
| 159 | "PeerGossipSleepDuration": {func(c *ConsensusConfig) { c.PeerGossipSleepDuration = time.Second }, false}, |
| 160 | "PeerGossipSleepDuration negative": {func(c *ConsensusConfig) { c.PeerGossipSleepDuration = -1 }, true}, |
| 161 | "PeerQueryMaj23SleepDuration": {func(c *ConsensusConfig) { c.PeerQueryMaj23SleepDuration = time.Second }, false}, |
| 162 | "PeerQueryMaj23SleepDuration negative": {func(c *ConsensusConfig) { c.PeerQueryMaj23SleepDuration = -1 }, true}, |
| 163 | "DoubleSignCheckHeight negative": {func(c *ConsensusConfig) { c.DoubleSignCheckHeight = -1 }, true}, |
| 164 | } |
| 165 | for desc, tc := range testcases { |
| 166 | tc := tc // appease linter |
| 167 | t.Run(desc, func(t *testing.T) { |
| 168 | cfg := DefaultConsensusConfig() |
| 169 | tc.modify(cfg) |
| 170 | |
| 171 | err := cfg.ValidateBasic() |
| 172 | if tc.expectErr { |
| 173 | assert.Error(t, err) |
| 174 | } else { |
| 175 | assert.NoError(t, err) |
| 176 | } |
| 177 | }) |
| 178 | } |
| 179 | } |
| 180 | |
| 181 | func TestInstrumentationConfigValidateBasic(t *testing.T) { |
| 182 | cfg := TestInstrumentationConfig() |
nothing calls this directly
no test coverage detected
searching dependent graphs…