Skip to content

Commit b39dbbc

Browse files
Pratik Mohantymjuraga
authored andcommitted
BUG/MINOR: resolve-net, resolve_opt: e2e tests to allow comma separated list of arguments
1 parent 2c32cc9 commit b39dbbc

File tree

9 files changed

+33
-18
lines changed

9 files changed

+33
-18
lines changed

e2e/tests/servers/data/haproxy.cfg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,4 @@ backend test_backend
3333
server server_02 10.1.1.2:8080 check weight 80
3434
server server_03 10.1.1.2:8080 check weight 80
3535
server server_ipv6 [fd00:6:48:c85:deb:f:62:4]:80 check
36+
server server_04 192.168.1.1:80 check resolve-opts allow-dup-ip,ignore-weight resolve-net 10.0.0.0/8,10.200.200.0/12

e2e/tests/servers/data/post.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,7 @@
33
"check": "enabled",
44
"name": "test_server",
55
"port": 8080,
6-
"weight": 80
6+
"weight": 80,
7+
"resolve-net": "10.0.0.0/8,10.200.200.0/12",
8+
"resolve_opts": "allow-dup-ip,ignore-weight"
79
}

e2e/tests/servers/data/put.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
{
22
"check": "enabled",
3+
"resolve-net": "10.0.0.0/8",
4+
"resolve_opts": "allow-dup-ip",
35
"weight": 10,
46
"address": "10.1.1.2",
57
"name": "server_01",

e2e/tests/servers/delete.bats

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ load '../../libs/version'
2424
load 'utils/_helpers'
2525

2626
@test "servers: Delete a server" {
27-
for name in "server_01" "server_02" "server_03"; do
27+
for name in "server_01" "server_02" "server_03" "server_04"; do
2828
resource_delete "$_SERVER_BASE_PATH/$name" "backend=test_backend&force_reload=true"
2929
assert_equal "$SC" 204
3030
done

e2e/tests/servers/list.bats

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,16 @@ load 'utils/_helpers'
2727
resource_get "$_SERVER_BASE_PATH" "backend=test_backend"
2828
assert_equal "$SC" 200
2929

30-
assert_equal "$(get_json_path "$BODY" ".data | length")" "4"
30+
assert_equal "$(get_json_path "$BODY" ".data | length")" "5"
3131

32-
for name in "server_01" "server_02" "server_03" "server_ipv6"; do
32+
INDEX=0
33+
for name in "server_01" "server_02" "server_03" "server_ipv6" "server_04"; do
3334
assert_equal "$(get_json_path "$BODY" ".data[] | select(.name | contains(\"$name\") ).name")" "$name"
35+
if [[ "$(get_json_path "$BODY" ".data[] | select(.name | contains(\"$name\") ).name")" == "server_04" ]]; then
36+
assert_equal "$(get_json_path "$BODY" ".data[${INDEX}].check")" "enabled"
37+
assert_equal "$(get_json_path "$BODY" ".data[${INDEX}].resolve_opts")" "allow-dup-ip,ignore-weight"
38+
assert_equal "$(get_json_path "$BODY" ".data[${INDEX}].\"resolve-net\"")" "10.0.0.0/8,10.200.200.0/12"
39+
fi
40+
let INDEX=${INDEX}+1
3441
done
3542
}

e2e/tests/servers/runtime.bats

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ load 'utils/_helpers'
2828
resource_get "$_RUNTIME_SERVER_BASE_PATH" "backend=test_backend"
2929
assert_equal "$SC" 200
3030

31-
for name in "server_01" "server_02" "server_03"; do
31+
for name in "server_01" "server_02" "server_03" "server_04"; do
3232
assert_equal "$(get_json_path "$BODY" ".[] | select(.name | contains(\"$name\") ).name")" "$name"
3333
done
3434
}

embedded_spec.go

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

go.mod

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ require (
2222
github.com/go-openapi/validate v0.22.1
2323
github.com/google/renameio v1.0.1
2424
github.com/google/uuid v1.3.0
25-
github.com/haproxytech/client-native/v4 v4.1.5
26-
github.com/haproxytech/config-parser/v4 v4.1.2
25+
github.com/haproxytech/client-native/v4 v4.1.8
26+
github.com/haproxytech/config-parser/v4 v4.1.3
2727
github.com/hashicorp/consul/api v1.20.0
2828
github.com/hashicorp/hcl v1.0.0
2929
github.com/jessevdk/go-flags v1.5.0
@@ -36,7 +36,7 @@ require (
3636
github.com/sirupsen/logrus v1.9.0
3737
github.com/stretchr/testify v1.8.2
3838
golang.org/x/net v0.9.0
39-
golang.org/x/sys v0.7.0
39+
golang.org/x/sys v0.8.0
4040
gopkg.in/yaml.v2 v2.4.0
4141
)
4242

@@ -88,5 +88,6 @@ require (
8888
github.com/tklauser/numcpus v0.6.0 // indirect
8989
github.com/yusufpapurcu/wmi v1.2.2 // indirect
9090
go.mongodb.org/mongo-driver v1.11.6 // indirect
91+
golang.org/x/exp v0.0.0-20230425010034-47ecfdc1ba53 // indirect
9192
gopkg.in/yaml.v3 v3.0.1 // indirect
9293
)

go.sum

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -166,10 +166,10 @@ github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+
166166
github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
167167
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
168168
github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So=
169-
github.com/haproxytech/client-native/v4 v4.1.5 h1:DO/hrniFhutI8u5ekOc/Bqva52WDx1b9iE3SSta8JO8=
170-
github.com/haproxytech/client-native/v4 v4.1.5/go.mod h1:venI38qmOG1p1BrI7nYMLOLn9PXo9UNBpEjgPcDPSnU=
171-
github.com/haproxytech/config-parser/v4 v4.1.2 h1:gE0KKBf2x2iK5N4/wW6mYUuNt25+Gyxn7uBkknjCtZs=
172-
github.com/haproxytech/config-parser/v4 v4.1.2/go.mod h1:ATW/is/Ni9HK2F5Y1IhS5cutgy/w/abVgwRLaoqlcmo=
169+
github.com/haproxytech/client-native/v4 v4.1.8 h1:z0eZYspyxgOrZ54zCGs0YLMvN7ASGjMOicxJ9BxxtB8=
170+
github.com/haproxytech/client-native/v4 v4.1.8/go.mod h1:rCcDT6azTiPcMvEGqF80L82WmB+KasHrNV+ngVtCOuw=
171+
github.com/haproxytech/config-parser/v4 v4.1.3 h1:7gRdNtrZjxXYeKJD3XrxroWmuTYyIfX0RbIOutpl9EQ=
172+
github.com/haproxytech/config-parser/v4 v4.1.3/go.mod h1:rNjBtZBdPo66TitkcZSZOesEWiorlrB3qGC/rYDZVG0=
173173
github.com/haproxytech/go-logger v1.1.0 h1:HgGtYaI1ApkvbQdsm7f9AzQQoxTB7w37criTflh7IQE=
174174
github.com/haproxytech/go-logger v1.1.0/go.mod h1:OekUd8HCb7ubxMplzHUPBTHNxZmddOWfOjWclZsqIeM=
175175
github.com/hashicorp/consul/api v1.20.0 h1:9IHTjNVSZ7MIwjlW3N3a7iGiykCMDpxZu8jsxFJh0yc=
@@ -393,6 +393,8 @@ golang.org/x/crypto v0.0.0-20190422162423-af44ce270edf/go.mod h1:WFFai1msRO1wXaE
393393
golang.org/x/crypto v0.0.0-20190923035154-9ee001bba392/go.mod h1:/lpIB1dKB+9EgE3H3cr1v9wB50oz8l4C4h62xy7jSTY=
394394
golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
395395
golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
396+
golang.org/x/exp v0.0.0-20230425010034-47ecfdc1ba53 h1:5llv2sWeaMSnA3w2kS57ouQQ4pudlXrR0dCgw51QK9o=
397+
golang.org/x/exp v0.0.0-20230425010034-47ecfdc1ba53/go.mod h1:V1LtkGg67GoY2N1AnLN78QLrzxkLyJw7RJb1gzOOz9w=
396398
golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
397399
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
398400
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
@@ -445,8 +447,8 @@ golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBc
445447
golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
446448
golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
447449
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
448-
golang.org/x/sys v0.7.0 h1:3jlCCIQZPdOYu1h8BkNvLz8Kgwtae2cagcG/VamtZRU=
449-
golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
450+
golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU=
451+
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
450452
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
451453
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
452454
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=

0 commit comments

Comments
 (0)