Skip to content

Commit 7b6d352

Browse files
committed
TEST/MEDIUM: haproxy.cfg: fix test fixtures to pass reloads
1 parent 5e8f0c0 commit 7b6d352

File tree

13 files changed

+25
-40
lines changed

13 files changed

+25
-40
lines changed

e2e/tests/backend_switching_rules/data/haproxy.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,4 @@ backend second_backend
4545
backend test_backend
4646
mode http
4747
balance roundrobin
48-
option forwardfor
48+
option forwardfor

e2e/tests/binds/data/haproxy.cfg

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,6 @@ defaults
2828
frontend test_frontend
2929
mode tcp
3030
maxconn 1000
31-
bind 192.168.1.1:80 name fixture
32-
bind 192.168.2.2:8080 name loopback
33-
option httpclose
31+
bind localhost:9000 name fixture
32+
bind localhost:9090 name loopback
33+
option httpclose

e2e/tests/binds/data/post.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"address": "127.0.0.1",
33
"name": "test_bind",
4-
"port": 80,
4+
"port": 10000,
55
"defer_accept": true,
66
"allow_0rtt": true
77
}

e2e/tests/binds/data/put.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
"level": "user",
33
"name": "fixture",
44
"address": "127.0.0.1",
5-
"port": 8080
5+
"port": 10001
66
}

e2e/tests/global/data/put.json

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,12 @@
11
{
2-
"cpu_maps": null,
32
"runtime_apis": [
43
{
5-
"address": "/var/run/haproxy/admin.sock",
6-
"level": "admin",
7-
"mode": "660",
8-
"allow_0rtt": true,
9-
"name": "runtime_api_1"
4+
"address": "/var/lib/haproxy/stats",
5+
"level": "admin"
106
}
117
],
128
"daemon": "enabled",
13-
"lua_loads": null,
14-
"lua_prepend_path": null,
159
"master-worker": true,
1610
"maxconn": 5000,
17-
"pidfile": "/var/run/haproxy/haproxy.pid"
11+
"pidfile": "/var/run/haproxy.pid"
1812
}

e2e/tests/global/replace.bats

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,7 @@ load 'utils/_helpers'
3131
assert_equal "$SC" 200
3232
assert_equal "$(get_json_path "$BODY" '.data.maxconn')" "5000"
3333
assert_equal "$(get_json_path "$BODY" '.data.daemon')" "enabled"
34-
assert_equal "$(get_json_path "$BODY" '.data.pidfile')" "/var/run/haproxy/haproxy.pid"
35-
assert_equal "$(get_json_path "$BODY" '.data.runtime_apis[0].address')" "/var/run/haproxy/admin.sock"
34+
assert_equal "$(get_json_path "$BODY" '.data.pidfile')" "/var/run/haproxy.pid"
35+
assert_equal "$(get_json_path "$BODY" '.data.runtime_apis[0].address')" "/var/lib/haproxy/stats"
3636
assert_equal "$(get_json_path "$BODY" '.data.runtime_apis[0].level')" "admin"
37-
assert_equal "$(get_json_path "$BODY" '.data.runtime_apis[0].mode')" "660"
38-
assert_equal "$(get_json_path "$BODY" '.data.runtime_apis[0].allow_0rtt')" "true"
39-
assert_equal "$(get_json_path "$BODY" '.data.runtime_apis[0].name')" "runtime_api_1"
4037
}

e2e/tests/process_manager/create.bats

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ load 'utils/_helpers'
2727
resource_post "$_PROGRAMS_BASE_PATH" "data/program.json" "force_reload=true"
2828
assert_equal "$SC" 201
2929

30-
resource_get "$_PROGRAMS_BASE_PATH/mirror"
30+
resource_get "$_PROGRAMS_BASE_PATH/test"
3131
assert_equal "$SC" 200
32-
assert_equal "mirror" "$(get_json_path "$BODY" ".data.name")"
32+
assert_equal "test" "$(get_json_path "$BODY" ".data.name")"
3333
assert_equal "nobody" "$(get_json_path "$BODY" ".data.user")"
3434
assert_equal "nobody" "$(get_json_path "$BODY" ".data.group")"
3535
}

e2e/tests/process_manager/data/haproxy.cfg

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,3 @@ defaults
2929

3030
program echo
3131
command echo "Hello, World!"
32-
33-
program dataplaneapi
34-
command /usr/local/bin/dataplaneapi --host 0.0.0.0 --port 5555 --haproxy-bin /opt/hapee-2.5/sbin/hapee-lb --config-file /etc/hapee-2.5/hapee-lb.cfg --reload-cmd "systemctl reload hapee-2.5" --reload-delay 5 --userlist haproxy-dataplaneapi
35-
no option start-on-reload
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
2-
"name": "mirror",
3-
"command": "spoa-mirror --runtime 0 --mirror-url http://test.local",
2+
"name": "test",
3+
"command": "echo true",
4+
"start-on-reload": "disabled",
45
"user": "nobody",
56
"group": "nobody"
67
}
Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
{
2-
"name": "dataplaneapi",
3-
"command": "/usr/local/bin/dataplaneapi -f /path/to/file.cfg",
4-
"start-on-reload": "disabled",
5-
"user": "nobody",
6-
"group": "nobody"
2+
"name": "echo",
3+
"command": "echo \"Hello Universe\""
74
}

e2e/tests/process_manager/get.bats

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ load '../../libs/version'
2424
load 'utils/_helpers'
2525

2626
@test "process-manager: Return one program by name" {
27-
resource_get "$_PROGRAMS_BASE_PATH/dataplaneapi"
27+
resource_get "$_PROGRAMS_BASE_PATH/echo"
2828
assert_equal "$SC" 200
29-
assert_equal "dataplaneapi" "$(get_json_path "$BODY" ".data.name")"
29+
assert_equal "echo" "$(get_json_path "$BODY" ".data.name")"
3030
}
3131

3232
@test "process-manager: Fail returning program that doesn't exist" {

e2e/tests/process_manager/list.bats

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,5 @@ load 'utils/_helpers'
2626
@test "process-manager: Return an array of programs" {
2727
resource_get "$_PROGRAMS_BASE_PATH"
2828
assert_equal "$SC" 200
29-
assert_equal 2 "$(get_json_path "$BODY" ".data | length")"
29+
assert_equal 1 "$(get_json_path "$BODY" ".data | length")"
3030
}

e2e/tests/process_manager/replace.bats

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@ load '../../libs/version'
2424
load 'utils/_helpers'
2525

2626
@test "process-manager: Replace one program" {
27-
resource_put "$_PROGRAMS_BASE_PATH/dataplaneapi" "data/program_duplicated.json" "force_reload=true"
27+
resource_put "$_PROGRAMS_BASE_PATH/echo" "data/program_duplicated.json" "force_reload=true"
2828
assert_equal "$SC" 200
2929

30-
resource_get "$_PROGRAMS_BASE_PATH/dataplaneapi"
30+
resource_get "$_PROGRAMS_BASE_PATH/echo"
3131
assert_equal "$SC" 200
32-
assert_equal "dataplaneapi" "$(get_json_path "$BODY" ".data.name")"
33-
assert_equal "/usr/local/bin/dataplaneapi -f /path/to/file.cfg" "$(get_json_path "$BODY" ".data.command")"
32+
assert_equal "echo" "$(get_json_path "$BODY" ".data.name")"
33+
assert_equal "echo \"Hello Universe\"" "$(get_json_path "$BODY" ".data.command")"
3434
}
3535

3636
@test "process-manager: Fail replacing program that doesn't exist" {

0 commit comments

Comments
 (0)