Skip to content

Commit b23e417

Browse files
committed
test: add hack/verify-gomod.sh
1 parent fde7f9a commit b23e417

File tree

3 files changed

+30
-8
lines changed

3 files changed

+30
-8
lines changed

hack/verify-all.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ PKG_ROOT=$(git rev-parse --show-toplevel)
2121
${PKG_ROOT}/hack/verify-gofmt.sh
2222
${PKG_ROOT}/hack/verify-govet.sh
2323
${PKG_ROOT}/hack/verify-golint.sh
24+
${PKG_ROOT}/hack/verify-gomod.sh
2425
${PKG_ROOT}/hack/verify-yamllint.sh
2526
${PKG_ROOT}/hack/verify-boilerplate.sh
2627
${PKG_ROOT}/hack/verify-spelling.sh
Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22

3-
# Copyright 2019 The Kubernetes Authors.
3+
# Copyright 2020 The Kubernetes Authors.
44
#
55
# Licensed under the Apache License, Version 2.0 (the "License");
66
# you may not use this file except in compliance with the License.
@@ -14,11 +14,18 @@
1414
# See the License for the specific language governing permissions and
1515
# limitations under the License.
1616

17-
# disable go dep check since azure cloud provider on master depends on latest k8s.io/client-go, while other components, e.g. snapshot depends on old k8s.io/client-go version
18-
# k8s.io/legacy-cloud-providers: hash of vendored tree not equal to digest in Gopkg.lock
19-
#set -euo pipefail
17+
set -euo pipefail
2018

21-
echo "Verifying dep check"
22-
go get github.com/golang/dep/cmd/dep
23-
dep check
24-
echo "No issue found"
19+
export GO111MODULE=on
20+
echo "go mod tidy"
21+
go mod tidy
22+
echo "go mod vendor"
23+
go mod vendor
24+
diff=`git diff`
25+
if [[ -n "${diff}" ]]; then
26+
echo "${diff}"
27+
echo
28+
echo "error"
29+
exit 1
30+
fi
31+
echo "Done"

pkg/util/util_test.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@ limitations under the License.
1717
package util
1818

1919
import (
20+
"os"
2021
"testing"
22+
23+
"github.com/stretchr/testify/assert"
2124
)
2225

2326
func TestRoundUpBytes(t *testing.T) {
@@ -80,3 +83,14 @@ func TestGetMountOptions(t *testing.T) {
8083
}
8184
}
8285
}
86+
87+
func TestMakeDir(t *testing.T) {
88+
//Successfully create directory
89+
targetTest := "./target_test"
90+
err := MakeDir(targetTest)
91+
assert.NoError(t, err)
92+
93+
// Remove the directory created
94+
err = os.RemoveAll(targetTest)
95+
assert.NoError(t, err)
96+
}

0 commit comments

Comments
 (0)