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

only add resources from cond ready and status true #410

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

asm582
Copy link
Member

@asm582 asm582 commented Jun 15, 2023

No description provided.

@asm582 asm582 requested review from dmatch01 and z103cb June 15, 2023 13:03
Copy link
Contributor

@z103cb z103cb left a comment

Choose a reason for hiding this comment

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

@asm582 would it be possible to add unit tests for this change? There's cache_test.go already.

@asm582
Copy link
Member Author

asm582 commented Jun 15, 2023

@asm582 would it be possible to add unit tests for this change? There's cache_test.go already.

Sure, thanks, done

Nodes: make(map[string]*api.NodeInfo),
}

cache.addNode(node1)
Copy link
Contributor

Choose a reason for hiding this comment

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

If you add an "unllocatable node" to this test, it will be "LGTM" :)

Copy link
Member Author

Choose a reason for hiding this comment

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

Node with status v1.NodeDiskPressure is unallocatable according to MCAD, do we need another test and if yes what do we think should be the node condition?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, to both questions. I would try to get close to 100% coverage for this test case.

Copy link
Member Author

Choose a reason for hiding this comment

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

v1. NodeDiskPressure is already part of this PR

@asm582
Copy link
Member Author

asm582 commented Jun 28, 2023

@tardieu please let us know if you have any feedback, thanks

@asm582
Copy link
Member Author

asm582 commented Jul 3, 2023

@z103cb do we know what is pending for this PR to be merged?

Copy link
Contributor

@z103cb z103cb left a comment

Choose a reason for hiding this comment

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

See my comments to your questions on what tests. These is holding up the approval of the PR.

It would be great if you are to add a test covering concurrent reads and writes in the cache. Something along the line: one thread is updating the cache while the other is trying to read it, mimicking MCAD usage.

Nodes: make(map[string]*api.NodeInfo),
}

cache.addNode(node1)
Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, to both questions. I would try to get close to 100% coverage for this test case.

@asm582
Copy link
Member Author

asm582 commented Jul 5, 2023

See my comments to your questions on what tests. These is holding up the approval of the PR.

It would be great if you are to add a test covering concurrent reads and writes in the cache. Something along the line: one thread is updating the cache while the other is trying to read it, mimicking MCAD usage.

Thanks, May be I am missing something, I don't think the cache is updated concurrently, scheduleNext() thread reads it by making a copy of it. This PR is about adding nodes that are in condition Ready and status True to the cache. Increasing Testing coverage I think is orthogonal. do you think a few tests are still missing wrt to the functionality provided in this PR?

@z103cb
Copy link
Contributor

z103cb commented Jul 5, 2023

See my comments to your questions on what tests. These is holding up the approval of the PR.

It would be great if you are to add a test covering concurrent reads and writes in the cache. Something along the line: one thread is updating the cache while the other is trying to read it, mimicking MCAD usage.

Thanks, May be I am missing something, I don't think the cache is updated concurrently, scheduleNext() thread reads it by making a copy of it. This PR is about adding nodes that are in condition Ready and status True to the cache. Increasing Testing coverage I think is orthogonal. do you think a few tests are still missing wrt to the functionality provided in this PR?

Adding the concurency tests are probably outside the scope of this PR (but never the less they would be nice). In regards to functionallity changed by this PR, adding a test case that "loops" over a set of nodes with or without conditions is probably a must.

@asm582
Copy link
Member Author

asm582 commented Jul 5, 2023

See my comments to your questions on what tests. These is holding up the approval of the PR.

It would be great if you are to add a test covering concurrent reads and writes in the cache. Something along the line: one thread is updating the cache while the other is trying to read it, mimicking MCAD usage.

Thanks, May be I am missing something, I don't think the cache is updated concurrently, scheduleNext() thread reads it by making a copy of it. This PR is about adding nodes that are in condition Ready and status True to the cache. Increasing Testing coverage I think is orthogonal. do you think a few tests are still missing wrt to the functionality provided in this PR?

Adding the concurency tests are probably outside the scope of this PR (but never the less they would be nice). In regards to functionallity changed by this PR, adding a test case that "loops" over a set of nodes with or without conditions is probably a must.

sure, I will implement the looping test, thank you!

@openshift-merge-robot
Copy link
Collaborator

PR needs rebase.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants