Tmpdir can be a symlink, also fake mount needs to call nested mounter

pull/6/head
Clayton Coleman 2017-11-03 22:20:58 -04:00
parent 66590d6f83
commit b844ac44f5
No known key found for this signature in database
GPG Key ID: 3D16906B4F1C5CB3
2 changed files with 7 additions and 2 deletions

View File

@ -86,7 +86,7 @@ func (mounter *Mounter) MakeRShared(path string) error {
}
func (mounter *SafeFormatAndMount) formatAndMount(source string, target string, fstype string, options []string) error {
return nil
return mounter.Interface.Mount(source, target, fstype, options)
}
func (mounter *SafeFormatAndMount) diskLooksUnformatted(disk string) (bool, error) {

View File

@ -19,6 +19,7 @@ package rbd
import (
"fmt"
"os"
"path/filepath"
"reflect"
"strings"
"sync"
@ -149,7 +150,7 @@ func checkMounterLog(t *testing.T, fakeMounter *mount.FakeMounter, expected int,
lastIndex := len(fakeMounter.Log) - 1
lastAction := fakeMounter.Log[lastIndex]
if !reflect.DeepEqual(expectedAction, lastAction) {
t.Fatalf("fakeMounter.Log[%d] should be %v, not: %v", lastIndex, expectedAction, lastAction)
t.Fatalf("fakeMounter.Log[%d] should be %#v, not: %#v", lastIndex, expectedAction, lastAction)
}
}
@ -276,6 +277,10 @@ func TestPlugin(t *testing.T) {
t.Fatalf("error creating temp dir: %v", err)
}
defer os.RemoveAll(tmpDir)
tmpDir, err = filepath.EvalSymlinks(tmpDir)
if err != nil {
t.Fatal(err)
}
podUID := uuid.NewUUID()
var cases []*testcase