declare a testVolume in volume_test
This commit is contained in:
parent
34031d8d19
commit
f6de6c2452
|
|
@ -24,6 +24,20 @@ import (
|
||||||
"k8s.io/client-go/kubernetes/fake"
|
"k8s.io/client-go/kubernetes/fake"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
type testVolume struct {
|
||||||
|
size int64
|
||||||
|
iops int64
|
||||||
|
throughtput int64
|
||||||
|
volType string
|
||||||
|
}
|
||||||
|
|
||||||
|
var testVol = testVolume{
|
||||||
|
size: 100,
|
||||||
|
iops: 300,
|
||||||
|
throughtput: 125,
|
||||||
|
volType: "gp2",
|
||||||
|
}
|
||||||
|
|
||||||
func newFakeK8sPVCclient() (k8sutil.KubernetesClient, *fake.Clientset) {
|
func newFakeK8sPVCclient() (k8sutil.KubernetesClient, *fake.Clientset) {
|
||||||
clientSet := fake.NewSimpleClientset()
|
clientSet := fake.NewSimpleClientset()
|
||||||
|
|
||||||
|
|
@ -189,14 +203,7 @@ func TestMigrateEBS(t *testing.T) {
|
||||||
cluster.Namespace = namespace
|
cluster.Namespace = namespace
|
||||||
filterLabels := cluster.labelsSet(false)
|
filterLabels := cluster.labelsSet(false)
|
||||||
|
|
||||||
testVolumes := []testVolume{
|
testVolumes := []testVolume{testVol, testVol, testVol}
|
||||||
{
|
|
||||||
size: 100,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
size: 100,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
initTestVolumesAndPods(cluster.KubeClient, namespace, clusterName, filterLabels, testVolumes)
|
initTestVolumesAndPods(cluster.KubeClient, namespace, clusterName, filterLabels, testVolumes)
|
||||||
|
|
||||||
|
|
@ -220,13 +227,6 @@ func TestMigrateEBS(t *testing.T) {
|
||||||
cluster.executeEBSMigration()
|
cluster.executeEBSMigration()
|
||||||
}
|
}
|
||||||
|
|
||||||
type testVolume struct {
|
|
||||||
size int64
|
|
||||||
//iops int64
|
|
||||||
//throughtput int64
|
|
||||||
//volType string
|
|
||||||
}
|
|
||||||
|
|
||||||
func initTestVolumesAndPods(client k8sutil.KubernetesClient, namespace, clustername string, labels labels.Set, volumes []testVolume) {
|
func initTestVolumesAndPods(client k8sutil.KubernetesClient, namespace, clustername string, labels labels.Set, volumes []testVolume) {
|
||||||
i := 0
|
i := 0
|
||||||
for _, v := range volumes {
|
for _, v := range volumes {
|
||||||
|
|
@ -305,17 +305,7 @@ func TestMigrateGp3Support(t *testing.T) {
|
||||||
cluster.Namespace = namespace
|
cluster.Namespace = namespace
|
||||||
filterLabels := cluster.labelsSet(false)
|
filterLabels := cluster.labelsSet(false)
|
||||||
|
|
||||||
testVolumes := []testVolume{
|
testVolumes := []testVolume{testVol, testVol, testVol}
|
||||||
{
|
|
||||||
size: 100,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
size: 100,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
size: 100,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
initTestVolumesAndPods(cluster.KubeClient, namespace, clusterName, filterLabels, testVolumes)
|
initTestVolumesAndPods(cluster.KubeClient, namespace, clusterName, filterLabels, testVolumes)
|
||||||
|
|
||||||
|
|
@ -371,14 +361,7 @@ func TestManualGp2Gp3Support(t *testing.T) {
|
||||||
cluster.Namespace = namespace
|
cluster.Namespace = namespace
|
||||||
filterLabels := cluster.labelsSet(false)
|
filterLabels := cluster.labelsSet(false)
|
||||||
|
|
||||||
testVolumes := []testVolume{
|
testVolumes := []testVolume{testVol, testVol}
|
||||||
{
|
|
||||||
size: 100,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
size: 100,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
initTestVolumesAndPods(cluster.KubeClient, namespace, clusterName, filterLabels, testVolumes)
|
initTestVolumesAndPods(cluster.KubeClient, namespace, clusterName, filterLabels, testVolumes)
|
||||||
|
|
||||||
|
|
@ -430,14 +413,7 @@ func TestDontTouchType(t *testing.T) {
|
||||||
cluster.Namespace = namespace
|
cluster.Namespace = namespace
|
||||||
filterLabels := cluster.labelsSet(false)
|
filterLabels := cluster.labelsSet(false)
|
||||||
|
|
||||||
testVolumes := []testVolume{
|
testVolumes := []testVolume{testVol, testVol}
|
||||||
{
|
|
||||||
size: 150,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
size: 150,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
initTestVolumesAndPods(cluster.KubeClient, namespace, clusterName, filterLabels, testVolumes)
|
initTestVolumesAndPods(cluster.KubeClient, namespace, clusterName, filterLabels, testVolumes)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue