aboutsummaryrefslogtreecommitdiff
path: root/internal/admin/service_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/admin/service_test.go')
-rw-r--r--internal/admin/service_test.go21
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,