mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-29 14:37:00 +00:00
Add a build rule for the boilerplate unit test.
This commit is contained in:
parent
f5d9c430e9
commit
796e18f1c7
2
Makefile
2
Makefile
@ -474,4 +474,4 @@ bazel-build:
|
|||||||
bazel build //cmd/... //pkg/... //federation/... //plugin/... //build/... //examples/... //test/... //third_party/...
|
bazel build //cmd/... //pkg/... //federation/... //plugin/... //build/... //examples/... //test/... //third_party/...
|
||||||
|
|
||||||
bazel-test:
|
bazel-test:
|
||||||
bazel test --test_output=errors //cmd/... //pkg/... //federation/... //plugin/... //build/... //third_party/...
|
bazel test --test_output=errors //cmd/... //pkg/... //federation/... //plugin/... //build/... //third_party/... //hack/...
|
||||||
|
@ -1,3 +1,12 @@
|
|||||||
package(default_visibility = ["//visibility:public"])
|
package(default_visibility = ["//visibility:public"])
|
||||||
|
|
||||||
exports_files(glob(["*.txt"]))
|
exports_files(glob(["*.txt"]))
|
||||||
|
|
||||||
|
py_test(
|
||||||
|
name = "boilerplate_test",
|
||||||
|
srcs = [
|
||||||
|
"boilerplate_test.py",
|
||||||
|
"boilerplate.py",
|
||||||
|
],
|
||||||
|
data = glob(["*.txt", "test/*"]),
|
||||||
|
)
|
||||||
|
@ -25,22 +25,6 @@ boiler="${boilerDir}/boilerplate.py"
|
|||||||
|
|
||||||
files_need_boilerplate=($(${boiler} "$@"))
|
files_need_boilerplate=($(${boiler} "$@"))
|
||||||
|
|
||||||
# Run boilerplate.py unit tests
|
|
||||||
unitTestOut="$(mktemp)"
|
|
||||||
trap cleanup EXIT
|
|
||||||
cleanup() {
|
|
||||||
rm "${unitTestOut}"
|
|
||||||
}
|
|
||||||
|
|
||||||
pushd "${boilerDir}" >/dev/null
|
|
||||||
if ! python -m unittest boilerplate_test 2>"${unitTestOut}"; then
|
|
||||||
echo "boilerplate_test.py failed"
|
|
||||||
echo
|
|
||||||
cat "${unitTestOut}"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
popd >/dev/null
|
|
||||||
|
|
||||||
# Run boilerplate check
|
# Run boilerplate check
|
||||||
if [[ ${#files_need_boilerplate[@]} -gt 0 ]]; then
|
if [[ ${#files_need_boilerplate[@]} -gt 0 ]]; then
|
||||||
for file in "${files_need_boilerplate[@]}"; do
|
for file in "${files_need_boilerplate[@]}"; do
|
||||||
|
Loading…
Reference in New Issue
Block a user