From 33218b13decb5a29d833fc08683b8a4a0158667c Mon Sep 17 00:00:00 2001 From: adrianc Date: Mon, 22 May 2023 17:00:51 +0300 Subject: [PATCH] Address review comments - newline in .mockery.yaml file - fix typo in Makefile - update test description pool test - use Ginkgo TempDir() in cmdtutils test - bump testify version to v1.8.3 Signed-off-by: adrianc --- .mockery.yaml | 2 +- Makefile | 2 +- go.mod | 2 +- go.sum | 3 ++- pkg/cmdutils/utils_test.go | 9 +-------- pkg/pool/pool_test.go | 2 +- 6 files changed, 7 insertions(+), 13 deletions(-) diff --git a/.mockery.yaml b/.mockery.yaml index 8192703..f79e317 100644 --- a/.mockery.yaml +++ b/.mockery.yaml @@ -1,4 +1,4 @@ inpackage: False testonly: False with-expecter: True -keeptree: True \ No newline at end of file +keeptree: True diff --git a/Makefile b/Makefile index 1e7991e..41147f8 100644 --- a/Makefile +++ b/Makefile @@ -149,7 +149,7 @@ $(GCOV2LCOV): | $(LOCALBIN) GOBIN=$(LOCALBIN) go install github.com/jandelgado/gcov2lcov@$(GCOV2LCOV_VERSION) .PHONY: mockery -mockery: $(MOCKERY) ## Download gcov2lcov locally if necessary. +mockery: $(MOCKERY) ## Download mockery locally if necessary. $(MOCKERY): | $(LOCALBIN) GOBIN=$(LOCALBIN) go install github.com/vektra/mockery/v2@$(MOCKERY_VERSION) diff --git a/go.mod b/go.mod index 0452a98..99a895b 100644 --- a/go.mod +++ b/go.mod @@ -11,7 +11,7 @@ require ( github.com/onsi/gomega v1.24.2 github.com/spf13/cobra v1.7.0 github.com/spf13/pflag v1.0.5 - github.com/stretchr/testify v1.8.1 + github.com/stretchr/testify v1.8.3 k8s.io/api v0.26.4 k8s.io/apimachinery v0.26.4 k8s.io/client-go v0.26.4 diff --git a/go.sum b/go.sum index 555e0c5..6c48b7f 100644 --- a/go.sum +++ b/go.sum @@ -304,8 +304,9 @@ github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5 github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY= +github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/vishvananda/netlink v1.2.1-beta.2 h1:Llsql0lnQEbHj0I1OuKyp8otXp0r3q0mPkuhwHfStVs= github.com/vishvananda/netlink v1.2.1-beta.2/go.mod h1:twkDnbuQxJYemMlGd4JFIcuhgX83tXhKS2B/PRMpOho= github.com/vishvananda/netns v0.0.0-20200728191858-db3c7e526aae/go.mod h1:DD4vA1DwXk04H54A1oHXtwZmA0grkVMdPxx/VGLCah0= diff --git a/pkg/cmdutils/utils_test.go b/pkg/cmdutils/utils_test.go index dc92120..7309f0b 100644 --- a/pkg/cmdutils/utils_test.go +++ b/pkg/cmdutils/utils_test.go @@ -29,14 +29,7 @@ var _ = Describe("cmdutils testing", func() { ) BeforeEach(func() { - var err error - tmpDir, err = os.MkdirTemp("", "nv_ipam_thin_entrypoint_tmp") - Expect(err).NotTo(HaveOccurred()) - }) - - AfterEach(func() { - err := os.RemoveAll(tmpDir) - Expect(err).NotTo(HaveOccurred()) + tmpDir = GinkgoT().TempDir() }) It("Run CopyFileAtomic()", func() { diff --git a/pkg/pool/pool_test.go b/pkg/pool/pool_test.go index def1f38..33d4527 100644 --- a/pkg/pool/pool_test.go +++ b/pkg/pool/pool_test.go @@ -51,7 +51,7 @@ var _ = Describe("pool tests", func() { Expect(err).To(HaveOccurred()) }) - It("Fails to create Manager if node has empty ip-pool annotation", func() { + It("Fails to create Manager if node has empty/invalid ip-pool annotation", func() { n := v1.Node{} emptyAnnot := map[string]string{ pool.IPBlocksAnnotation: "",