Don't leave read only dir around, fails clean
This commit is contained in:
parent
2cd9e7fb55
commit
ce948fc512
@ -17,7 +17,6 @@ package model
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
|
||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -68,13 +67,17 @@ func TestSourceFileBad(t *testing.T) {
|
|||||||
|
|
||||||
// Test creating temporary file inside read-only directory
|
// Test creating temporary file inside read-only directory
|
||||||
func TestReadOnlyDir(t *testing.T) {
|
func TestReadOnlyDir(t *testing.T) {
|
||||||
|
// Create a read only directory, clean it up afterwards.
|
||||||
|
os.Mkdir("testdata/read_only_dir", 0555)
|
||||||
|
defer func() {
|
||||||
|
os.Chmod("testdata/read_only_dir", 0755)
|
||||||
|
os.RemoveAll("testdata/read_only_dir")
|
||||||
|
}()
|
||||||
|
|
||||||
s := sharedPullerState{
|
s := sharedPullerState{
|
||||||
tempName: "testdata/read_only_dir/.temp_name",
|
tempName: "testdata/read_only_dir/.temp_name",
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ensure dir is read-only (git doesn't store full permissions)
|
|
||||||
os.Chmod(filepath.Dir(s.tempName), 0555)
|
|
||||||
|
|
||||||
fd, err := s.tempFile()
|
fd, err := s.tempFile()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
|
|||||||
0
internal/model/testdata/read_only_dir/a
vendored
0
internal/model/testdata/read_only_dir/a
vendored
Loading…
x
Reference in New Issue
Block a user