mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
wal: remove the repeated test case
The TestFilePipelineFailLockFile case maybe test the line 77 in the alloc function. But the LockFile will not throw an error when the file lock is hold. And TestFilePipelineFailPreallocate and TestFilePipelineFailLockFile are exactly the same except for the comments. Signed-off-by: SimFG <1142838399@qq.com>
This commit is contained in:
parent
4b41f74ff8
commit
402188a98c
@ -58,6 +58,7 @@ func newFilePipeline(lg *zap.Logger, dir string, fileSize int64) *filePipeline {
|
||||
|
||||
// Open returns a fresh file for writing. Rename the file before calling
|
||||
// Open again or there will be file collisions.
|
||||
// it will 'block' if the tmp file lock is already taken.
|
||||
func (fp *filePipeline) Open() (f *fileutil.LockedFile, err error) {
|
||||
select {
|
||||
case f = <-fp.filec:
|
||||
|
@ -45,15 +45,3 @@ func TestFilePipelineFailPreallocate(t *testing.T) {
|
||||
t.Fatal("expected error on invalid pre-allocate size, but no error")
|
||||
}
|
||||
}
|
||||
|
||||
func TestFilePipelineFailLockFile(t *testing.T) {
|
||||
tdir := t.TempDir()
|
||||
|
||||
fp := newFilePipeline(zaptest.NewLogger(t), tdir, math.MaxInt64)
|
||||
defer fp.Close()
|
||||
|
||||
f, ferr := fp.Open()
|
||||
if f != nil || ferr == nil { // no such file or directory
|
||||
t.Fatal("expected error on invalid pre-allocate size, but no error")
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user