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

created structure for whitelisting directories for govet shadow testing #6509

Merged

Conversation

stevekuznetsov
Copy link
Contributor

@liggitt PTAL

follow-up pulls expand the whitelist grep and fix shadowed variables

@@ -5,7 +5,7 @@ set -o pipefail

GO_VERSION=($(go version))

if [[ -z $(echo "${GO_VERSION[2]}" | grep -E 'go1.4') ]]; then
if [[ -z $(echo "${GO_VERSION[2]}" | grep -E 'go1.5') ]]; then
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

flags have changed for go tool vet and I think we can migrate testing to 1.5.*

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Jenkins doesn't run on 1.5 yet, so if you want this actually enforced, it has to be 1.4 as well

./pkg/user
./pkg/util
./pkg/version
./plugins
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd rather blacklist so we can delete exceptions as we clean them up and new packages will get enforced.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@stevekuznetsov stevekuznetsov force-pushed the skuznets/go-vet-shadow branch 2 times, most recently from ff5ef6d to 5578a20 Compare December 29, 2015 14:45
@stevekuznetsov
Copy link
Contributor Author

[test]

@stevekuznetsov
Copy link
Contributor Author

@liggitt made changes to programatically generate ALL_DIRS

@@ -23,13 +23,69 @@ FAILURE=false
test_dirs=$(find_files | cut -d '/' -f 1-2 | sort -u)
for test_dir in $test_dirs
do
go tool vet -shadow=false $test_dir
go tool vet -all $test_dir
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should still be -shadow=false, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no. the flags to go vet changed with the latest release.
-all == all, except shadow

@liggitt liggitt self-assigned this Jan 4, 2016
do
# use `grep` failure to determine that a directory is not in the blacklist
if ! echo "${DIR_BLACKLIST}" | grep -q "${test_dir}"; then
go tool vet -shadow -shadowstrict $test_dir
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does vet recurse subpackages? If not, then you need ALL_DIRS to be all packages, and DIR_BLACKLIST to filter out by prefix

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

vet recurses directories, which is what we are passing it

@stevekuznetsov
Copy link
Contributor Author

flake on e2e test here:

Error from server: 501: All the given peers are not reachable (failed to propose on members [https://172.18.11.218:4001] twice [last error: Unexpected HTTP status code]) [0]

#6447

re[test]

@stevekuznetsov
Copy link
Contributor Author

Another etcd flake here:

Error from server: deploymentConfig "failing-dc" cannot be updated: the object has been modified; please apply your changes to the latest version and try again

#6447
re[test]

@stevekuznetsov
Copy link
Contributor Author

end-to-end flake here:

Error from server: 501: All the given peers are not reachable (failed to propose on members [https://172.18.7.126:4001] twice [last error: Unexpected HTTP status code]) [0]

#6447
re[test]

@stevekuznetsov
Copy link
Contributor Author

flake on TestAuthorizationRestrictedAccessForProjectAdmins here:

F0104 16:11:17.513223   22923 run_components.go:393] Unable to initialize namespaces: unable to persist the updated namespace UID allocations: uidallocation "" cannot be updated: another caller has already initialized the resource

#6065
re[test]

@stevekuznetsov
Copy link
Contributor Author

more flakes with webdriver here:

1)  unauthenticated user should be able to log in
  - Error: Angular could not be found on the page https://localhost:9000/ : angular never provided resumeBootstrap
...
2)  authenticated e2e-user with test project should be able to list the test project
  - Error: Error while waiting for Protractor to sync with the page: "angular could not be found on the window"
...
!!! Error in hack/../test/end-to-end/core.sh:346
    'grunt test-integration' exited with status 3
Call stack:
    1: hack/../test/end-to-end/core.sh:346 main(...)
Exiting with status 1

#6533
re[test]

# use `grep` failure to determine that a directory is not in the blacklist
if ! echo "${DIR_BLACKLIST}" | grep -q "${test_dir}"; then
go tool vet -shadow -shadowstrict $test_dir
if [ "$?" -ne 0 ]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems odd to compare a string and a number... this probably works, but make both sides one or the other

@liggitt
Copy link
Contributor

liggitt commented Jan 5, 2016

nit, LGTM

@stevekuznetsov
Copy link
Contributor Author

@liggitt addressed comment

@openshift-bot
Copy link
Contributor

Evaluated for origin test up to 27df269

@openshift-bot
Copy link
Contributor

continuous-integration/openshift-jenkins/test SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pull_requests_origin/8181/)

@stevekuznetsov
Copy link
Contributor Author

@liggitt this is ready

@liggitt
Copy link
Contributor

liggitt commented Jan 20, 2016

[merge]

@openshift-bot
Copy link
Contributor

continuous-integration/openshift-jenkins/merge SUCCESS (https://ci.openshift.redhat.com/jenkins/job/merge_pull_requests_origin/4676/) (Image: devenv-rhel7_3193)

@openshift-bot
Copy link
Contributor

Evaluated for origin merge up to 27df269

openshift-bot pushed a commit that referenced this pull request Jan 20, 2016
@openshift-bot openshift-bot merged commit f630d4d into openshift:master Jan 20, 2016
@stevekuznetsov stevekuznetsov deleted the skuznets/go-vet-shadow branch March 16, 2016 13:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants