Skip to content

Commit

Permalink
address lint issue
Browse files Browse the repository at this point in the history
Signed-off-by: Kensei Nakada <handbomusic@gmail.com>
  • Loading branch information
sanposhiho committed Jul 27, 2024
1 parent 22e2e2d commit 8936443
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions internal/gatewayapi/route.go
Original file line number Diff line number Diff line change
Expand Up @@ -320,28 +320,28 @@ func (t *Translator) processHTTPRouteRule(httpRoute *HTTPRouteContext, ruleIdx i
return nil, fmt.Errorf("idle timeout is not supported in envoy gateway")

Check warning on line 320 in internal/gatewayapi/route.go

View check run for this annotation

Codecov / codecov/patch

internal/gatewayapi/route.go#L319-L320

Added lines #L319 - L320 were not covered by tests
}

if rule.SessionPersistence.Type == nil || // Cookie-based session persistence is default.
*rule.SessionPersistence.Type == gwapiv1.CookieBasedSessionPersistence {
switch {

Check warning on line 323 in internal/gatewayapi/route.go

View check run for this annotation

Codecov / codecov/patch

internal/gatewayapi/route.go#L323

Added line #L323 was not covered by tests
case rule.SessionPersistence.Type == nil || // Cookie-based session persistence is default.
*rule.SessionPersistence.Type == gwapiv1.CookieBasedSessionPersistence:
sessionPersistence = &ir.SessionPersistence{
Cookie: &ir.CookieBasedSessionPersistence{
Name: *rule.SessionPersistence.SessionName,
},

Check warning on line 329 in internal/gatewayapi/route.go

View check run for this annotation

Codecov / codecov/patch

internal/gatewayapi/route.go#L325-L329

Added lines #L325 - L329 were not covered by tests
}

if rule.SessionPersistence.AbsoluteTimeout != nil {
ttl, err := time.ParseDuration(string(*rule.SessionPersistence.AbsoluteTimeout))
if err != nil {
return nil, err

Check warning on line 334 in internal/gatewayapi/route.go

View check run for this annotation

Codecov / codecov/patch

internal/gatewayapi/route.go#L331-L334

Added lines #L331 - L334 were not covered by tests
}
sessionPersistence.Cookie.TTL = &metav1.Duration{Duration: ttl}

Check warning on line 336 in internal/gatewayapi/route.go

View check run for this annotation

Codecov / codecov/patch

internal/gatewayapi/route.go#L336

Added line #L336 was not covered by tests
}
} else if *rule.SessionPersistence.Type == gwapiv1.HeaderBasedSessionPersistence {
case *rule.SessionPersistence.Type == gwapiv1.HeaderBasedSessionPersistence:
sessionPersistence = &ir.SessionPersistence{
Header: &ir.HeaderBasedSessionPersistence{
Name: *rule.SessionPersistence.SessionName,
},

Check warning on line 342 in internal/gatewayapi/route.go

View check run for this annotation

Codecov / codecov/patch

internal/gatewayapi/route.go#L338-L342

Added lines #L338 - L342 were not covered by tests
}
} else {
default:

Check warning on line 344 in internal/gatewayapi/route.go

View check run for this annotation

Codecov / codecov/patch

internal/gatewayapi/route.go#L344

Added line #L344 was not covered by tests
// Unknown session persistence type is specified.
return nil, fmt.Errorf("unknown session persistence type %s", *rule.SessionPersistence.Type)

Check warning on line 346 in internal/gatewayapi/route.go

View check run for this annotation

Codecov / codecov/patch

internal/gatewayapi/route.go#L346

Added line #L346 was not covered by tests
}
Expand Down

0 comments on commit 8936443

Please sign in to comment.