Added unit tests for each PV using IsReadOnly

This commit is contained in:
markturansky
2015-07-01 10:50:39 -04:00
parent fae6759490
commit 63ccfa2beb
10 changed files with 338 additions and 15 deletions

View File

@@ -196,13 +196,13 @@ func TestPersistentClaimReadOnlyFlag(t *testing.T) {
plugMgr := volume.VolumePluginMgr{}
plugMgr.InitPlugins(ProbeVolumePlugins(), volume.NewFakeVolumeHost("/tmp/fake", client, nil))
plug, _ := plugMgr.FindPluginByName(awsElasticBlockStorePluginName)
spec := volume.NewSpecFromPersistentVolume(pv, false)
// readOnly bool is supplied by persistent-claim volume source when its builder 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{}, nil)
if builder.IsReadOnly() {
t.Errorf("Expected false for builder.IsReadOnly")
if !builder.IsReadOnly() {
t.Errorf("Expected true for builder.IsReadOnly")
}
}