From 57654cc32e7944f631e0d4df496ebf845d1abdac Mon Sep 17 00:00:00 2001 From: Niladri Halder Date: Thu, 7 Dec 2023 00:42:21 +0530 Subject: [PATCH 1/2] fix(buildscripts): make verify-src compatible with Macs Signed-off-by: Niladri Halder --- buildscripts/check-diff.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildscripts/check-diff.sh b/buildscripts/check-diff.sh index bf549168..fd4e4e07 100755 --- a/buildscripts/check-diff.sh +++ b/buildscripts/check-diff.sh @@ -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 From 68ad75720b2a3a7115b34e9646e3a23f4f2bc1b8 Mon Sep 17 00:00:00 2001 From: guoguangwu Date: Thu, 7 Sep 2023 19:06:29 +0800 Subject: [PATCH 2/2] chore: import packages only once Signed-off-by: guoguangwu Signed-off-by: Niladri Halder --- .../core/v1/persistentvolume/kubernetes_test.go | 7 +++---- .../v1/persistentvolumeclaim/kubernetes_test.go | 15 +++++++-------- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/pkg/kubernetes/api/core/v1/persistentvolume/kubernetes_test.go b/pkg/kubernetes/api/core/v1/persistentvolume/kubernetes_test.go index 6230dcf8..f99ec271 100644 --- a/pkg/kubernetes/api/core/v1/persistentvolume/kubernetes_test.go +++ b/pkg/kubernetes/api/core/v1/persistentvolume/kubernetes_test.go @@ -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" ) @@ -425,7 +424,7 @@ func TestKubernetesPVCreate(t *testing.T) { getClientSetForPath getClientsetForPathFn kubeConfigPath string create createFn - pv *v1.PersistentVolume + pv *corev1.PersistentVolume expectErr bool }{ "Test 1": { @@ -433,7 +432,7 @@ func TestKubernetesPVCreate(t *testing.T) { 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": { @@ -441,7 +440,7 @@ func TestKubernetesPVCreate(t *testing.T) { 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": { diff --git a/pkg/kubernetes/api/core/v1/persistentvolumeclaim/kubernetes_test.go b/pkg/kubernetes/api/core/v1/persistentvolumeclaim/kubernetes_test.go index 5b7d67f0..1e3ca93b 100644 --- a/pkg/kubernetes/api/core/v1/persistentvolumeclaim/kubernetes_test.go +++ b/pkg/kubernetes/api/core/v1/persistentvolumeclaim/kubernetes_test.go @@ -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" ) @@ -447,7 +446,7 @@ func TestKubernetesPVCCreate(t *testing.T) { getClientSetForPath getClientsetForPathFn kubeConfigPath string create createFn - pvc *v1.PersistentVolumeClaim + pvc *corev1.PersistentVolumeClaim expectErr bool }{ "Test 1": { @@ -455,7 +454,7 @@ func TestKubernetesPVCCreate(t *testing.T) { 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": { @@ -463,7 +462,7 @@ func TestKubernetesPVCCreate(t *testing.T) { 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": { @@ -516,13 +515,13 @@ 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, @@ -530,7 +529,7 @@ func TestKubernetesPVCCreateCollection(t *testing.T) { "Test 2": { getClientSet: fakeGetClientSetOk, create: fakeCreateFnErr, - pvc: &v1.PersistentVolumeClaim{ + pvc: &corev1.PersistentVolumeClaim{ ObjectMeta: metav1.ObjectMeta{GenerateName: "PVC-2"}, }, expectErr: true, @@ -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,