MCPcopy Create free account
hub / github.com/supabase/auth / TestReloadConfig

Function TestReloadConfig

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

Source from the content-addressed store, hash-verified

605}
606
607func TestReloadConfig(t *testing.T) {
608 dir, cleanup := helpTestDir(t)
609 defer cleanup()
610
611 cfg := e2e.Must(e2e.Config()).Reloading
612 rl := NewReloader(cfg, dir)
613
614 // Copy the full and valid example configuration.
615 helpCopyEnvFile(t, dir, "01_example.env", "testdata/50_example.env")
616 {
617 cfg, err := rl.reload()
618 require.Nil(t, err)
619 require.NotNil(t, cfg)
620 require.Equal(t, cfg.External.Apple.Enabled, false)
621 }
622
623 helpWriteEnvFile(t, dir, "02_example.env", map[string]string{
624 "GOTRUE_EXTERNAL_APPLE_ENABLED": "true",
625 })
626 {
627 cfg, err := rl.reload()
628 require.Nil(t, err)
629 require.NotNil(t, cfg)
630 require.Equal(t, cfg.External.Apple.Enabled, true)
631 }
632
633 helpWriteEnvFile(t, dir, "03_example.env.bak", map[string]string{
634 "GOTRUE_EXTERNAL_APPLE_ENABLED": "false",
635 })
636 {
637 cfg, err := rl.reload()
638 require.Nil(t, err)
639 require.NotNil(t, cfg)
640 require.Equal(t, cfg.External.Apple.Enabled, true)
641 }
642
643 // test cfg reload failure
644 helpWriteEnvFile(t, dir, "04_example.env", map[string]string{
645 "PORT": "INVALIDPORT",
646 "GOTRUE_SMTP_PORT": "ABC",
647 })
648 {
649 cfg, err := rl.reload()
650 require.NotNil(t, err)
651 require.Nil(t, cfg)
652 }
653
654 // test directory loading failure
655 {
656 cleanup()
657
658 cfg, err := rl.reload()
659 require.NotNil(t, err)
660 require.Nil(t, cfg)
661 }
662}
663
664func TestReloadCheckAt(t *testing.T) {

Callers

nothing calls this directly

Calls 8

reloadMethod · 0.95
MustFunction · 0.92
ConfigFunction · 0.92
helpTestDirFunction · 0.85
NewReloaderFunction · 0.85
helpCopyEnvFileFunction · 0.85
helpWriteEnvFileFunction · 0.85
EqualMethod · 0.80

Tested by

no test coverage detected