diff --git a/pkg/cluster/volumes_test.go b/pkg/cluster/volumes_test.go index 17b2a62dd..498fea367 100644 --- a/pkg/cluster/volumes_test.go +++ b/pkg/cluster/volumes_test.go @@ -24,6 +24,20 @@ import ( "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) { clientSet := fake.NewSimpleClientset() @@ -189,14 +203,7 @@ func TestMigrateEBS(t *testing.T) { cluster.Namespace = namespace filterLabels := cluster.labelsSet(false) - testVolumes := []testVolume{ - { - size: 100, - }, - { - size: 100, - }, - } + testVolumes := []testVolume{testVol, testVol, testVol} initTestVolumesAndPods(cluster.KubeClient, namespace, clusterName, filterLabels, testVolumes) @@ -220,13 +227,6 @@ func TestMigrateEBS(t *testing.T) { 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) { i := 0 for _, v := range volumes { @@ -305,17 +305,7 @@ func TestMigrateGp3Support(t *testing.T) { cluster.Namespace = namespace filterLabels := cluster.labelsSet(false) - testVolumes := []testVolume{ - { - size: 100, - }, - { - size: 100, - }, - { - size: 100, - }, - } + testVolumes := []testVolume{testVol, testVol, testVol} initTestVolumesAndPods(cluster.KubeClient, namespace, clusterName, filterLabels, testVolumes) @@ -371,14 +361,7 @@ func TestManualGp2Gp3Support(t *testing.T) { cluster.Namespace = namespace filterLabels := cluster.labelsSet(false) - testVolumes := []testVolume{ - { - size: 100, - }, - { - size: 100, - }, - } + testVolumes := []testVolume{testVol, testVol} initTestVolumesAndPods(cluster.KubeClient, namespace, clusterName, filterLabels, testVolumes) @@ -430,14 +413,7 @@ func TestDontTouchType(t *testing.T) { cluster.Namespace = namespace filterLabels := cluster.labelsSet(false) - testVolumes := []testVolume{ - { - size: 150, - }, - { - size: 150, - }, - } + testVolumes := []testVolume{testVol, testVol} initTestVolumesAndPods(cluster.KubeClient, namespace, clusterName, filterLabels, testVolumes)