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

Automated cherry pick of #85990: Fix LoadBalancer rule checking so that no unexpected #86054

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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -1643,7 +1643,7 @@ func equalLoadBalancingRulePropertiesFormat(s *network.LoadBalancingRuleProperti
reflect.DeepEqual(s.EnableTCPReset, t.EnableTCPReset) &&
reflect.DeepEqual(s.DisableOutboundSnat, t.DisableOutboundSnat)

if wantLB {
if wantLB && s.IdleTimeoutInMinutes != nil && t.IdleTimeoutInMinutes != nil {
return properties && reflect.DeepEqual(s.IdleTimeoutInMinutes, t.IdleTimeoutInMinutes)
}
return properties
Expand Down
Expand Up @@ -173,6 +173,40 @@ func TestFindRule(t *testing.T) {
},
expected: false,
},
{
msg: "rule names match while idletimeout unmatch should return false",
existingRule: []network.LoadBalancingRule{
{
Name: to.StringPtr("httpRule"),
LoadBalancingRulePropertiesFormat: &network.LoadBalancingRulePropertiesFormat{
IdleTimeoutInMinutes: to.Int32Ptr(1),
},
},
},
curRule: network.LoadBalancingRule{
Name: to.StringPtr("httpRule"),
LoadBalancingRulePropertiesFormat: &network.LoadBalancingRulePropertiesFormat{
IdleTimeoutInMinutes: to.Int32Ptr(2),
},
},
expected: false,
},
{
msg: "rule names match while idletimeout nil should return true",
existingRule: []network.LoadBalancingRule{
{
Name: to.StringPtr("httpRule"),
LoadBalancingRulePropertiesFormat: &network.LoadBalancingRulePropertiesFormat{},
},
},
curRule: network.LoadBalancingRule{
Name: to.StringPtr("httpRule"),
LoadBalancingRulePropertiesFormat: &network.LoadBalancingRulePropertiesFormat{
IdleTimeoutInMinutes: to.Int32Ptr(2),
},
},
expected: true,
},
{
msg: "rule names match while LoadDistribution unmatch should return false",
existingRule: []network.LoadBalancingRule{
Expand Down