🐛 Update List in namespaced client to list objects that are cluster scoped#3351
Conversation
|
I can add a test for this |
7bd96c1 to
f5174cf
Compare
Signed-off-by: Troy Connor <troy0820@users.noreply.github.com>
f5174cf to
3153d31
Compare
|
/test pull-controller-runtime-test |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: alvaroaleman, troy0820 The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
LGTM label has been added. DetailsGit tree hash: f68e39039b0c1886ac02565ab8637e2a44b0e174 |
| result := &corev1.NodeList{} | ||
| opts := &client.ListOptions{} | ||
| Expect(getClient().List(ctx, result, opts)).NotTo(HaveOccurred()) | ||
| Expect(result.Items).NotTo(BeEmpty()) |
There was a problem hiding this comment.
Will this work? We are not creating a node in the beforeEach or did I miss it?
There was a problem hiding this comment.
We are not creating a node but a node exist? I am making the assumption but when tested it showed that the node exists when querying the result.
There was a problem hiding this comment.
I had to change it from len(result.Items) to EXPECT(result.Items) to not be Empty when that gave me 9. The test passes showing that the nodelist is not empty.
There was a problem hiding this comment.
Hm. This seems to fail on my Machine somehow (at least when run with Intellij)? Which Nodes do you get?
There was a problem hiding this comment.
Is it possible the node object(s) get created by other tests running in parallel using the same client? That would both explain the flaking and the inability to use len.
Sorry, I missed this before approving
There was a problem hiding this comment.
Probably. We could also simply make this case self-contained by creating a Node with some namespaced prefix
There was a problem hiding this comment.
The flakiness of this is unfortunate because I made the assumption that because the node is there, it is always there. We can contain it by creating a node in the Before Spec if that helps with the testing suite.
|
/cherry-pick release-0.22 |
|
@troy0820: new pull request created: #3352 DetailsIn response to this:
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-sigs/prow repository. |
Resolves #3347