Merge pull request 'add pprof upload test' (#141) from thefox/end-to-end:pprof_upload_test into main
Reviewed-on: https://code.forgejo.org/forgejo/end-to-end/pulls/141 Reviewed-by: earl-warren <earl-warren@noreply.code.forgejo.org>
This commit is contained in:
commit
4f34b12bb2
3 changed files with 41 additions and 0 deletions
|
@ -7,6 +7,7 @@ DOMAIN = ${IP}
|
||||||
HTTP_PORT = 3000
|
HTTP_PORT = 3000
|
||||||
SSH_LISTEN_PORT = 2222
|
SSH_LISTEN_PORT = 2222
|
||||||
LFS_START_SERVER = true
|
LFS_START_SERVER = true
|
||||||
|
ENABLE_PPROF = true
|
||||||
|
|
||||||
[queue]
|
[queue]
|
||||||
TYPE = immediate
|
TYPE = immediate
|
||||||
|
|
38
upgrade/test-pprof-upload.sh
Normal file
38
upgrade/test-pprof-upload.sh
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
# SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
|
function test_upload_profiles() {
|
||||||
|
FORGEJO_URL="http://localhost:6060"
|
||||||
|
PROFILECLI_URL="http://0.0.0.0:4040"
|
||||||
|
|
||||||
|
endpoints=("/debug/pprof/allocs" "/debug/pprof/block" "/debug/pprof/goroutine" "/debug/pprof/mutex" "/debug/pprof/profile?seconds=5")
|
||||||
|
curl -fL https://github.com/grafana/pyroscope/releases/download/v1.1.5/profilecli_1.1.5_linux_amd64.tar.gz -o profilecli.tar.gz
|
||||||
|
tar xzf profilecli.tar.gz
|
||||||
|
|
||||||
|
for endpoint in "${endpoints[@]}"; do
|
||||||
|
output=$(basename "$endpoint")
|
||||||
|
if [[ $endpoint == *"/profile"* ]]; then
|
||||||
|
output="profile"
|
||||||
|
fi
|
||||||
|
output="${output}.pprof"
|
||||||
|
# Download the content and save it to a file
|
||||||
|
curl -s "${FORGEJO_URL}${endpoint}" -o "${output}"
|
||||||
|
./profilecli upload ${output} --url=${PROFILECLI_URL}
|
||||||
|
|
||||||
|
rm ${output}
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
function test_forgejo_pprof() {
|
||||||
|
stop
|
||||||
|
docker run --name test_pyroscope --rm -d -p 4040:4040 docker.io/grafana/pyroscope
|
||||||
|
|
||||||
|
log_info "run 8.0-test"
|
||||||
|
|
||||||
|
start 8.0-test
|
||||||
|
|
||||||
|
test_upload_profiles
|
||||||
|
stop
|
||||||
|
|
||||||
|
docker stop test_pyroscope
|
||||||
|
|
||||||
|
}
|
|
@ -50,6 +50,7 @@ function test_successful_upgrades() {
|
||||||
}
|
}
|
||||||
|
|
||||||
source $UPGRADE_DIR/test-upgrade-forgejo-database-v3.sh
|
source $UPGRADE_DIR/test-upgrade-forgejo-database-v3.sh
|
||||||
|
source $UPGRADE_DIR/test-pprof-upload.sh
|
||||||
|
|
||||||
function test_upgrades() {
|
function test_upgrades() {
|
||||||
run dependencies
|
run dependencies
|
||||||
|
@ -57,4 +58,5 @@ function test_upgrades() {
|
||||||
|
|
||||||
run test_successful_upgrades
|
run test_successful_upgrades
|
||||||
run test_forgejo_database_v3_upgrades
|
run test_forgejo_database_v3_upgrades
|
||||||
|
run test_forgejo_pprof
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue