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

Check if bmc hostname follows DNS Standard #1068

Merged
merged 3 commits into from
May 10, 2022

Conversation

hroyrh
Copy link
Member

@hroyrh hroyrh commented Jan 13, 2022

Adds a function to check if the bmc.address follows DNS standard and exports the GetParsedURL function to make it available in other validations.

@metal3-io-bot metal3-io-bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Jan 13, 2022
@@ -368,7 +368,7 @@ func TestParse(t *testing.T) {
},
} {
t.Run(tc.Scenario, func(t *testing.T) {
url, err := getParsedURL(tc.Address)
url, err := GetParsedURL(tc.Address)
Copy link
Contributor

Choose a reason for hiding this comment

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

I think, tests including invalid dns cases might be added?

Copy link
Contributor

Choose a reason for hiding this comment

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

We really need lots of tests to assure that is working.

}

// Check if its a IPv6/IPv4 address
if net.ParseIP(address) != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

In this line, we have a DNS value, why we are parsing assuming that it is IP?

Copy link
Member Author

Choose a reason for hiding this comment

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

In lot of tests we have IPv6 address ( and I think the BMC address hostname can be an IPv6 address) - this check is validate that. IPv4 addresses are anyways DNS standard compliant, so it doesn't need a check - I will remove IPv4 from the comment to avoid this confusion.

@ardaguclu
Copy link
Contributor

This PR looks good to me, but I'll not label to someone else have a look at;

/test-v1b1-centos-integration
/test-v1b1-integration

@zhouhao3
Copy link
Member

zhouhao3 commented Feb 10, 2022

/test-v1b1-centos-integration

Sems good to me, but like @ardaguclu said, we need to add corresponding test cases for this.

@hroyrh
Copy link
Member Author

hroyrh commented Feb 11, 2022

Would it make sense to add test cases here or at the baremetalhost_valitations level
cc @ardaguclu @zhouhao3

@zhouhao3
Copy link
Member

Would it make sense to add test cases here or at the #1040

I think both places need their own corresponding tests.

@hroyrh
Copy link
Member Author

hroyrh commented Feb 22, 2022

/test-v1b1-centos-integration
/test-v1b1-ubuntu-integration

@ardaguclu
Copy link
Contributor

/test-v1b1-centos-integration

Copy link
Member

@zhouhao3 zhouhao3 left a comment

Choose a reason for hiding this comment

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

LGTM

@dtantsur
Copy link
Member

dtantsur commented May 3, 2022

/approve

@metal3-io-bot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dtantsur

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@metal3-io-bot metal3-io-bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 3, 2022
@elfosardo
Copy link
Member

/lgtm

@metal3-io-bot metal3-io-bot added the lgtm Indicates that a PR is ready to be merged. label May 10, 2022
@metal3-io-bot metal3-io-bot merged commit 1a93d47 into metal3-io:main May 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants