Rename volume.Builder to Mounter and volume.Cleaner to Unmounter

This commit is contained in:
saadali
2016-03-22 22:12:21 -07:00
parent 590038dcf1
commit 79012f6d53
63 changed files with 877 additions and 877 deletions

View File

@@ -148,20 +148,20 @@ func doTestPlugin(t *testing.T, spec *volume.Spec) {
}
fake := &mount.FakeMounter{}
pod := &api.Pod{ObjectMeta: api.ObjectMeta{UID: types.UID("poduid")}}
builder, err := plug.(*nfsPlugin).newBuilderInternal(spec, pod, fake)
volumePath := builder.GetPath()
mounter, err := plug.(*nfsPlugin).newMounterInternal(spec, pod, fake)
volumePath := mounter.GetPath()
if err != nil {
t.Errorf("Failed to make a new Builder: %v", err)
t.Errorf("Failed to make a new Mounter: %v", err)
}
if builder == nil {
t.Errorf("Got a nil Builder")
if mounter == nil {
t.Errorf("Got a nil Mounter")
}
path := builder.GetPath()
path := mounter.GetPath()
expectedPath := fmt.Sprintf("%s/pods/poduid/volumes/kubernetes.io~nfs/vol1", tmpDir)
if path != expectedPath {
t.Errorf("Unexpected path, expected %q, got: %q", expectedPath, path)
}
if err := builder.SetUp(nil); err != nil {
if err := mounter.SetUp(nil); err != nil {
t.Errorf("Expected success, got: %v", err)
}
if _, err := os.Stat(volumePath); err != nil {
@@ -171,7 +171,7 @@ func doTestPlugin(t *testing.T, spec *volume.Spec) {
t.Errorf("SetUp() failed: %v", err)
}
}
if builder.(*nfsBuilder).readOnly {
if mounter.(*nfsMounter).readOnly {
t.Errorf("The volume source should not be read-only and it is.")
}
if len(fake.Log) != 1 {
@@ -183,14 +183,14 @@ func doTestPlugin(t *testing.T, spec *volume.Spec) {
}
fake.ResetLog()
cleaner, err := plug.(*nfsPlugin).newCleanerInternal("vol1", types.UID("poduid"), fake)
unmounter, err := plug.(*nfsPlugin).newUnmounterInternal("vol1", types.UID("poduid"), fake)
if err != nil {
t.Errorf("Failed to make a new Cleaner: %v", err)
t.Errorf("Failed to make a new Unmounter: %v", err)
}
if cleaner == nil {
t.Errorf("Got a nil Cleaner")
if unmounter == nil {
t.Errorf("Got a nil Unmounter")
}
if err := cleaner.TearDown(); err != nil {
if err := unmounter.TearDown(); err != nil {
t.Errorf("Expected success, got: %v", err)
}
if _, err := os.Stat(volumePath); err == nil {
@@ -272,12 +272,12 @@ func TestPersistentClaimReadOnlyFlag(t *testing.T) {
plugMgr.InitPlugins(ProbeVolumePlugins(volume.VolumeConfig{}), volumetest.NewFakeVolumeHost(tmpDir, client, nil))
plug, _ := plugMgr.FindPluginByName(nfsPluginName)
// readOnly bool is supplied by persistent-claim volume source when its builder creates other volumes
// readOnly bool is supplied by persistent-claim volume source when its mounter creates other volumes
spec := volume.NewSpecFromPersistentVolume(pv, true)
pod := &api.Pod{ObjectMeta: api.ObjectMeta{UID: types.UID("poduid")}}
builder, _ := plug.NewBuilder(spec, pod, volume.VolumeOptions{})
mounter, _ := plug.NewMounter(spec, pod, volume.VolumeOptions{})
if !builder.GetAttributes().ReadOnly {
t.Errorf("Expected true for builder.IsReadOnly")
if !mounter.GetAttributes().ReadOnly {
t.Errorf("Expected true for mounter.IsReadOnly")
}
}