1
0
Fork 0

Merge branch v2.11 into v3.0

This commit is contained in:
Fernandez Ludovic 2024-06-04 23:58:38 +02:00
commit 6ca4c5da5c
20 changed files with 220 additions and 217 deletions

View file

@ -162,7 +162,7 @@ func findTypedField(rType reflect.Type, node *parser.Node) (reflect.StructField,
return reflect.StructField{}, false
}
for i := 0; i < rType.NumField(); i++ {
for i := range rType.NumField() {
cField := rType.Field(i)
// ignore unexported fields.

View file

@ -121,7 +121,7 @@ func Test_MinSize(t *testing.T) {
var bodySize int
h := mustNewWrapper(t, cfg)(http.HandlerFunc(
func(rw http.ResponseWriter, req *http.Request) {
for i := 0; i < bodySize; i++ {
for range bodySize {
// We make sure to Write at least once less than minSize so that both
// cases below go through the same algo: i.e. they start buffering
// because they haven't reached minSize.

View file

@ -264,7 +264,7 @@ func queryRegexp(tree *matchersTree, queries ...string) error {
// IsASCII checks if the given string contains only ASCII characters.
func IsASCII(s string) bool {
for i := 0; i < len(s); i++ {
for i := range len(s) {
if s[i] >= utf8.RuneSelf {
return false
}

View file

@ -124,7 +124,7 @@ func hostSNIRegexp(tree *matchersTree, templates ...string) error {
// isASCII checks if the given string contains only ASCII characters.
func isASCII(s string) bool {
for i := 0; i < len(s); i++ {
for i := range len(s) {
if s[i] >= utf8.RuneSelf {
return false
}

View file

@ -219,7 +219,7 @@ func varGroupName(idx int) string {
func braceIndices(s string) ([]int, error) {
var level, idx int
var idxs []int
for i := 0; i < len(s); i++ {
for i := range len(s) {
switch s[i] {
case '{':
if level++; level == 1 {

View file

@ -3878,7 +3878,7 @@ func TestFilterHealthStatuses(t *testing.T) {
err := p.Init()
require.NoError(t, err)
for i := 0; i < len(test.items); i++ {
for i := range len(test.items) {
var err error
test.items[i].ExtraConf, err = p.getExtraConf(test.items[i].Labels)
require.NoError(t, err)

View file

@ -235,7 +235,7 @@ func (p *Provider) loadConfigurationFromIngresses(ctx context.Context, client Cl
certConfigs := make(map[string]*tls.CertAndStores)
for _, ingress := range ingresses {
logger := log.Ctx(ctx).With().Str("ingress", ingress.Name).Str("namespace", ingress.Namespace).Logger()
ctx = logger.WithContext(ctx)
ctxIngress := logger.WithContext(ctx)
if !p.shouldProcessIngress(ingress, ingressClasses) {
continue
@ -247,7 +247,7 @@ func (p *Provider) loadConfigurationFromIngresses(ctx context.Context, client Cl
continue
}
err = getCertificates(ctx, ingress, client, certConfigs)
err = getCertificates(ctxIngress, ingress, client, certConfigs)
if err != nil {
logger.Error().Err(err).Msg("Error configuring TLS")
}
@ -289,7 +289,7 @@ func (p *Provider) loadConfigurationFromIngresses(ctx context.Context, client Cl
rt.TLS = rtConfig.Router.TLS
}
p.applyRouterTransform(ctx, rt, ingress)
p.applyRouterTransform(ctxIngress, rt, ingress)
conf.HTTP.Routers["default-router"] = rt
conf.HTTP.Services["default-backend"] = service
@ -336,7 +336,7 @@ func (p *Provider) loadConfigurationFromIngresses(ctx context.Context, client Cl
rt := loadRouter(rule, pa, rtConfig, serviceName)
p.applyRouterTransform(ctx, rt, ingress)
p.applyRouterTransform(ctxIngress, rt, ingress)
routerKey := strings.TrimPrefix(provider.Normalize(ingress.Namespace+"-"+ingress.Name+"-"+rule.Host+pa.Path), "-")

View file

@ -345,7 +345,7 @@ func TestListenProvidersThrottleProviderConfigReload(t *testing.T) {
// To load 5 new configs it would require 150ms (5 configs * 30ms).
// In 100ms, we should only have time to load 3 configs.
assert.LessOrEqual(t, publishedConfigCount, 3, "config was applied too many times")
assert.Greater(t, publishedConfigCount, 0, "config was not applied at least once")
assert.Positive(t, publishedConfigCount, "config was not applied at least once")
}
func TestListenProvidersSkipsEmptyConfigs(t *testing.T) {