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

Added acceptance test for Dhcp options in various resources that supports it #65

Merged
merged 15 commits into from
Feb 15, 2024

Conversation

AnilGadiyarHJ
Copy link
Collaborator

api_subnet_resource
api_range_resource
api_ip_space_resource
api_fixed_address_resource
api_address_block_resource
api_server
https://infoblox.atlassian.net/browse/DDIA-212

@AnilGadiyarHJ AnilGadiyarHJ marked this pull request as ready for review February 7, 2024 10:16
Comment on lines 73 to 78
{
description = "Option 1"
option_code = "234"
option_value = "true"
type = "boolean"
}
Copy link
Collaborator

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 will work. description is not a field part of dhcp_options. Also option_code is an UUID for the dhcp_option_code object and not just the code. And type here is either option or group.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

Comment on lines 99 to 101
PlanModifiers: []planmodifier.List{
listplanmodifier.RequiresReplaceIfConfigured(),
},
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why did you add this? This will basically delete the range and recreate it every time the dhcp_options is modified.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

DHCP option has 2 types, we can either create via option & group. we have added both in function steps and the update was not working when steps were creating DHCP option via option type and then update group type.

Comment on lines 61 to 67
resource "bloxone_dhcp_option_code" "option_code" {
code = 250
name = "example_option_code"
option_space = bloxone_dhcp_option_space.option_space.id
type = "int32"
}

Copy link
Collaborator

Choose a reason for hiding this comment

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

I would rather use a data source to get an existing Option Code (like for ex. option 6). This is a more common scenario.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

return strings.Join([]string{testAccOptionSpace("test_option_space", "ip4"), config}, "")
}

func testAccOptionBasicConfigV6() string {
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
func testAccOptionBasicConfigV6() string {
func testAccBaseWithV6OptionSpaceAndCode() string {

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

return strings.Join([]string{testAccBaseWithIPSpace(), testAccOptionBasicConfig(), config}, "")
}

func testAccOptionBasicConfig() string {
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
func testAccOptionBasicConfig() string {
func testAccBaseWithOptionSpaceAndCode() string {

Copy link
Collaborator

Choose a reason for hiding this comment

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

If this function is already used in the basic test, do not reuse it, create another function with the above 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.

This is a new function created. renamed it

Comment on lines 242 to 244
PlanModifiers: []planmodifier.List{
listplanmodifier.RequiresReplaceIfConfigured(),
},
Copy link
Collaborator

Choose a reason for hiding this comment

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

This one still needs to be removed.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

@@ -2,6 +2,7 @@ package ipam

import (
"context"

Copy link
Collaborator

Choose a reason for hiding this comment

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

line break not needed here

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

@@ -2,6 +2,7 @@ package ipam

import (
"context"

Copy link
Collaborator

Choose a reason for hiding this comment

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

line break not needed here

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

dhcp_options = [
{
option_code = data.bloxone_dhcp_option_codes.option_code.results.0.id
option_value = "1.1.1.1"
Copy link
Collaborator

Choose a reason for hiding this comment

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

can you change all 1.1.1.1 to 10.0.0.1 instead.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

@mathewab mathewab merged commit 0faa944 into infobloxopen:master Feb 15, 2024
3 checks passed
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