Skip to content

Commit

Permalink
chore: import packages only once
Browse files Browse the repository at this point in the history
Signed-off-by: guoguangwu <[email protected]>
Signed-off-by: Niladri Halder <[email protected]>
  • Loading branch information
testwill authored and niladrih committed Dec 6, 2023
1 parent 57654cc commit 68ad757
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import (

errors "github.com/pkg/errors"
corev1 "k8s.io/api/core/v1"
v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes"
)
Expand Down Expand Up @@ -425,23 +424,23 @@ func TestKubernetesPVCreate(t *testing.T) {
getClientSetForPath getClientsetForPathFn
kubeConfigPath string
create createFn
pv *v1.PersistentVolume
pv *corev1.PersistentVolume
expectErr bool
}{
"Test 1": {
getClientSet: fakeGetClientSetErr,
getClientSetForPath: fakeGetClientSetForPathErr,
kubeConfigPath: "",
create: fakeCreateFnOk,
pv: &v1.PersistentVolume{ObjectMeta: metav1.ObjectMeta{Name: "PV-1"}},
pv: &corev1.PersistentVolume{ObjectMeta: metav1.ObjectMeta{Name: "PV-1"}},
expectErr: true,
},
"Test 2": {
getClientSet: fakeGetClientSetOk,
getClientSetForPath: fakeGetClientSetForPathOk,
kubeConfigPath: "",
create: fakeCreateFnErr,
pv: &v1.PersistentVolume{ObjectMeta: metav1.ObjectMeta{Name: "PV-2"}},
pv: &corev1.PersistentVolume{ObjectMeta: metav1.ObjectMeta{Name: "PV-2"}},
expectErr: true,
},
"Test 3": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import (

errors "github.com/pkg/errors"
corev1 "k8s.io/api/core/v1"
v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes"
)
Expand Down Expand Up @@ -447,23 +446,23 @@ func TestKubernetesPVCCreate(t *testing.T) {
getClientSetForPath getClientsetForPathFn
kubeConfigPath string
create createFn
pvc *v1.PersistentVolumeClaim
pvc *corev1.PersistentVolumeClaim
expectErr bool
}{
"Test 1": {
getClientSet: fakeGetClientSetErr,
getClientSetForPath: fakeGetClientSetForPathErr,
kubeConfigPath: "",
create: fakeCreateFnOk,
pvc: &v1.PersistentVolumeClaim{ObjectMeta: metav1.ObjectMeta{Name: "PVC-1"}},
pvc: &corev1.PersistentVolumeClaim{ObjectMeta: metav1.ObjectMeta{Name: "PVC-1"}},
expectErr: true,
},
"Test 2": {
getClientSet: fakeGetClientSetOk,
getClientSetForPath: fakeGetClientSetForPathOk,
kubeConfigPath: "",
create: fakeCreateFnErr,
pvc: &v1.PersistentVolumeClaim{ObjectMeta: metav1.ObjectMeta{Name: "PVC-2"}},
pvc: &corev1.PersistentVolumeClaim{ObjectMeta: metav1.ObjectMeta{Name: "PVC-2"}},
expectErr: true,
},
"Test 3": {
Expand Down Expand Up @@ -516,21 +515,21 @@ func TestKubernetesPVCCreateCollection(t *testing.T) {
tests := map[string]struct {
getClientSet getClientsetFn
create createFn
pvc *v1.PersistentVolumeClaim
pvc *corev1.PersistentVolumeClaim
expectErr bool
}{
"Test 1": {
getClientSet: fakeGetClientSetErr,
create: fakeCreateFnOk,
pvc: &v1.PersistentVolumeClaim{
pvc: &corev1.PersistentVolumeClaim{
ObjectMeta: metav1.ObjectMeta{GenerateName: "PVC-1"},
},
expectErr: true,
},
"Test 2": {
getClientSet: fakeGetClientSetOk,
create: fakeCreateFnErr,
pvc: &v1.PersistentVolumeClaim{
pvc: &corev1.PersistentVolumeClaim{
ObjectMeta: metav1.ObjectMeta{GenerateName: "PVC-2"},
},
expectErr: true,
Expand All @@ -544,7 +543,7 @@ func TestKubernetesPVCCreateCollection(t *testing.T) {
"Test 4": {
getClientSet: fakeGetClientSetOk,
create: fakeCreateFnOk,
pvc: &v1.PersistentVolumeClaim{
pvc: &corev1.PersistentVolumeClaim{
ObjectMeta: metav1.ObjectMeta{GenerateName: "PVC-4"},
},
expectErr: false,
Expand Down

0 comments on commit 68ad757

Please sign in to comment.