mirror of
https://github.com/coredns/coredns.git
synced 2026-07-20 06:30:10 -04:00
test(tls): make keylog path test portable (#8311)
Directory permission checks can be bypassed by privileged users and may behave differently on filesystems with nonstandard permission semantics. Make the bad-path case deterministic so TLS keylog tests remain portable across supported environments. Signed-off-by: Ville Vesilehto <ville@vesilehto.fi>
This commit is contained in:
@@ -2,7 +2,6 @@ package tls
|
||||
|
||||
import (
|
||||
"crypto/tls"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"testing"
|
||||
@@ -102,8 +101,7 @@ func TestTLSKeyLog(t *testing.T) {
|
||||
|
||||
t.Run("Bad Path", func(t *testing.T) {
|
||||
tmpDir := t.TempDir()
|
||||
os.Chmod(tmpDir, 0000)
|
||||
input := "tls test_cert.pem test_key.pem test_ca.pem {\nkeylog " + filepath.Join(tmpDir, "tls.log") + "\n}"
|
||||
input := "tls test_cert.pem test_key.pem test_ca.pem {\nkeylog " + filepath.Join(tmpDir, "missing", "tls.log") + "\n}"
|
||||
c := caddy.NewTestController("dns", input)
|
||||
err := setup(c)
|
||||
if err == nil {
|
||||
|
||||
Reference in New Issue
Block a user