summaryrefslogtreecommitdiff
path: root/internal/logger/logger_test.go
diff options
context:
space:
mode:
authorNick Thomas <nick@gitlab.com>2021-02-26 18:26:24 +0000
committerNick Thomas <nick@gitlab.com>2021-02-26 18:26:24 +0000
commit946ae2adb03b652e70beede0926b668dac533d20 (patch)
treefd25711a460c18dd7ad6c416d53d64cd5fef5f83 /internal/logger/logger_test.go
parentc0a75dae6ec448c1c82eb94b58488cdd8f6759be (diff)
parent48ec7c61dcb0a5ba763cda89f369a23b9c27b037 (diff)
downloadgitlab-shell-946ae2adb03b652e70beede0926b668dac533d20.tar.gz
Merge branch 'sh-fix-log-permission-error' into 'main'
Fix gitlab-shell panic when log file not writable See merge request gitlab-org/gitlab-shell!453
Diffstat (limited to 'internal/logger/logger_test.go')
-rw-r--r--internal/logger/logger_test.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/internal/logger/logger_test.go b/internal/logger/logger_test.go
index 8b28b37..9bffad2 100644
--- a/internal/logger/logger_test.go
+++ b/internal/logger/logger_test.go
@@ -30,3 +30,17 @@ func TestConfigure(t *testing.T) {
require.NoError(t, err)
require.True(t, strings.Contains(string(data), `msg":"this is a test"`))
}
+
+func TestConfigureWithPermissionError(t *testing.T) {
+ tmpPath, err := ioutil.TempDir(os.TempDir(), "logtest-")
+ require.NoError(t, err)
+ defer os.RemoveAll(tmpPath)
+
+ config := config.Config{
+ LogFile: tmpPath,
+ LogFormat: "json",
+ }
+
+ Configure(&config)
+ log.Info("this is a test")
+}