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 a new property "FlowTimeout" to Virtual Network #14665

Merged
merged 13 commits into from
Apr 8, 2021
Merged
Show file tree
Hide file tree
Changes from 3 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
8 changes: 8 additions & 0 deletions src/Network/Network.Test/ScenarioTests/VirtualNetworkTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -145,5 +145,13 @@ public void TestVirtualNetworkSubnetServiceEndpointPolicies()
{
TestRunner.RunTestScript("Test-VirtualNetworkSubnetServiceEndpointPolicies");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
[Trait(Category.Owner, NrpTeamAlias.sdnnrp)]
public void TestVirtualNetworkCRUDFlowTimeout()
{
TestRunner.RunTestScript("Test-VirtualNetworkCRUD-FlowTimeout");
}
}
}
53 changes: 53 additions & 0 deletions src/Network/Network.Test/ScenarioTests/VirtualNetworkTests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -1292,3 +1292,56 @@ function Test-VirtualNetworkSubnetServiceEndpointPolicies
Clean-ResourceGroup $rgname
}
}

<#
.SYNOPSIS
Tests creating new virtual network with flow timeout.
#>
function Test-VirtualNetworkCRUD-FlowTimeout
{
# Setup
$rgname = Get-ResourceGroupName
$rname = Get-ResourceName
$rglocation = Get-ProviderLocation ResourceManagement
$resourceTypeParent = "Microsoft.Network/virtualNetworks"
$location = Get-ProviderLocation $resourceTypeParent

try
{
# Create the resource group
$resourceGroup = New-AzResourceGroup -Name $rgname -Location $rglocation -Tags @{ testtag = "testval" }

# Create virtual network
$actual = New-AzVirtualNetwork -ResourceGroupName $rgname -name $rname -location $location -FlowTimeout 15 -AddressPrefix 10.0.0.0/16
$expected = Get-AzVirtualNetwork -ResourceGroupName $rgname -name $rname
Assert-AreEqual $expected.ResourceGroupName $actual.ResourceGroupName
Assert-AreEqual $expected.Name $actual.Name
Assert-AreEqual $expected.Location $actual.Location
Assert-NotNull $expected.ResourceGuid
Assert-AreEqual "Succeeded" $expected.ProvisioningState
Assert-AreEqual 15 $expected.FlowTimeoutInMinutes
Copy link
Contributor

Choose a reason for hiding this comment

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

Hi @Satya-anshu , our pipeline said 'Assertion failed because expected '15' does not match actual '. Could you figure it out?


# Set virtual network
$actual.FlowTimeoutInMinutes = 30
$actual = Set-AzVirtualNetwork -VirtualNetwork $actual
$expected = Get-AzVirtualNetwork -ResourceGroupName $rgname -name $rname
Assert-AreEqual 30 $expected.FlowTimeoutInMinutes

# delete
$job = Remove-AzVirtualNetwork -ResourceGroupName $actual.ResourceGroupName -name $rname -PassThru -Force -AsJob
$job | Wait-Job
$delete = $job | Receive-Job
Copy link
Contributor

@BethanyZhou BethanyZhou Apr 2, 2021

Choose a reason for hiding this comment

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

Suggested change
$job = Remove-AzVirtualNetwork -ResourceGroupName $actual.ResourceGroupName -name $rname -PassThru -Force -AsJob
$job | Wait-Job
$delete = $job | Receive-Job
$delete = Remove-AzVirtualNetwork -ResourceGroupName $actual.ResourceGroupName -Name $rname -PassThru -Force

Assert-AreEqual true $delete

$list = Get-AzVirtualNetwork -ResourceGroupName $actual.ResourceGroupName
Assert-AreEqual 0 @($list).Count

# test error handling
Assert-ThrowsContains { Set-AzVirtualNetwork -VirtualNetwork $actual } "not found";
}
finally
{
# Cleanup
Clean-ResourceGroup $rgname
}
}
Loading