-
Notifications
You must be signed in to change notification settings - Fork 28
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
cnf network: fix frrnodestatus test case #283
base: main
Are you sure you want to change the base?
Conversation
ce6776c
to
c088d09
Compare
@@ -354,7 +354,20 @@ var _ = Describe("FRR", Ordered, Label(tsparams.LabelFRRTestCases), ContinueOnFa | |||
frrNodeState, err := metallb.ListFrrNodeState(APIClient) | |||
Expect(err).ToNot(HaveOccurred(), "Failed to verify BGP routes") | |||
|
|||
return frrNodeState[0].Object.Status.RunningConfig | |||
// Iterate over all the nodes and append worker-0 if present |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove this comment or modify to not mention worker-0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed
|
||
return frrNodeState[0].Object.Status.RunningConfig | ||
var frrWorker1Status *metallb.FrrNodeStateBuilder |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO better to create help func to move this logic, something like:
func findNodeByName(frrNodeState []metallb.FrrNodeStateBuilder, nodeName string) *metallb.FrrNodeStateBuilder {
for _, node := range frrNodeState {
if node.Definition.Name == nodeName {
return node
}
}
return nil
}
and then it should be something like:
frrWorker1Status := findNodeByName(frrNodeState, cnfWorkerNodeList[1].Definition.Name)
Expect(frrWorker1Status).ToNot(BeNil(), fmt.Sprintf("Node with name %s not found", cnfWorkerNodeList[1].Definition.Name))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated
c088d09
to
0dec676
Compare
@@ -354,7 +354,11 @@ var _ = Describe("FRR", Ordered, Label(tsparams.LabelFRRTestCases), ContinueOnFa | |||
frrNodeState, err := metallb.ListFrrNodeState(APIClient) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
metallb.ListFrrNodeState(APIClient, client.ListOptions{
FieldSelector: fields.SelectorFromSet(fields.Set{"metadata.name": "worker-0"})})
We can filter worker-0 here like this
@@ -372,10 +376,12 @@ var _ = Describe("FRR", Ordered, Label(tsparams.LabelFRRTestCases), ContinueOnFa | |||
// Get the routes | |||
frrNodeState, err := metallb.ListFrrNodeState(APIClient) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
metallb.ListFrrNodeState(APIClient, client.ListOptions{
FieldSelector: fields.SelectorFromSet(fields.Set{"metadata.name": "worker-1"})})
Same like above for worker-1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can be simplified by adding filter in existing command. Please try.
Fix for issue #266