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

Fixing the NIC/Subnet tests #122

Merged
merged 4 commits into from
Jun 22, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions azurerm/resource_arm_network_interface_card.go
Original file line number Diff line number Diff line change
Expand Up @@ -324,12 +324,12 @@ func resourceArmNetworkInterfaceRead(d *schema.ResourceData, meta interface{}) e
d.Set("network_security_group_id", resp.NetworkSecurityGroup.ID)
}

d.Set("name", resp.Name)
d.Set("resource_group_name", resGroup)
d.Set("location", azureRMNormalizeLocation(*resp.Location))
d.Set("applied_dns_servers", appliedDNSServers)
d.Set("dns_servers", dnsServers)
d.Set("enable_ip_forwarding", resp.EnableIPForwarding)
d.Set("location", resp.Location)
d.Set("name", resp.Name)
d.Set("resource_group_name", resGroup)

flattenAndSetTags(d, resp.Tags)

Expand Down
41 changes: 19 additions & 22 deletions azurerm/resource_arm_network_interface_card_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,8 @@ func TestAccAzureRMNetworkInterface_bug7986(t *testing.T) {
{
Config: testAccAzureRMNetworkInterface_bug7986(rInt),
Check: resource.ComposeTestCheckFunc(
testCheckAzureRMNetworkInterfaceExists("azurerm_network_interface.test"),
testCheckAzureRMNetworkInterfaceExists("azurerm_network_interface.test1"),
Copy link
Member

Choose a reason for hiding this comment

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

Same question - should we check azurerm_network_interface.test2 here as well?

testCheckAzureRMNetworkInterfaceExists("azurerm_network_interface.test2"),
),
},
},
Expand Down Expand Up @@ -505,26 +506,28 @@ resource "azurerm_network_security_group" "test" {
location = "${azurerm_resource_group.test.location}"
resource_group_name = "${azurerm_resource_group.test.name}"

security_rule {
name = "test123"
priority = 100
direction = "Inbound"
access = "Allow"
protocol = "Tcp"
source_port_range = "*"
destination_port_range = "*"
source_address_prefix = "*"
destination_address_prefix = "*"
}

tags {
environment = "Production"
}
}

resource "azurerm_network_security_rule" "test" {
name = "test"
priority = 100
resource "azurerm_network_security_rule" "test1" {
name = "test1"
priority = 101
direction = "Outbound"
access = "Allow"
protocol = "Tcp"
source_port_range = "*"
destination_port_range = "*"
source_address_prefix = "*"
destination_address_prefix = "*"
resource_group_name = "${azurerm_resource_group.test.name}"
network_security_group_name = "${azurerm_network_security_group.test.name}"
}

resource "azurerm_network_security_rule" "test2" {
name = "test2"
priority = 102
direction = "Outbound"
access = "Allow"
protocol = "Tcp"
Expand Down Expand Up @@ -552,12 +555,6 @@ resource "azurerm_virtual_network" "test" {
address_space = ["10.0.0.0/16"]
resource_group_name = "${azurerm_resource_group.test.name}"
location = "${azurerm_resource_group.test.location}"

subnet {
name = "second"
address_prefix = "10.0.3.0/24"
security_group = "${azurerm_network_security_group.test.id}"
}
}

resource "azurerm_subnet" "test" {
Expand Down
7 changes: 4 additions & 3 deletions azurerm/resource_arm_subnet_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ func TestAccAzureRMSubnet_bug7986(t *testing.T) {
{
Config: initConfig,
Check: resource.ComposeTestCheckFunc(
testCheckAzureRMSubnetExists("azurerm_subnet.test"),
testCheckAzureRMSubnetExists("azurerm_subnet.first"),
Copy link
Member

Choose a reason for hiding this comment

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

Any particular reason not to check the second subnet here too?

testCheckAzureRMSubnetExists("azurerm_subnet.second"),
),
},
},
Expand Down Expand Up @@ -445,7 +446,7 @@ resource "azurerm_subnet" "first" {
}

resource "azurerm_route_table" "second" {
name = "$acctest%d-private-2"
name = "acctest%d-private-2"
location = "${azurerm_resource_group.test.location}"
resource_group_name = "${azurerm_resource_group.test.name}"
}
Expand All @@ -459,7 +460,7 @@ resource "azurerm_route" "second" {
}

resource "azurerm_subnet" "second" {
name = "acctest%d-private-1"
name = "acctest%d-private-2"
resource_group_name = "${azurerm_resource_group.test.name}"
virtual_network_name = "${azurerm_virtual_network.test.name}"
address_prefix = "10.0.1.0/24"
Expand Down