TestInvalidNumericOptionsReturnError verifies that invalid numeric values return appropriate errors.
(t *testing.T)
| 224 | // TestInvalidNumericOptionsReturnError verifies that invalid numeric values |
| 225 | // return appropriate errors. |
| 226 | func TestInvalidNumericOptionsReturnError(t *testing.T) { |
| 227 | t.Run("InvalidFlightInterval", func(t *testing.T) { |
| 228 | _, err := buildClientConfig(WithFlightInterval(0)) |
| 229 | require.ErrorIs(t, err, errInvalidFlightInterval) |
| 230 | |
| 231 | _, err = buildClientConfig(WithFlightInterval(-time.Second)) |
| 232 | require.ErrorIs(t, err, errInvalidFlightInterval) |
| 233 | |
| 234 | _, err = buildServerConfig(WithFlightInterval(0)) |
| 235 | require.ErrorIs(t, err, errInvalidFlightInterval) |
| 236 | }) |
| 237 | |
| 238 | t.Run("InvalidMTU", func(t *testing.T) { |
| 239 | _, err := buildClientConfig(WithMTU(0)) |
| 240 | require.ErrorIs(t, err, errInvalidMTU) |
| 241 | |
| 242 | _, err = buildClientConfig(WithMTU(-100)) |
| 243 | require.ErrorIs(t, err, errInvalidMTU) |
| 244 | |
| 245 | _, err = buildServerConfig(WithMTU(0)) |
| 246 | require.ErrorIs(t, err, errInvalidMTU) |
| 247 | }) |
| 248 | |
| 249 | t.Run("InvalidReplayProtectionWindow", func(t *testing.T) { |
| 250 | _, err := buildClientConfig(WithReplayProtectionWindow(-1)) |
| 251 | require.ErrorIs(t, err, errInvalidReplayProtectionWindow) |
| 252 | |
| 253 | _, err = buildServerConfig(WithReplayProtectionWindow(-1)) |
| 254 | require.ErrorIs(t, err, errInvalidReplayProtectionWindow) |
| 255 | }) |
| 256 | |
| 257 | t.Run("InvalidClientAuthType", func(t *testing.T) { |
| 258 | _, err := buildServerConfig(WithClientAuth(ClientAuthType(-1))) |
| 259 | require.ErrorIs(t, err, errInvalidClientAuthType) |
| 260 | |
| 261 | _, err = buildServerConfig(WithClientAuth(ClientAuthType(100))) |
| 262 | require.ErrorIs(t, err, errInvalidClientAuthType) |
| 263 | }) |
| 264 | |
| 265 | t.Run("InvalidExtendedMasterSecretType", func(t *testing.T) { |
| 266 | _, err := buildClientConfig(WithExtendedMasterSecret(ExtendedMasterSecretType(-1))) |
| 267 | require.ErrorIs(t, err, errInvalidExtendedMasterSecretType) |
| 268 | |
| 269 | _, err = buildServerConfig(WithExtendedMasterSecret(ExtendedMasterSecretType(100))) |
| 270 | require.ErrorIs(t, err, errInvalidExtendedMasterSecretType) |
| 271 | }) |
| 272 | |
| 273 | t.Run("InvalidVersions", func(t *testing.T) { |
| 274 | _, err := buildClientConfig(withMinVersion(protocol.Version{})) |
| 275 | require.ErrorIs(t, err, errUnsupportedProtocolVersion) |
| 276 | |
| 277 | _, err = buildClientConfig(withMaxVersion(protocol.Version{})) |
| 278 | require.ErrorIs(t, err, errUnsupportedProtocolVersion) |
| 279 | }) |
| 280 | } |
| 281 | |
| 282 | // TestDefaultsAreApplied verifies that defaults are applied before options. |
| 283 | func TestDefaultsAreApplied(t *testing.T) { |
nothing calls this directly
no test coverage detected
searching dependent graphs…