diff options
| author | Max Resnick <max@ofmax.li> | 2025-05-26 00:48:20 -0700 |
|---|---|---|
| committer | Max Resnick <max@ofmax.li> | 2025-05-26 00:49:44 -0700 |
| commit | a146f39ed183f9957f659505b74782a84e5183c0 (patch) | |
| tree | 7f62caa67c064174dca3f6879e6dfba3a0cb0b30 /internal/admin/service_test.go | |
| parent | e7a9aada4d56605677ab873f0a3090ff80e8455a (diff) | |
| download | go-git-server-a146f39ed183f9957f659505b74782a84e5183c0.tar.gz | |
fix: make sure basePath is set if it's a fresh install
Diffstat (limited to '')
| -rw-r--r-- | internal/admin/service_test.go | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/internal/admin/service_test.go b/internal/admin/service_test.go index 9af6bb9..2cf4e0d 100644 --- a/internal/admin/service_test.go +++ b/internal/admin/service_test.go @@ -88,6 +88,27 @@ func TestInitServer(t *testing.T) { destModelFile, destPolicyFile, destConfigFile := tempModelPolicyConfig(t, tempDir, tempRepoDir) + t.Run("test default config basePath", func(t *testing.T) { + // Create a new temporary directory for this test + testRepoDir := t.TempDir() + + // Create a service with mgmtRepo=true to trigger the default config path + svc, err := NewService(destModelFile, + destPolicyFile, + "gitserver.yaml", // Non-existent file to trigger default config + testRepoDir, + true) + + if err != nil { + t.Fatalf("Failed to create service: %v", err) + } + + // Verify that basePath was correctly set in the default config + if svc.Conf.basePath != testRepoDir { + t.Errorf("Expected basePath to be %q, got %q", testRepoDir, svc.Conf.basePath) + } + }) + t.Run("test reload config success", func(t *testing.T) { svc, _ := NewService(destModelFile, destPolicyFile, |