Address loop dev PR comments #4178

Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
This commit is contained in:
Maksym Pavlenko
2021-01-04 10:44:29 -08:00
parent b7026236f4
commit c5fa0298c1
3 changed files with 54 additions and 95 deletions

View File

@@ -53,11 +53,11 @@ func TestSetupLoop(t *testing.T) {
}()
/* RO loop */
f, err = setupLoop(backingFile, LoopParams{Readonly: true, Autoclear: true})
path, err := setupLoop(backingFile, LoopParams{Readonly: true, Autoclear: true})
if err != nil {
t.Fatal(err)
}
ff, err := os.OpenFile(f.Name(), os.O_RDWR, 0)
ff, err := os.OpenFile(path, os.O_RDWR, 0)
if err != nil {
t.Fatal(err)
}
@@ -67,16 +67,13 @@ func TestSetupLoop(t *testing.T) {
if err = ff.Close(); err != nil {
t.Fatal(err)
}
if err = f.Close(); err != nil {
t.Fatal(err)
}
/* RW loop */
f, err = setupLoop(backingFile, LoopParams{Autoclear: true})
path, err = setupLoop(backingFile, LoopParams{Autoclear: true})
if err != nil {
t.Fatal(err)
}
ff, err = os.OpenFile(f.Name(), os.O_RDWR, 0)
ff, err = os.OpenFile(path, os.O_RDWR, 0)
if err != nil {
t.Fatal(err)
}
@@ -86,9 +83,6 @@ func TestSetupLoop(t *testing.T) {
if err = ff.Close(); err != nil {
t.Fatal(err)
}
if err = f.Close(); err != nil {
t.Fatal(err)
}
}
func TestAttachDetachLoopDevice(t *testing.T) {