2024-03-31 22:49:52 +02:00
|
|
|
# SPDX-License-Identifier: MIT
|
|
|
|
|
|
|
|
function test_upload_profiles() {
|
2024-04-01 18:29:54 +02:00
|
|
|
FORGEJO_URL="http://localhost:6060"
|
2024-03-31 22:49:52 +02:00
|
|
|
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")
|
2024-04-01 18:29:54 +02:00
|
|
|
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
|
2024-03-31 22:49:52 +02:00
|
|
|
|
|
|
|
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
|
2024-04-25 13:54:12 +02:00
|
|
|
docker rm -f test_pyroscope
|
2024-03-31 22:49:52 +02:00
|
|
|
docker run --name test_pyroscope --rm -d -p 4040:4040 docker.io/grafana/pyroscope
|
|
|
|
|
2024-04-25 13:54:12 +02:00
|
|
|
reset_forgejo $UPGRADE_DIR/default-app.ini
|
2024-04-13 10:42:40 +00:00
|
|
|
log_info "run 7.0-test"
|
|
|
|
start 7.0-test
|
|
|
|
test_upload_profiles
|
|
|
|
stop
|
2024-03-31 22:49:52 +02:00
|
|
|
|
2024-04-13 10:42:40 +00:00
|
|
|
log_info "run 8.0-test"
|
2024-04-02 20:15:57 +02:00
|
|
|
start 8.0-test
|
2024-03-31 22:49:52 +02:00
|
|
|
test_upload_profiles
|
|
|
|
stop
|
2024-04-13 10:42:40 +00:00
|
|
|
|
2024-03-31 22:49:52 +02:00
|
|
|
docker stop test_pyroscope
|
|
|
|
|
|
|
|
}
|