Skip to content
This repository has been archived by the owner on Oct 28, 2022. It is now read-only.

Fixing bug in New-NsxLoadBalancerApplicationRule and adding #651

Merged
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
4 changes: 2 additions & 2 deletions module/PowerNSX.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -32434,8 +32434,8 @@ function New-NsxLoadBalancerApplicationRule {
#Store the edgeId and remove it from the XML as we need to post it...
$edgeId = $LoadBalancer.edgeId

if ( -not $_LoadBalancer.enabled -eq 'true' ) {
Write-Warning "Load Balancer feature is not enabled on edge $($edgeId). Use Set-NsxLoadBalancer -EnableLoadBalancing to enable."
if ( -not $LoadBalancer.enabled -eq 'true' ) {
write-warning "Load Balancer feature is not enabled on edge $($edgeId). Use Set-NsxLoadBalancer -EnableLoadBalancing to enable."
}
#Create a new XML document. Use applicationRule as root.
[System.XML.XmlDocument]$xmldoc = New-Object System.XML.XmlDocument
Expand Down
14 changes: 14 additions & 0 deletions tests/integration/20.LB.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,20 @@ Describe "Edge Load Balancer" {

}

Context "Load Balancer App Rule" {

it "Add LB App Rule" {
Get-NsxEdge -Name $lbedge1name | Get-NsxLoadBalancer | New-NsxLoadBalancerApplicationRule -Name "lb_app_rule" -Script "timeout client 100s"

$lb_app_rule = Get-NsxEdge -Name $lbedge1name | Get-NsxLoadBalancer | Get-NsxLoadBalancerApplicationRule -Name "lb_app_rule"
$lb_app_rule.name | should be "lb_app_rule"
$lb_app_rule.script | should be "timeout client 100s"

# There's no PowerNSX cmdlet to remove an application rule. Will be cleaned up as a result of deleting the Edge.
}

}

AfterAll {
#AfterAll block runs _once_ at completion of invocation regardless of number of tests/contexts/describes.
#Clean up anything you create in here. Be forceful - you want to leave the test env as you found it as much as is possible.
Expand Down