Skip to content

Add verify script for govet & fix pkg/descheduler/descheduler_test.go#568

Merged
k8s-ci-robot merged 1 commit intokubernetes-sigs:masterfrom
binacs:binacs-pkg-descheduler-descheduler_test-fix-errorhandling
May 17, 2021
Merged

Add verify script for govet & fix pkg/descheduler/descheduler_test.go#568
k8s-ci-robot merged 1 commit intokubernetes-sigs:masterfrom
binacs:binacs-pkg-descheduler-descheduler_test-fix-errorhandling

Conversation

@binacs
Copy link
Copy Markdown
Member

@binacs binacs commented May 16, 2021

We can only use t.Fatal in the main test goroutine.

The solution is similar to:
https://github.com/kubernetes/kubernetes/blob/master/cmd/kube-proxy/app/server_test.go#L501

Thanks for review!

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label May 16, 2021
@k8s-ci-robot k8s-ci-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label May 16, 2021
@binacs binacs force-pushed the binacs-pkg-descheduler-descheduler_test-fix-errorhandling branch from e4fea70 to 91df7ed Compare May 16, 2021 18:03
case <-time.After(300 * time.Millisecond):
}

// Wait for few cycles and then verify the only pod still exists
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think this comment is useful, can you keep it?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Done.
Thanks for review ^-^

@binacs binacs force-pushed the binacs-pkg-descheduler-descheduler_test-fix-errorhandling branch from 91df7ed to 5f0ba38 Compare May 17, 2021 04:19
@lixiang233
Copy link
Copy Markdown
Contributor

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 17, 2021
Copy link
Copy Markdown
Member

@damemi damemi left a comment

Choose a reason for hiding this comment

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

Could you share what the failure is for this? I don't think we currently run staticcheck in our CI, if not this would be a good PR to add that check

@binacs
Copy link
Copy Markdown
Member Author

binacs commented May 17, 2021

Could you share what the failure is for this? I don't think we currently run staticcheck in our CI, if not this would be a good PR to add that check

Hi @damemi , the failure is call to (*T).Fatalf from a non-test goroutine:

image

More about the failure at: https://golang.org/doc/go1.16#vet

And I will do some work about staticcheck as soon as possible.

@damemi
Copy link
Copy Markdown
Member

damemi commented May 17, 2021

@BinacsLee ah, I see, so this is a failure from go vet. The title made me think this was coming from something like verify-staticcheck.sh.

In that case, let's update this PR to add a script to verify go vet, similar to https://github.com/kubernetes/kubernetes/blob/master/hack/verify-govet.sh. We can have that script run as part of make verify, which will include it in our CI runs so we can catch things like this automatically in the future. As an example, you can see how we added verify scripts in some other PRs like #545

(For context I do see the error when running go vet):

$ go vet ./pkg/...
# sigs.k8s.io/descheduler/pkg/descheduler
pkg/descheduler/descheduler_test.go:50:4: call to (*T).Fatalf from a non-test goroutine

@binacs binacs force-pushed the binacs-pkg-descheduler-descheduler_test-fix-errorhandling branch from 5f0ba38 to ccf8454 Compare May 17, 2021 15:06
@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed lgtm "Looks good to me", indicates that a PR is ready to be merged. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels May 17, 2021
@binacs binacs force-pushed the binacs-pkg-descheduler-descheduler_test-fix-errorhandling branch from ccf8454 to fe8e17f Compare May 17, 2021 15:07
@binacs binacs changed the title fix staticcheck failure for pkg/descheduler/descheduler_test.go Add verify script for govet & fix pkg/descheduler/descheduler_test.go May 17, 2021
@binacs
Copy link
Copy Markdown
Member Author

binacs commented May 17, 2021

I'm sorry to confuse you. The script for govet has been added. Let's see how CI turns out ^-^

@damemi
Copy link
Copy Markdown
Member

damemi commented May 17, 2021

@BinacsLee no problem! Thanks for the update, this looks good to me now
/approve
/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 17, 2021
@k8s-ci-robot
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: BinacsLee, damemi

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 17, 2021
@k8s-ci-robot k8s-ci-robot merged commit a9ff644 into kubernetes-sigs:master May 17, 2021
@binacs binacs deleted the binacs-pkg-descheduler-descheduler_test-fix-errorhandling branch May 17, 2021 15:20
briend pushed a commit to briend/descheduler that referenced this pull request Feb 11, 2022
…heduler-descheduler_test-fix-errorhandling

Add verify script for govet & fix pkg/descheduler/descheduler_test.go
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants