diff --git a/Makefile b/Makefile index 3fd00b0f8f..b8d0b122de 100755 --- a/Makefile +++ b/Makefile @@ -59,6 +59,8 @@ ARCH ?= amd64 OSVERSION ?= 1809 # Output type of docker buildx build OUTPUT_TYPE ?= registry +# Set -short to skip cloud provider tests +UNIT_TEST_ARGS ?= .EXPORT_ALL_VARIABLES: @@ -76,7 +78,7 @@ verify: unit-test .PHONY: unit-test unit-test: - go test -v -race ./pkg/... ./test/utils/credentials -timeout=30m + go test -v -race $(UNIT_TEST_ARGS) ./pkg/... ./test/utils/credentials -timeout=30m .PHONY: sanity-test sanity-test: azurefile diff --git a/pkg/azurefile/azurefile_dataplane_client_test.go b/pkg/azurefile/azurefile_dataplane_client_test.go index 628b7a6a8d..c7712793a5 100644 --- a/pkg/azurefile/azurefile_dataplane_client_test.go +++ b/pkg/azurefile/azurefile_dataplane_client_test.go @@ -25,6 +25,9 @@ import ( ) func TestCreateFileShare(t *testing.T) { + if testing.Short() { + t.Skip("skipping test in short mode") + } testCases := []struct { name string testFunc func(t *testing.T) @@ -64,6 +67,9 @@ func TestNewAzureFileClient(t *testing.T) { } func TestDeleteFileShare(t *testing.T) { + if testing.Short() { + t.Skip("skipping test in short mode") + } testCases := []struct { name string testFunc func(t *testing.T) @@ -90,6 +96,9 @@ func TestDeleteFileShare(t *testing.T) { } func TestResizeFileShare(t *testing.T) { + if testing.Short() { + t.Skip("skipping test in short mode") + } testCases := []struct { name string testFunc func(t *testing.T) @@ -116,6 +125,9 @@ func TestResizeFileShare(t *testing.T) { } func TestGetFileShareQuotaDataPlane(t *testing.T) { + if testing.Short() { + t.Skip("skipping test in short mode") + } testCases := []struct { name string testFunc func(t *testing.T) diff --git a/pkg/azurefile/azurefile_suite_test.go b/pkg/azurefile/azurefile_suite_test.go index e19f924743..cd644efec9 100644 --- a/pkg/azurefile/azurefile_suite_test.go +++ b/pkg/azurefile/azurefile_suite_test.go @@ -24,6 +24,9 @@ import ( ) func TestAzurefile(t *testing.T) { + if testing.Short() { + t.Skip("skipping test in short mode") + } gomega.RegisterFailHandler(ginkgo.Fail) ginkgo.RunSpecs(t, "Azurefile Suite") } diff --git a/pkg/azurefile/azurefile_test.go b/pkg/azurefile/azurefile_test.go index f8f96ec669..a74de1a983 100644 --- a/pkg/azurefile/azurefile_test.go +++ b/pkg/azurefile/azurefile_test.go @@ -1828,6 +1828,9 @@ func TestIsSupportedPublicNetworkAccess(t *testing.T) { } func TestCreateFolderIfNotExists(t *testing.T) { + if testing.Short() { + t.Skip("skipping test in short mode") + } d := NewFakeDriver() ctx := context.Background() diff --git a/pkg/azurefile/utils_test.go b/pkg/azurefile/utils_test.go index bc9c1c0fa9..86a585357c 100644 --- a/pkg/azurefile/utils_test.go +++ b/pkg/azurefile/utils_test.go @@ -435,10 +435,12 @@ func TestChmodIfPermissionMismatch(t *testing.T) { skipIfTestingOnWindows(t) permissionMatchingPath, _ := getWorkDirPath("permissionMatchingPath") _ = makeDir(permissionMatchingPath, 0755) + _ = os.Chmod(permissionMatchingPath, 0755&^os.ModeSetgid) // clear setgid bit defer os.RemoveAll(permissionMatchingPath) permissionMismatchPath, _ := getWorkDirPath("permissionMismatchPath") _ = makeDir(permissionMismatchPath, 0721) + _ = os.Chmod(permissionMismatchPath, 0721&^os.ModeSetgid) // clear setgid bit defer os.RemoveAll(permissionMismatchPath) permissionMatchGidMismatchPath, _ := getWorkDirPath("permissionMatchGidMismatchPath")