MCPcopy
hub / github.com/supabase/auth / TestReloadCheckAt

Function TestReloadCheckAt

internal/reloader/reloader_test.go:664–747  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

662}
663
664func TestReloadCheckAt(t *testing.T) {
665 const s10 = time.Second * 10
666
667 makeCfg := func(d time.Duration) conf.ReloadingConfiguration {
668 return conf.ReloadingConfiguration{
669 GracePeriodInterval: d,
670 }
671 }
672
673 now := time.Now()
674 tests := []struct {
675 rl *Reloader
676 at, lastUpdate time.Time
677 exp bool
678 }{
679 // no lastUpdate is set (time.IsZero())
680 {
681 rl: &Reloader{rc: makeCfg(s10), tickerIval: s10 / 10},
682 exp: false,
683 },
684 {
685 rl: &Reloader{rc: makeCfg(s10), tickerIval: s10 / 10},
686 at: now,
687 exp: false,
688 },
689
690 // last update within reload interval
691 {
692 rl: &Reloader{rc: makeCfg(s10), tickerIval: s10 / 10},
693 at: now,
694 lastUpdate: now.Add(-s10 + 1),
695 exp: false,
696 },
697 {
698 rl: &Reloader{rc: makeCfg(s10), tickerIval: s10 / 10},
699 at: now,
700 lastUpdate: now,
701 exp: false,
702 },
703 {
704 rl: &Reloader{rc: makeCfg(s10), tickerIval: s10 / 10},
705 at: now,
706 lastUpdate: now.Add(s10 - 1),
707 exp: false,
708 },
709 {
710 rl: &Reloader{rc: makeCfg(s10), tickerIval: s10 / 10},
711 at: now,
712 lastUpdate: now.Add(s10),
713 exp: false,
714 },
715 {
716 rl: &Reloader{rc: makeCfg(s10), tickerIval: s10 / 10},
717 at: now,
718 lastUpdate: now.Add(s10 + 1),
719 exp: false,
720 },
721 {

Callers

nothing calls this directly

Calls 4

NowMethod · 0.80
EqualMethod · 0.80
reloadCheckAtMethod · 0.80
AddMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…