Skip to content

Commit

Permalink
BUG/MINOR: add missing hash-balance-factor for defaults and backend
Browse files Browse the repository at this point in the history
  • Loading branch information
hdurand0710 committed Apr 9, 2024
1 parent be62090 commit 554caca
Show file tree
Hide file tree
Showing 9 changed files with 35 additions and 8 deletions.
7 changes: 7 additions & 0 deletions configuration/backend_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,13 @@ func TestGetBackends(t *testing.T) { //nolint:gocognit,gocyclo
t.Errorf("EmailAlert.Mailers is not localmailer1: %v", *b.EmailAlert.Mailers)
}

if b.Name == "test" && (b.HashBalanceFactor == nil) {
t.Errorf("%v: HashBalanceFactor is nil", b.Name)
} else {
if b.Name == "test" && *b.HashBalanceFactor != 150 {
t.Errorf("%v: HashBalanceFactor not 150: %v", b.Name, *b.HashBalanceFactor)
}
}
}
}

Expand Down
2 changes: 2 additions & 0 deletions configuration/configuration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ defaults test_defaults
mode http
bind-process 1-4
balance roundrobin
hash-balance-factor 150
defaults test_defaults_2 from test_defaults
option srvtcpka
Expand Down Expand Up @@ -567,6 +568,7 @@ backend test
balance roundrobin
bind-process all
hash-type consistent sdbm avalanche
hash-balance-factor 150
log-tag bla
option http-keep-alive
option forwardfor header X-Forwarded-For
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ require (
github.com/google/go-cmp v0.6.0
github.com/google/renameio v1.0.1
github.com/google/uuid v1.6.0
github.com/haproxytech/config-parser/v5 v5.1.1-0.20240221073837-5b782186def2
github.com/haproxytech/config-parser/v5 v5.1.1-0.20240408103122-267515d6336b
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51
github.com/mitchellh/mapstructure v1.5.0
github.com/pkg/errors v0.9.1
Expand All @@ -32,6 +32,6 @@ require (
github.com/oklog/ulid v1.3.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
go.mongodb.org/mongo-driver v1.13.1 // indirect
golang.org/x/sys v0.17.0 // indirect
golang.org/x/sys v0.19.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
12 changes: 6 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ github.com/google/renameio v1.0.1 h1:Lh/jXZmvZxb0BBeSY5VKEfidcbcbenKjZFzM/q0fSeU
github.com/google/renameio v1.0.1/go.mod h1:t/HQoYBZSsWSNK35C6CO/TpPLDVWvxOHboWUAweKUpk=
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/haproxytech/config-parser/v5 v5.1.1-0.20240221073837-5b782186def2 h1:YXI/15X8xJPrnyO8brmiNaFhOD17Ib9nszHRrlEtuIw=
github.com/haproxytech/config-parser/v5 v5.1.1-0.20240221073837-5b782186def2/go.mod h1:iy8nBB1eopwYbyeh3FQpjxZUxfcIDyTV9bW0F1t+cVA=
github.com/haproxytech/config-parser/v5 v5.1.1-0.20240408103122-267515d6336b h1:7mp51CTK3V+D7c7CInseuMBhFSaQU0mf2gs8z0pzZbU=
github.com/haproxytech/config-parser/v5 v5.1.1-0.20240408103122-267515d6336b/go.mod h1:T2iWRfXW84pxyk3PlYresm1ntHodIWgBN6ZxzB5Yqow=
github.com/haproxytech/go-logger v1.1.0 h1:HgGtYaI1ApkvbQdsm7f9AzQQoxTB7w37criTflh7IQE=
github.com/haproxytech/go-logger v1.1.0/go.mod h1:OekUd8HCb7ubxMplzHUPBTHNxZmddOWfOjWclZsqIeM=
github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY=
Expand All @@ -54,8 +54,8 @@ github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M=
github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA=
github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8=
github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4=
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI=
Expand All @@ -81,8 +81,8 @@ golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y=
golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.19.0 h1:q5f1RH2jigJ1MoAWp2KTp3gm5zAGFUTarQZ5U386+4o=
golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
Expand Down
3 changes: 3 additions & 0 deletions models/backend.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions models/defaults.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions specification/build/haproxy_spec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2000,6 +2000,9 @@ definitions:
- disabled
type: string
x-display-name: H1 Adjust Bogus Server
hash_balance_factor:
type: integer
x-nullable: true
hash_type:
$ref: '#/definitions/hash_type'
http-buffer-request:
Expand Down Expand Up @@ -2779,6 +2782,9 @@ definitions:
mode:
value: http
x-display-name: H1 Adjust Bogus Server
hash_balance_factor:
type: integer
x-nullable: true
hash_type:
$ref: '#/definitions/hash_type'
http-buffer-request:
Expand Down
3 changes: 3 additions & 0 deletions specification/models/configuration/backend.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ backend:
$ref: "#/definitions/persist_rule"
hash_type:
$ref: "#/definitions/hash_type"
hash_balance_factor:
type: integer
x-nullable: true
http-check:
$ref: "#/definitions/http_check"
bind_process:
Expand Down
3 changes: 3 additions & 0 deletions specification/models/configuration/defaults.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ defaults:
$ref: "#/definitions/balance"
hash_type:
$ref: "#/definitions/hash_type"
hash_balance_factor:
type: integer
x-nullable: true
persist_rule:
$ref: "#/definitions/persist_rule"
maxconn:
Expand Down

0 comments on commit 554caca

Please sign in to comment.