Reuse function in other test.
This commit is contained in:
		
							parent
							
								
									e56a522651
								
							
						
					
					
						commit
						c671ee8d02
					
				| 
						 | 
					@ -189,60 +189,16 @@ func TestMigrateEBS(t *testing.T) {
 | 
				
			||||||
	cluster.Namespace = namespace
 | 
						cluster.Namespace = namespace
 | 
				
			||||||
	filterLabels := cluster.labelsSet(false)
 | 
						filterLabels := cluster.labelsSet(false)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pvcList := CreatePVCs(namespace, clusterName, filterLabels, 2, "1Gi")
 | 
						testVolumes := []testVolume{
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
	ps := v1.PersistentVolumeSpec{}
 | 
								size: 100,
 | 
				
			||||||
	ps.AWSElasticBlockStore = &v1.AWSElasticBlockStoreVolumeSource{}
 | 
							},
 | 
				
			||||||
	ps.AWSElasticBlockStore.VolumeID = "aws://eu-central-1b/ebs-volume-1"
 | 
							{
 | 
				
			||||||
 | 
								size: 100,
 | 
				
			||||||
	ps2 := v1.PersistentVolumeSpec{}
 | 
					 | 
				
			||||||
	ps2.AWSElasticBlockStore = &v1.AWSElasticBlockStoreVolumeSource{}
 | 
					 | 
				
			||||||
	ps2.AWSElasticBlockStore.VolumeID = "aws://eu-central-1b/ebs-volume-2"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	pvList := &v1.PersistentVolumeList{
 | 
					 | 
				
			||||||
		Items: []v1.PersistentVolume{
 | 
					 | 
				
			||||||
			{
 | 
					 | 
				
			||||||
				ObjectMeta: metav1.ObjectMeta{
 | 
					 | 
				
			||||||
					Name: "persistent-volume-0",
 | 
					 | 
				
			||||||
				},
 | 
					 | 
				
			||||||
				Spec: ps,
 | 
					 | 
				
			||||||
			},
 | 
					 | 
				
			||||||
			{
 | 
					 | 
				
			||||||
				ObjectMeta: metav1.ObjectMeta{
 | 
					 | 
				
			||||||
					Name: "persistent-volume-1",
 | 
					 | 
				
			||||||
				},
 | 
					 | 
				
			||||||
				Spec: ps2,
 | 
					 | 
				
			||||||
			},
 | 
					 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for _, pvc := range pvcList.Items {
 | 
						initTestVolumesAndPods(cluster.KubeClient, namespace, clusterName, filterLabels, testVolumes)
 | 
				
			||||||
		cluster.KubeClient.PersistentVolumeClaims(namespace).Create(context.TODO(), &pvc, metav1.CreateOptions{})
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	for _, pv := range pvList.Items {
 | 
					 | 
				
			||||||
		cluster.KubeClient.PersistentVolumes().Create(context.TODO(), &pv, metav1.CreateOptions{})
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	pod := v1.Pod{
 | 
					 | 
				
			||||||
		ObjectMeta: metav1.ObjectMeta{
 | 
					 | 
				
			||||||
			Name:   clusterName + "-0",
 | 
					 | 
				
			||||||
			Labels: filterLabels,
 | 
					 | 
				
			||||||
		},
 | 
					 | 
				
			||||||
		Spec: v1.PodSpec{},
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	cluster.KubeClient.Pods(namespace).Create(context.TODO(), &pod, metav1.CreateOptions{})
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	pod = v1.Pod{
 | 
					 | 
				
			||||||
		ObjectMeta: metav1.ObjectMeta{
 | 
					 | 
				
			||||||
			Name:   clusterName + "-1",
 | 
					 | 
				
			||||||
			Labels: filterLabels,
 | 
					 | 
				
			||||||
		},
 | 
					 | 
				
			||||||
		Spec: v1.PodSpec{},
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	cluster.KubeClient.Pods(namespace).Create(context.TODO(), &pod, metav1.CreateOptions{})
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ctrl := gomock.NewController(t)
 | 
						ctrl := gomock.NewController(t)
 | 
				
			||||||
	defer ctrl.Finish()
 | 
						defer ctrl.Finish()
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue