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

cnf network: fix frrnodestatus test case #283

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

gkopels
Copy link
Collaborator

@gkopels gkopels commented Nov 14, 2024

Fix for issue #266

@@ -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
Copy link
Collaborator

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

Copy link
Collaborator Author

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
Copy link
Collaborator

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))

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Updated

@@ -354,7 +354,11 @@ var _ = Describe("FRR", Ordered, Label(tsparams.LabelFRRTestCases), ContinueOnFa
frrNodeState, err := metallb.ListFrrNodeState(APIClient)
Copy link
Collaborator

@ajaggapa ajaggapa Nov 15, 2024

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)
Copy link
Collaborator

@ajaggapa ajaggapa Nov 15, 2024

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

Copy link
Collaborator

@ajaggapa ajaggapa left a 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.

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

Successfully merging this pull request may close these issues.

3 participants