mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-10-08 14:29:45 +00:00
Rename volume.Builder to Mounter and volume.Cleaner to Unmounter
This commit is contained in:
@@ -230,20 +230,20 @@ func doTestPlugin(scenario struct {
|
||||
return allErrs
|
||||
}
|
||||
pod := &api.Pod{ObjectMeta: api.ObjectMeta{UID: types.UID("poduid")}}
|
||||
builder, err := plug.NewBuilder(volume.NewSpecFromVolume(scenario.vol), pod, volume.VolumeOptions{RootContext: ""})
|
||||
mounter, err := plug.NewMounter(volume.NewSpecFromVolume(scenario.vol), pod, volume.VolumeOptions{RootContext: ""})
|
||||
|
||||
if err != nil {
|
||||
allErrs = append(allErrs,
|
||||
fmt.Errorf("Failed to make a new Builder: %v", err))
|
||||
fmt.Errorf("Failed to make a new Mounter: %v", err))
|
||||
return allErrs
|
||||
}
|
||||
if builder == nil {
|
||||
if mounter == nil {
|
||||
allErrs = append(allErrs,
|
||||
fmt.Errorf("Got a nil Builder"))
|
||||
fmt.Errorf("Got a nil Mounter"))
|
||||
return allErrs
|
||||
}
|
||||
|
||||
path := builder.GetPath()
|
||||
path := mounter.GetPath()
|
||||
suffix := fmt.Sprintf("pods/poduid/volumes/kubernetes.io~git-repo/%v", scenario.vol.Name)
|
||||
if !strings.HasSuffix(path, suffix) {
|
||||
allErrs = append(allErrs,
|
||||
@@ -252,7 +252,7 @@ func doTestPlugin(scenario struct {
|
||||
}
|
||||
|
||||
// Test setUp()
|
||||
setUpErrs := doTestSetUp(scenario, builder)
|
||||
setUpErrs := doTestSetUp(scenario, mounter)
|
||||
allErrs = append(allErrs, setUpErrs...)
|
||||
|
||||
if _, err := os.Stat(path); err != nil {
|
||||
@@ -280,19 +280,19 @@ func doTestPlugin(scenario struct {
|
||||
}
|
||||
}
|
||||
|
||||
cleaner, err := plug.NewCleaner("vol1", types.UID("poduid"))
|
||||
unmounter, err := plug.NewUnmounter("vol1", types.UID("poduid"))
|
||||
if err != nil {
|
||||
allErrs = append(allErrs,
|
||||
fmt.Errorf("Failed to make a new Cleaner: %v", err))
|
||||
fmt.Errorf("Failed to make a new Unmounter: %v", err))
|
||||
return allErrs
|
||||
}
|
||||
if cleaner == nil {
|
||||
if unmounter == nil {
|
||||
allErrs = append(allErrs,
|
||||
fmt.Errorf("Got a nil Cleaner"))
|
||||
fmt.Errorf("Got a nil Unmounter"))
|
||||
return allErrs
|
||||
}
|
||||
|
||||
if err := cleaner.TearDown(); err != nil {
|
||||
if err := unmounter.TearDown(); err != nil {
|
||||
allErrs = append(allErrs,
|
||||
fmt.Errorf("Expected success, got: %v", err))
|
||||
return allErrs
|
||||
@@ -312,7 +312,7 @@ func doTestSetUp(scenario struct {
|
||||
vol *api.Volume
|
||||
expecteds []expectedCommand
|
||||
isExpectedFailure bool
|
||||
}, builder volume.Builder) []error {
|
||||
}, mounter volume.Mounter) []error {
|
||||
expecteds := scenario.expecteds
|
||||
allErrs := []error{}
|
||||
|
||||
@@ -349,7 +349,7 @@ func doTestSetUp(scenario struct {
|
||||
CommandScript: fakeAction,
|
||||
}
|
||||
|
||||
g := builder.(*gitRepoVolumeBuilder)
|
||||
g := mounter.(*gitRepoVolumeMounter)
|
||||
g.exec = &fake
|
||||
|
||||
g.SetUp(nil)
|
||||
|
Reference in New Issue
Block a user