Added PersistentVolumeController

This commit is contained in:
markturansky
2015-10-12 14:27:49 -04:00
parent d3243b8778
commit 4fc1bf1f23
20 changed files with 1195 additions and 129 deletions

View File

@@ -145,7 +145,7 @@ func TestDeleterTempDir(t *testing.T) {
}
}
func TestCreater(t *testing.T) {
func TestProvisioner(t *testing.T) {
tempPath := "/tmp/hostpath/"
defer os.RemoveAll(tempPath)
err := os.MkdirAll(tempPath, 0750)
@@ -157,18 +157,18 @@ func TestCreater(t *testing.T) {
if err != nil {
t.Errorf("Can't find the plugin by name")
}
creater, err := plug.NewCreater(volume.VolumeOptions{CapacityMB: 100, PersistentVolumeReclaimPolicy: api.PersistentVolumeReclaimDelete})
creater, err := plug.NewProvisioner(volume.VolumeOptions{Capacity: resource.MustParse("1Gi"), PersistentVolumeReclaimPolicy: api.PersistentVolumeReclaimDelete})
if err != nil {
t.Errorf("Failed to make a new Creater: %v", err)
t.Errorf("Failed to make a new Provisioner: %v", err)
}
pv, err := creater.Create()
pv, err := creater.NewPersistentVolumeTemplate()
if err != nil {
t.Errorf("Unexpected error creating volume: %v", err)
}
if pv.Spec.HostPath.Path == "" {
t.Errorf("Expected pv.Spec.HostPath.Path to not be empty: %#v", pv)
}
expectedCapacity := resource.NewQuantity(100*1024*1024, resource.BinarySI)
expectedCapacity := resource.NewQuantity(1*1024*1024*1024, resource.BinarySI)
actualCapacity := pv.Spec.Capacity[api.ResourceStorage]
expectedAmt := expectedCapacity.Value()
actualAmt := actualCapacity.Value()