Embed VolumeSource in v1beta3 and internal.

This commit is contained in:
Brendan Burns
2015-03-03 14:48:55 -08:00
parent 6f85bd0c66
commit fb90b56bf6
29 changed files with 122 additions and 96 deletions

View File

@@ -36,10 +36,10 @@ func TestCanSupport(t *testing.T) {
if plug.Name() != "kubernetes.io/empty-dir" {
t.Errorf("Wrong name: %s", plug.Name())
}
if !plug.CanSupport(&api.Volume{Source: api.VolumeSource{EmptyDir: &api.EmptyDirVolumeSource{}}}) {
if !plug.CanSupport(&api.Volume{VolumeSource: api.VolumeSource{EmptyDir: &api.EmptyDirVolumeSource{}}}) {
t.Errorf("Expected true")
}
if !plug.CanSupport(&api.Volume{Source: api.VolumeSource{}}) {
if !plug.CanSupport(&api.Volume{VolumeSource: api.VolumeSource{}}) {
t.Errorf("Expected true")
}
}
@@ -53,8 +53,8 @@ func TestPlugin(t *testing.T) {
t.Errorf("Can't find the plugin by name")
}
spec := &api.Volume{
Name: "vol1",
Source: api.VolumeSource{EmptyDir: &api.EmptyDirVolumeSource{}},
Name: "vol1",
VolumeSource: api.VolumeSource{EmptyDir: &api.EmptyDirVolumeSource{}},
}
builder, err := plug.NewBuilder(spec, types.UID("poduid"))
if err != nil {
@@ -134,11 +134,11 @@ func TestPluginLegacy(t *testing.T) {
if plug.Name() != "empty" {
t.Errorf("Wrong name: %s", plug.Name())
}
if plug.CanSupport(&api.Volume{Source: api.VolumeSource{EmptyDir: &api.EmptyDirVolumeSource{}}}) {
if plug.CanSupport(&api.Volume{VolumeSource: api.VolumeSource{EmptyDir: &api.EmptyDirVolumeSource{}}}) {
t.Errorf("Expected false")
}
if _, err := plug.NewBuilder(&api.Volume{Source: api.VolumeSource{EmptyDir: &api.EmptyDirVolumeSource{}}}, types.UID("poduid")); err == nil {
if _, err := plug.NewBuilder(&api.Volume{VolumeSource: api.VolumeSource{EmptyDir: &api.EmptyDirVolumeSource{}}}, types.UID("poduid")); err == nil {
t.Errorf("Expected failiure")
}