Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fbc021e21b |
@@ -553,31 +553,6 @@ func TestStartupFailsWhenDataDirNotWritable(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// TestStartupFailsWhenExistingDataDirNotWritable verifies that startup
|
||||
// stops when the data directory exists but the temp file that saving uses
|
||||
// cannot be written in it. A directory sitting at the temp file's path
|
||||
// makes that write fail, which also holds as root.
|
||||
func TestStartupFailsWhenExistingDataDirNotWritable(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
dataDir := t.TempDir()
|
||||
|
||||
err := os.Mkdir(filepath.Join(dataDir, "state.json.tmp"), 0o700)
|
||||
if err != nil {
|
||||
t.Fatalf("creating directory: %v", err)
|
||||
}
|
||||
|
||||
err = startState(t, dataDir)
|
||||
if err == nil {
|
||||
t.Fatal("startup should fail when the data directory is not writable")
|
||||
}
|
||||
|
||||
want := "data directory " + dataDir + " is not writable"
|
||||
if !strings.Contains(err.Error(), want) {
|
||||
t.Errorf("startup error %q does not contain %q", err, want)
|
||||
}
|
||||
}
|
||||
|
||||
// TestStartupCreatesDataDir verifies that startup creates a missing
|
||||
// data directory and leaves nothing behind in it.
|
||||
func TestStartupCreatesDataDir(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user