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.go16
1 files changed, 8 insertions, 8 deletions
diff --git a/internal/admin/service_test.go b/internal/admin/service_test.go
index fdd3aa6..e13d28c 100644
--- a/internal/admin/service_test.go
+++ b/internal/admin/service_test.go
@@ -10,7 +10,7 @@ import (
)
var (
- updatedServerConfig []byte = []byte(`
+ updatedServerConfig = []byte(`
---
name: "go-git-server"
version: "v1alpha1"
@@ -42,7 +42,6 @@ repos:
)
func copyFile(t *testing.T, srcFilePath, destPath string) {
-
srcFile, err := os.Open(srcFilePath)
if err != nil {
t.Fatalf("Error opening base config %s", err)
@@ -87,10 +86,11 @@ func TestInitServer(t *testing.T) {
t.Run("test reload config success", func(t *testing.T) {
svc := NewService(destModelFile,
destPolicyFile,
- "gitserver.yaml",
+ filepath.Join(tempRepoDir, "gitserver.yaml"),
tempRepoDir,
false)
- err := os.WriteFile(destConfigFile, updatedServerConfig, 0755)
+ //nolint:gosec
+ err := os.WriteFile(destConfigFile, updatedServerConfig, 0500)
if err != nil {
t.Fatal(err)
}
@@ -104,16 +104,17 @@ func TestInitServer(t *testing.T) {
if !strings.Contains(string(data), "thisismynewrepo") {
t.Fatal("expected to find test new repo but didn't")
}
-
})
t.Run("test reload config err", func(t *testing.T) {
svc := NewService(destModelFile,
destPolicyFile,
- "gitserver.yaml",
+ // TODO set abs path
+ filepath.Join(tempRepoDir, "gitserver.yaml"),
tempRepoDir,
false)
notAGoodConfig := []byte("this is not valid yaml")
- err := os.WriteFile(destConfigFile, notAGoodConfig, 0755)
+ //nolint:gosec
+ err := os.WriteFile(destConfigFile, notAGoodConfig, 0500)
if err != nil {
t.Fatal(err)
}
@@ -127,6 +128,5 @@ func TestInitServer(t *testing.T) {
if !strings.Contains(string(data), "mgmt") {
log.Fatal("expected to mgmt repo but didn't in policy")
}
-
})
}