dependencies: pkg/volume
This commit is contained in:
@@ -25,7 +25,7 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"k8s.io/kubernetes/pkg/api"
|
||||
"k8s.io/kubernetes/pkg/api/v1"
|
||||
"k8s.io/kubernetes/pkg/types"
|
||||
"k8s.io/kubernetes/pkg/util/exec"
|
||||
"k8s.io/kubernetes/pkg/volume"
|
||||
@@ -54,7 +54,7 @@ func TestCanSupport(t *testing.T) {
|
||||
if plug.GetPluginName() != "kubernetes.io/git-repo" {
|
||||
t.Errorf("Wrong name: %s", plug.GetPluginName())
|
||||
}
|
||||
if !plug.CanSupport(&volume.Spec{Volume: &api.Volume{VolumeSource: api.VolumeSource{GitRepo: &api.GitRepoVolumeSource{}}}}) {
|
||||
if !plug.CanSupport(&volume.Spec{Volume: &v1.Volume{VolumeSource: v1.VolumeSource{GitRepo: &v1.GitRepoVolumeSource{}}}}) {
|
||||
t.Errorf("Expected true")
|
||||
}
|
||||
}
|
||||
@@ -73,16 +73,16 @@ func TestPlugin(t *testing.T) {
|
||||
|
||||
scenarios := []struct {
|
||||
name string
|
||||
vol *api.Volume
|
||||
vol *v1.Volume
|
||||
expecteds []expectedCommand
|
||||
isExpectedFailure bool
|
||||
}{
|
||||
{
|
||||
name: "target-dir",
|
||||
vol: &api.Volume{
|
||||
vol: &v1.Volume{
|
||||
Name: "vol1",
|
||||
VolumeSource: api.VolumeSource{
|
||||
GitRepo: &api.GitRepoVolumeSource{
|
||||
VolumeSource: v1.VolumeSource{
|
||||
GitRepo: &v1.GitRepoVolumeSource{
|
||||
Repository: gitUrl,
|
||||
Revision: revision,
|
||||
Directory: "target_dir",
|
||||
@@ -107,10 +107,10 @@ func TestPlugin(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "target-dir-no-revision",
|
||||
vol: &api.Volume{
|
||||
vol: &v1.Volume{
|
||||
Name: "vol1",
|
||||
VolumeSource: api.VolumeSource{
|
||||
GitRepo: &api.GitRepoVolumeSource{
|
||||
VolumeSource: v1.VolumeSource{
|
||||
GitRepo: &v1.GitRepoVolumeSource{
|
||||
Repository: gitUrl,
|
||||
Directory: "target_dir",
|
||||
},
|
||||
@@ -126,10 +126,10 @@ func TestPlugin(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "only-git-clone",
|
||||
vol: &api.Volume{
|
||||
vol: &v1.Volume{
|
||||
Name: "vol1",
|
||||
VolumeSource: api.VolumeSource{
|
||||
GitRepo: &api.GitRepoVolumeSource{
|
||||
VolumeSource: v1.VolumeSource{
|
||||
GitRepo: &v1.GitRepoVolumeSource{
|
||||
Repository: gitUrl,
|
||||
},
|
||||
},
|
||||
@@ -144,10 +144,10 @@ func TestPlugin(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "no-target-dir",
|
||||
vol: &api.Volume{
|
||||
vol: &v1.Volume{
|
||||
Name: "vol1",
|
||||
VolumeSource: api.VolumeSource{
|
||||
GitRepo: &api.GitRepoVolumeSource{
|
||||
VolumeSource: v1.VolumeSource{
|
||||
GitRepo: &v1.GitRepoVolumeSource{
|
||||
Repository: gitUrl,
|
||||
Revision: revision,
|
||||
Directory: "",
|
||||
@@ -172,10 +172,10 @@ func TestPlugin(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "current-dir",
|
||||
vol: &api.Volume{
|
||||
vol: &v1.Volume{
|
||||
Name: "vol1",
|
||||
VolumeSource: api.VolumeSource{
|
||||
GitRepo: &api.GitRepoVolumeSource{
|
||||
VolumeSource: v1.VolumeSource{
|
||||
GitRepo: &v1.GitRepoVolumeSource{
|
||||
Repository: gitUrl,
|
||||
Revision: revision,
|
||||
Directory: ".",
|
||||
@@ -214,7 +214,7 @@ func TestPlugin(t *testing.T) {
|
||||
|
||||
func doTestPlugin(scenario struct {
|
||||
name string
|
||||
vol *api.Volume
|
||||
vol *v1.Volume
|
||||
expecteds []expectedCommand
|
||||
isExpectedFailure bool
|
||||
}, t *testing.T) []error {
|
||||
@@ -231,7 +231,7 @@ func doTestPlugin(scenario struct {
|
||||
fmt.Errorf("Can't find the plugin by name"))
|
||||
return allErrs
|
||||
}
|
||||
pod := &api.Pod{ObjectMeta: api.ObjectMeta{UID: types.UID("poduid")}}
|
||||
pod := &v1.Pod{ObjectMeta: v1.ObjectMeta{UID: types.UID("poduid")}}
|
||||
mounter, err := plug.NewMounter(volume.NewSpecFromVolume(scenario.vol), pod, volume.VolumeOptions{})
|
||||
|
||||
if err != nil {
|
||||
@@ -311,7 +311,7 @@ func doTestPlugin(scenario struct {
|
||||
|
||||
func doTestSetUp(scenario struct {
|
||||
name string
|
||||
vol *api.Volume
|
||||
vol *v1.Volume
|
||||
expecteds []expectedCommand
|
||||
isExpectedFailure bool
|
||||
}, mounter volume.Mounter) []error {
|
||||
|
||||
Reference in New Issue
Block a user