Skip to content

Commit 2b23702

Browse files
committed
TEST/MINOR: haproxy_2.5: various fixes for haproxy 2.5
1 parent 9e3edf6 commit 2b23702

File tree

6 files changed

+25
-7
lines changed

6 files changed

+25
-7
lines changed

e2e/libs/haproxy_version.bash

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
function haproxy_version() {
2727
read -r SC RES < <(deprecated_auth_curl GET "/v2/services/haproxy/runtime/info")
2828
V="$(get_json_path "$RES" ".[0].info.version")"
29+
debug $RES
30+
debug $V
2931
echo "$V"
3032
}
3133

e2e/tests/sites/data/post.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
{
3838
"address": "127.0.0.1",
3939
"name": "site_listener_2",
40-
"port": 8080
40+
"port": 8081
4141
}
4242
],
4343
"maxconn": 2000,

e2e/tests/sites/data/put.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,12 @@
3232
{
3333
"address": "127.0.0.1",
3434
"name": "site_listener_1",
35-
"port": 8080
35+
"port": 8081
3636
},
3737
{
3838
"address": "127.0.0.1",
3939
"name": "site_listener_2",
40-
"port": 8081
40+
"port": 8082
4141
}
4242
],
4343
"maxconn": 3000,

e2e/tests/storage_ssl_certificates/data/haproxy.cfg

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,3 @@ frontend test_storage_ssl_certificates
3434

3535
backend test_storage_ssl_certificates
3636
server appx 127.0.0.1:8080 check disabled
37-

e2e/tests/storage_ssl_certificates/test.bats

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ load '../../libs/dataplaneapi'
1919
load "../../libs/get_json_path"
2020
load '../../libs/resource_client'
2121
load '../../libs/version'
22+
load '../../libs/haproxy_config_setup'
23+
load '../../libs/haproxy_version'
2224

2325
load 'utils/_helpers'
2426

@@ -127,6 +129,8 @@ load 'utils/_helpers'
127129
}
128130

129131
@test "storage_ssl_certificates: Add a ssl certificate file with force reload" {
132+
run docker cp "${BATS_TEST_DIRNAME}/data/3.pem" "${DOCKER_CONTAINER_NAME}:/etc/haproxy/ssl/"
133+
assert_success
130134

131135
refute dpa_docker_exec 'ls /etc/haproxy/ssl/1.pem?force_reload=true'
132136

@@ -148,10 +152,17 @@ load 'utils/_helpers'
148152
new_logs=$(docker logs dataplaneapi-e2e 2>&1 | tail -n $new_logs_count)
149153

150154
echo -e "$new_logs" # this will help debugging if the test fails
151-
assert echo -e "$new_logs" | head -n 1 | grep -q "Reexecuting Master process"
155+
if haproxy_version_ge "2.5"
156+
then
157+
assert echo -e "$new_logs" | grep -q "Loading success"
158+
else
159+
assert echo -e "$new_logs" | head -n 1 | grep -q "Reexecuting Master process"
160+
fi
152161
}
153162

154163
@test "storage_ssl_certificates: Replace a ssl certificate file contents with force reload" {
164+
run docker cp "${BATS_TEST_DIRNAME}/data/3.pem" "${DOCKER_CONTAINER_NAME}:/etc/haproxy/ssl/"
165+
assert_success
155166

156167
pre_logs_count=$(docker logs dataplaneapi-e2e 2>&1 | wc -l)
157168

@@ -167,7 +178,12 @@ load 'utils/_helpers'
167178
new_logs=$(docker logs dataplaneapi-e2e 2>&1 | tail -n $new_logs_count)
168179

169180
echo -e "$new_logs" # this will help debugging if the test fails
170-
assert echo -e "$new_logs" | head -n 1 | grep -q "Reexecuting Master process"
181+
if haproxy_version_ge "2.5"
182+
then
183+
assert echo -e "$new_logs" | grep -q "Loading success"
184+
else
185+
assert echo -e "$new_logs" | head -n 1 | grep -q "Reexecuting Master process"
186+
fi
171187

172188
# clean up after the test
173189
dpa_docker_exec 'rm /etc/haproxy/ssl/1.pem'

e2e/tests/transactions/commit.bats

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
load '../../libs/dataplaneapi'
1919
load '../../libs/get_json_path'
2020
load '../../libs/resource_client'
21+
load '../../libs/haproxy_config_setup'
2122
load '../../libs/version'
2223

2324
load 'utils/_helpers'
@@ -39,7 +40,7 @@ load 'utils/_helpers'
3940

4041
# retrieve other transactions
4142
resource_get "$_TRANSACTIONS_BASE_PATH"
42-
assert_equal "$SC" 200
43+
assert_equal "$SC" 200
4344
# iterate over them, should fail with 406 status code
4445
for tx in $(echo "${BODY}" | jq -r '.[].id'); do
4546
resource_put "$_TRANSACTIONS_BASE_PATH/${tx}" ""

0 commit comments

Comments
 (0)