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-metallb-nodeselector-tc #347

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

Conversation

gkopels
Copy link
Collaborator

@gkopels gkopels commented Dec 28, 2024

moving test cases from cnf-gotest to eco-gotest

@gkopels gkopels force-pushed the add-nodeselector-testcase branch 4 times, most recently from 064e163 to c92959e Compare December 29, 2024 05:59
@gkopels gkopels force-pushed the add-nodeselector-testcase branch from c92959e to 1019bfe Compare December 29, 2024 06:25

// ValidateLocalPref verifies local pref from FRR is equal to configured Local Pref.
func ValidateLocalPref(frrPod *pod.Builder, localPref uint32, ipFamily string) error {
var (
Copy link
Collaborator

Choose a reason for hiding this comment

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

remove

err error
)

res, err = frrPod.ExecCommand(append(netparam.VtySh,
Copy link
Collaborator

Choose a reason for hiding this comment

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

please use getBGPStatus func

return fmt.Errorf("failed to parse route local preference %w", err)
}

for _, locPref := range toParse.Routes {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
for _, locPref := range toParse.Routes {
for _, route := range toParse.Routes {

}

for _, locPref := range toParse.Routes {
if locPref[0].LocalPref != localPref {
Copy link
Collaborator

Choose a reason for hiding this comment

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

do we expect to validate only first route?

}
}

return err
Copy link
Collaborator

Choose a reason for hiding this comment

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

return nil

Expect(err).ToNot(HaveOccurred(), "Fail to validate local preference")

By("Validate BGP Community exists with the node selector")
output, err := frr.GetBGPCommunityStatus(frrPod0, noAdvertise, strings.ToLower(netparam.IPV4Family))
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
output, err := frr.GetBGPCommunityStatus(frrPod0, noAdvertise, strings.ToLower(netparam.IPV4Family))
bgpStatus, err := frr.GetBGPCommunityStatus(frrPod0, noAdvertise, strings.ToLower(netparam.IPV4Family))

Expect(len(output.Routes)).To(Equal(1))

By("Validate BGP Community does not exist without the node selector")
output, err = frr.GetBGPCommunityStatus(frrPod1, customCommunity, strings.ToLower(netparam.IPV4Family))
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
output, err = frr.GetBGPCommunityStatus(frrPod1, customCommunity, strings.ToLower(netparam.IPV4Family))
bgpStatus, err = frr.GetBGPCommunityStatus(frrPod1, customCommunity, strings.ToLower(netparam.IPV4Family))

_, err := metallb.NewBPGPeerBuilder(APIClient, name, NetConfig.MlbOperatorNamespace,
peerIP, tsparams.LocalBGPASN, tsparams.LocalBGPASN).WithPassword(tsparams.BGPPassword).Create()

return err
Copy link
Collaborator

Choose a reason for hiding this comment

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

validate error here

return ipAddressPool
}

func createBGPPeer(name, peerIP string) error {
Copy link
Collaborator

Choose a reason for hiding this comment

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

why don't use createBGPPeerAndVerifyIfItsReady?

Comment on lines +255 to +256
setupMetalLbService("service-1", netparam.IPV4Family, ipAddressPool1, "Cluster")
setupMetalLbService("service-2", netparam.IPV4Family, ipAddressPool2, "Cluster")
Copy link
Collaborator

Choose a reason for hiding this comment

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

is that expected that you create 2 the same services with different name in case single IP addressPool?

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.

2 participants