Skip to content

Conversation

@kwanhur
Copy link
Contributor

@kwanhur kwanhur commented Mar 18, 2020

fetch ipvs info with API info := i.GetInfo()

fetch version number just call info.Version.String(), example: 1.2.1
fetch connection table size call info.ConnTableSize, example: 4096 .

ipvs.go Outdated

ver := uint(res.version)
return &Info{
Version: &Version{
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we put the conversion of ver to Version in a separate function so we can add unit tests?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

version as one attribute of ipvsInfo, we should test it as a whole? like test case TestInfo

Copy link
Member

Choose a reason for hiding this comment

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

@kwanhur I agree with @andrewsykim.
We can test different inputs for the conversion and not rely on the netlink of the test system.

}

// parseInfo given a ipvs netlink response this function will respond with a valid info entry, an error otherwise
func (i *Handle) parseInfo(msg []byte) (*ipvsInfo, error) {
Copy link
Member

Choose a reason for hiding this comment

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

I don't think this needs to be bound to *Handle?

@kwanhur
Copy link
Contributor Author

kwanhur commented Sep 17, 2021

@andrewsykim @cpuguy83 add two api GetVersion GetConnectionTableSize, review them pls :-)

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