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