TestInvalidConfig validates that misconfigurations lead to errors.
(t *testing.T)
| 589 | |
| 590 | // TestInvalidConfig validates that misconfigurations lead to errors. |
| 591 | func TestInvalidConfig(t *testing.T) { |
| 592 | t.Parallel() |
| 593 | |
| 594 | store, pubsub := dbtestutil.NewDB(t) |
| 595 | logger := testutil.Logger(t) |
| 596 | |
| 597 | // GIVEN: invalid config with dispatch period <= lease period |
| 598 | const ( |
| 599 | leasePeriod = time.Second |
| 600 | method = database.NotificationMethodSmtp |
| 601 | ) |
| 602 | cfg := defaultNotificationsConfig(method) |
| 603 | cfg.LeasePeriod = serpent.Duration(leasePeriod) |
| 604 | cfg.DispatchTimeout = serpent.Duration(leasePeriod) |
| 605 | |
| 606 | // WHEN: the manager is created with invalid config |
| 607 | _, err := notifications.NewManager(cfg, store, pubsub, defaultHelpers(), createMetrics(), logger.Named("manager")) |
| 608 | |
| 609 | // THEN: the manager will fail to be created, citing invalid config as error |
| 610 | require.ErrorIs(t, err, notifications.ErrInvalidDispatchTimeout) |
| 611 | } |
| 612 | |
| 613 | func TestNotifierPaused(t *testing.T) { |
| 614 | t.Parallel() |
nothing calls this directly
no test coverage detected