MCPcopy Index your code
hub / github.com/coder/coder / TestInvalidConfig

Function TestInvalidConfig

coderd/notifications/notifications_test.go:591–611  ·  view source on GitHub ↗

TestInvalidConfig validates that misconfigurations lead to errors.

(t *testing.T)

Source from the content-addressed store, hash-verified

589
590// TestInvalidConfig validates that misconfigurations lead to errors.
591func 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
613func TestNotifierPaused(t *testing.T) {
614 t.Parallel()

Callers

nothing calls this directly

Calls 8

NewDBFunction · 0.92
LoggerFunction · 0.92
NewManagerFunction · 0.92
defaultHelpersFunction · 0.85
createMetricsFunction · 0.85
DurationMethod · 0.80
NamedMethod · 0.80

Tested by

no test coverage detected