Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: import packages only once #172

Merged
merged 2 commits into from
Dec 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion buildscripts/check-diff.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ set -e
TEST_NAME=$1


if [[ `git diff --shortstat | wc -l` != 0 ]]; then
if [[ `git diff --shortstat | wc -l | tr -d ' '` != 0 ]]; then
echo "Some files got changed after $1";printf "\n";git --no-pager diff;printf "\n"; exit 1;
fi
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
Loading