Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hack/verify-code-patterns.sh: fails locally #217

Closed
ahmetb opened this issue Jun 19, 2019 · 4 comments · Fixed by #221
Closed

hack/verify-code-patterns.sh: fails locally #217

ahmetb opened this issue Jun 19, 2019 · 4 comments · Fixed by #221
Labels
kind/bug Categorizes issue or PR as related to a bug. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt.

Comments

@ahmetb
Copy link
Member

ahmetb commented Jun 19, 2019

When I run hack/verify-code-patterns.sh from the root (at d6629aa) it fails with exitcode=1 without any output. This looks bad in hack/run-tests.sh.

Throwing a set -x shows some stuff:

hack/verify-code-patterns.sh
++ find . -name '*_test.go' -not -path './vendor/*' -print0
++ xargs -0 grep -En 'ioutil\.TempDir'
++ [[ 1 == 123 ]]
+ out=

So it looks like for some reason on my shell, exitcode is 1, and not 123.

Although, when I run it on zsh directly, it works.

$ find . -name '*_test.go' -not -path './vendor/*' -print0 | xargs -0 grep -En 'ioutil\.TempDir' || [[ $? == 123 ]]; echo $?
0

I think we need a cleaner solution that doesn't do [[ $? == 123 ]].

@ahmetb
Copy link
Member Author

ahmetb commented Jun 19, 2019

Oh also this script should use ${SCRIPTDIR}/.. to specify the source directory to find.

@ahmetb
Copy link
Member Author

ahmetb commented Jun 19, 2019

/kind bug
/kind cleanup

@k8s-ci-robot k8s-ci-robot added kind/bug Categorizes issue or PR as related to a bug. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. labels Jun 19, 2019
@ahmetb
Copy link
Member Author

ahmetb commented Jun 20, 2019

this returns 123 in zsh and 1 in bash:

find . -name '*_test.go' -not -path './vendor/*' -print0 | xargs -0 grep -En 'ioutil\.TempDir' || echo $?

weird.

@corneliusweig
Copy link
Contributor

We had some discussion about how to implement this in #191 (comment) . Given that the current solution is not reliable on all platforms, let's use your suggested solution from there.

@ahmetb ahmetb added kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. and removed kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. labels Jun 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants