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

Add condition of enqueue and unit test cases for task.Queue #113

Merged
merged 2 commits into from
Jan 7, 2017

Conversation

chentao1596
Copy link

Hi, all the codes are related with task.Queue, so i merge them into one PR with two commits.

For the first commit:
I think it's necessary to add checking action before enqueue, because:
1) no need to execute this codes before "t.queue.Add(key)" if queue has been closes
2) log is needed if failed to enqueue

For the second commit:
add unit test cases
thank you!

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jan 7, 2017
@k8s-reviewable
Copy link

This change is Reviewable

@coveralls
Copy link

Coverage Status

Coverage increased (+0.6%) to 41.305% when pulling 28b610d on chentao1596:add-unit-test-for-queue into 5186e93 on kubernetes:master.

@@ -51,6 +51,11 @@ func (t *Queue) Run(period time.Duration, stopCh <-chan struct{}) {

// Enqueue enqueues ns/name of the given api object in the task queue.
func (t *Queue) Enqueue(obj interface{}) {
if t.IsShuttingDown() {
Copy link
Member

Choose a reason for hiding this comment

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

Good point

q.Shutdown()
s := q.IsShuttingDown()
if !s {
t.Fatalf("queue shoule be shutdown")
Copy link
Member

Choose a reason for hiding this comment

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

shoule > should

@aledbf
Copy link
Member

aledbf commented Jan 7, 2017

/lgtm

@k8s-ci-robot
Copy link
Contributor

@aledbf: you can't LGTM a PR unless you are an assignee.

In response to this comment:

/lgtm

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@aledbf aledbf self-assigned this Jan 7, 2017
@aledbf
Copy link
Member

aledbf commented Jan 7, 2017

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jan 7, 2017
@aledbf
Copy link
Member

aledbf commented Jan 7, 2017

@chentao1596 Thanks!

@aledbf aledbf merged commit b2d084a into kubernetes:master Jan 7, 2017
@chentao1596 chentao1596 deleted the add-unit-test-for-queue branch January 8, 2017 01:01
@chentao1596 chentao1596 mentioned this pull request Jan 8, 2017
haoqing0110 pushed a commit to stolostron/management-ingress that referenced this pull request Mar 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants