Skip to content

Commit 2024730

Browse files
committed
add permission for https_admin:true test in access_log
1 parent f1477e4 commit 2024730

File tree

1 file changed

+54
-44
lines changed

1 file changed

+54
-44
lines changed

t/cli/test_access_log.sh

Lines changed: 54 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -179,50 +179,60 @@ make stop
179179

180180
echo "don't log uninitialized access log variable when the HTTP request is malformed"
181181

182-
# # TLS upstream
183-
184-
# echo "
185-
# deployment:
186-
# admin:
187-
# admin_listen:
188-
# port: 9180
189-
# https_admin: true
190-
# admin_api_mtls:
191-
# admin_ssl_cert: '../t/certs/apisix_admin_ssl.crt'
192-
# admin_ssl_cert_key: '../t/certs/apisix_admin_ssl.key'
193-
# nginx_config:
194-
# http:
195-
# access_log_format: '\"\$upstream_scheme://\$upstream_host\" \$ssl_server_name'
196-
# " > conf/config.yaml
197-
198-
# make init
199-
# make run
200-
# sleep 2
201-
202-
# admin_key=$(yq '.deployment.admin.admin_key[0].key' conf/config.yaml | sed 's/"//g')
203-
# curl -k -i https://127.0.0.1:9180/apisix/admin/routes/1 -H "X-API-KEY: $admin_key" -X PUT -d \
204-
# '{"uri":"/apisix/admin/routes/1", "upstream":{"nodes":{"localhost:9180":1},"scheme":"https","type":"roundrobin","pass_host":"node"}}'
205-
206-
# curl -i http://127.0.0.1:9080/apisix/admin/routes/1
207-
# sleep 4
208-
# tail -n 2 logs/access.log > output.log
209-
210-
# # APISIX
211-
# if ! grep '"https://localhost:9180" -' output.log; then
212-
# echo "failed: should find upstream scheme"
213-
# cat output.log
214-
# exit 1
215-
# fi
216-
217-
# # admin
218-
# if ! grep '"http://localhost:9180" localhost' output.log; then
219-
# echo "failed: should find upstream scheme"
220-
# cat output.log
221-
# exit 1
222-
# fi
223-
224-
# make stop
225-
# echo "passed: should find upstream scheme"
182+
# TLS upstream
183+
184+
echo "
185+
deployment:
186+
admin:
187+
admin_listen:
188+
port: 9180
189+
https_admin: true
190+
admin_api_mtls:
191+
admin_ssl_cert: '../t/certs/apisix_admin_ssl.crt'
192+
admin_ssl_cert_key: '../t/certs/apisix_admin_ssl.key'
193+
nginx_config:
194+
http:
195+
access_log_format: '\"\$upstream_scheme://\$upstream_host\" \$ssl_server_name'
196+
" > conf/config.yaml
197+
# Before starting APISIX in the failing test:
198+
199+
# 1. Fix parent directory permissions
200+
sudo chmod o+x /home/runner/work/ /home/runner/work/apisix/ /home/runner/work/apisix/apisix/
201+
202+
# 2. Ensure conf/ is accessible
203+
sudo chmod -R o+rx conf/
204+
205+
# 3. Regenerate nginx.conf
206+
make init
207+
208+
# 4. Start APISIX
209+
make run
210+
sleep 2
211+
212+
admin_key=$(yq '.deployment.admin.admin_key[0].key' conf/config.yaml | sed 's/"//g')
213+
curl -k -i https://127.0.0.1:9180/apisix/admin/routes/1 -H "X-API-KEY: $admin_key" -X PUT -d \
214+
'{"uri":"/apisix/admin/routes/1", "upstream":{"nodes":{"localhost:9180":1},"scheme":"https","type":"roundrobin","pass_host":"node"}}'
215+
216+
curl -i http://127.0.0.1:9080/apisix/admin/routes/1
217+
sleep 4
218+
tail -n 2 logs/access.log > output.log
219+
220+
# APISIX
221+
if ! grep '"https://localhost:9180" -' output.log; then
222+
echo "failed: should find upstream scheme"
223+
cat output.log
224+
exit 1
225+
fi
226+
227+
# admin
228+
if ! grep '"http://localhost:9180" localhost' output.log; then
229+
echo "failed: should find upstream scheme"
230+
cat output.log
231+
exit 1
232+
fi
233+
234+
make stop
235+
echo "passed: should find upstream scheme"
226236

227237
# check stream logs
228238
echo '

0 commit comments

Comments
 (0)