Fix cmake and prometheus test build jobs (#1608)

Some actions do not build with prometheus - adding prometheus tests
fails the jobs
cmake build tests did not run due to different target folder (while
reporting success) - now the bin folder is detected
This commit is contained in:
Pavel Punsky 2024-12-10 19:38:39 -08:00 committed by GitHub
parent d63704c72d
commit 329cda4715
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 49 additions and 29 deletions

View File

@ -42,4 +42,4 @@ jobs:
- name: Integration Test - name: Integration Test
working-directory: examples working-directory: examples
run: ./run_tests.sh && ./run_tests_conf.sh && ./run_tests_prom.sh run: ./run_tests.sh && ./run_tests_conf.sh

View File

@ -35,4 +35,4 @@ jobs:
- name: Build - name: Build
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
- name: apps tests - name: apps tests
run: cd examples && ./run_tests.sh && ./run_tests_conf.sh && ./run_tests_prom.sh run: cd examples && ./run_tests.sh && ./run_tests_conf.sh

View File

@ -56,4 +56,4 @@ jobs:
- name: Integration Test - name: Integration Test
working-directory: examples working-directory: examples
run: ./run_tests.sh && ./run_tests_conf.sh && ./run_tests_prom.sh run: ./run_tests.sh && ./run_tests_conf.sh

View File

@ -1,14 +1,20 @@
#!/bin/bash #!/bin/bash
# Detect cmake build and adjust path
BINDIR="../bin"
if [ ! -f $BINDIR/turnserver ]; then
BINDIR="../build/bin"
fi
echo 'Running turnserver' echo 'Running turnserver'
../bin/turnserver --use-auth-secret --static-auth-secret=secret --realm=north.gov --allow-loopback-peers --no-cli --cert ../examples/ca/turn_server_cert.pem --pkey ../examples/ca/turn_server_pkey.pem > /dev/null & $BINDIR/turnserver --use-auth-secret --static-auth-secret=secret --realm=north.gov --allow-loopback-peers --no-cli --cert ../examples/ca/turn_server_cert.pem --pkey ../examples/ca/turn_server_pkey.pem > /dev/null &
echo 'Running peer client' echo 'Running peer client'
../bin/turnutils_peer -L 127.0.0.1 -L ::1 -L 0.0.0.0 > /dev/null & $BINDIR/turnutils_peer -L 127.0.0.1 -L ::1 -L 0.0.0.0 > /dev/null &
sleep 2 sleep 2
echo 'Running turn client TCP' echo 'Running turn client TCP'
../bin/turnutils_uclient -t -e 127.0.0.1 -X -g -u user -W secret 127.0.0.1 | grep "start_mclient: tot_send_bytes ~ 1000, tot_recv_bytes ~ 1000" > /dev/null $BINDIR/turnutils_uclient -t -e 127.0.0.1 -X -g -u user -W secret 127.0.0.1 | grep "start_mclient: tot_send_bytes ~ 1000, tot_recv_bytes ~ 1000" > /dev/null
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
echo OK echo OK
else else
@ -17,7 +23,7 @@ else
fi fi
echo 'Running turn client TLS' echo 'Running turn client TLS'
../bin/turnutils_uclient -t -S -e 127.0.0.1 -X -g -u user -W secret 127.0.0.1 | grep "start_mclient: tot_send_bytes ~ 1000, tot_recv_bytes ~ 1000" > /dev/null $BINDIR/turnutils_uclient -t -S -e 127.0.0.1 -X -g -u user -W secret 127.0.0.1 | grep "start_mclient: tot_send_bytes ~ 1000, tot_recv_bytes ~ 1000" > /dev/null
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
echo OK echo OK
else else
@ -26,7 +32,7 @@ else
fi fi
echo 'Running turn client UDP' echo 'Running turn client UDP'
../bin/turnutils_uclient -e 127.0.0.1 -X -g -u user -W secret 127.0.0.1 | grep "start_mclient: tot_send_bytes ~ 1000, tot_recv_bytes ~ 1000" > /dev/null $BINDIR/turnutils_uclient -e 127.0.0.1 -X -g -u user -W secret 127.0.0.1 | grep "start_mclient: tot_send_bytes ~ 1000, tot_recv_bytes ~ 1000" > /dev/null
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
echo OK echo OK
else else
@ -35,7 +41,7 @@ else
fi fi
echo 'Running turn client DTLS' echo 'Running turn client DTLS'
../bin/turnutils_uclient -S -e 127.0.0.1 -X -g -u user -W secret 127.0.0.1 | grep "start_mclient: tot_send_bytes ~ 1000, tot_recv_bytes ~ 1000" > /dev/null $BINDIR/turnutils_uclient -S -e 127.0.0.1 -X -g -u user -W secret 127.0.0.1 | grep "start_mclient: tot_send_bytes ~ 1000, tot_recv_bytes ~ 1000" > /dev/null
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
echo OK echo OK
else else

View File

@ -1,22 +1,29 @@
#!/bin/bash #!/bin/bash
echo 'Create turnserver.conf file'
echo "use-auth-secret" > ../bin/turnserver.conf # Detect cmake build and adjust path
echo "static-auth-secret=secret" >> ../bin/turnserver.conf BINDIR="../bin"
echo "realm=north.gov" >> ../bin/turnserver.conf if [ ! -f $BINDIR/turnserver ]; then
echo "allow-loopback-peers" >> ../bin/turnserver.conf BINDIR="../build/bin"
echo "no-cli" >> ../bin/turnserver.conf fi
echo "cert=../examples/ca/turn_server_cert.pem" >> ../bin/turnserver.conf
echo "pkey=../examples/ca/turn_server_pkey.pem" >> ../bin/turnserver.conf echo "Creating $BINDIR/turnserver.conf file"
echo "use-auth-secret" > $BINDIR/turnserver.conf
echo "static-auth-secret=secret" >> $BINDIR/turnserver.conf
echo "realm=north.gov" >> $BINDIR/turnserver.conf
echo "allow-loopback-peers" >> $BINDIR/turnserver.conf
echo "no-cli" >> $BINDIR/turnserver.conf
echo "cert=../examples/ca/turn_server_cert.pem" >> $BINDIR/turnserver.conf
echo "pkey=../examples/ca/turn_server_pkey.pem" >> $BINDIR/turnserver.conf
echo 'Running turnserver' echo 'Running turnserver'
../bin/turnserver -c ../bin/turnserver.conf > /dev/null & $BINDIR/turnserver -c $BINDIR/turnserver.conf > /dev/null &
echo 'Running peer client' echo 'Running peer client'
../bin/turnutils_peer -L 127.0.0.1 -L ::1 -L 0.0.0.0 > /dev/null & $BINDIR/turnutils_peer -L 127.0.0.1 -L ::1 -L 0.0.0.0 > /dev/null &
sleep 2 sleep 2
echo 'Running turn client TCP' echo 'Running turn client TCP'
../bin/turnutils_uclient -t -e 127.0.0.1 -X -g -u user -W secret 127.0.0.1 | grep "start_mclient: tot_send_bytes ~ 1000, tot_recv_bytes ~ 1000" > /dev/null $BINDIR/turnutils_uclient -t -e 127.0.0.1 -X -g -u user -W secret 127.0.0.1 | grep "start_mclient: tot_send_bytes ~ 1000, tot_recv_bytes ~ 1000" > /dev/null
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
echo OK echo OK
else else
@ -25,7 +32,7 @@ else
fi fi
echo 'Running turn client TLS' echo 'Running turn client TLS'
../bin/turnutils_uclient -t -S -e 127.0.0.1 -X -g -u user -W secret 127.0.0.1 | grep "start_mclient: tot_send_bytes ~ 1000, tot_recv_bytes ~ 1000" > /dev/null $BINDIR/turnutils_uclient -t -S -e 127.0.0.1 -X -g -u user -W secret 127.0.0.1 | grep "start_mclient: tot_send_bytes ~ 1000, tot_recv_bytes ~ 1000" > /dev/null
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
echo OK echo OK
else else
@ -34,7 +41,7 @@ else
fi fi
echo 'Running turn client UDP' echo 'Running turn client UDP'
../bin/turnutils_uclient -e 127.0.0.1 -X -g -u user -W secret 127.0.0.1 | grep "start_mclient: tot_send_bytes ~ 1000, tot_recv_bytes ~ 1000" > /dev/null $BINDIR/turnutils_uclient -e 127.0.0.1 -X -g -u user -W secret 127.0.0.1 | grep "start_mclient: tot_send_bytes ~ 1000, tot_recv_bytes ~ 1000" > /dev/null
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
echo OK echo OK
else else
@ -43,7 +50,7 @@ else
fi fi
echo 'Running turn client DTLS' echo 'Running turn client DTLS'
../bin/turnutils_uclient -S -e 127.0.0.1 -X -g -u user -W secret 127.0.0.1 | grep "start_mclient: tot_send_bytes ~ 1000, tot_recv_bytes ~ 1000" > /dev/null $BINDIR/turnutils_uclient -S -e 127.0.0.1 -X -g -u user -W secret 127.0.0.1 | grep "start_mclient: tot_send_bytes ~ 1000, tot_recv_bytes ~ 1000" > /dev/null
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
echo OK echo OK
else else

View File

@ -1,5 +1,12 @@
#!/bin/bash #!/bin/bash
# Detect cmake build and adjust path
BINDIR="../bin"
if [ ! -f $BINDIR/turnserver ]; then
BINDIR="../build/bin"
fi
function assert_prom_no_response() { function assert_prom_no_response() {
wget --quiet --output-document=/dev/null --tries=1 "$1" wget --quiet --output-document=/dev/null --tries=1 "$1"
status="$?" status="$?"
@ -24,35 +31,35 @@ function assert_prom_response() {
} }
echo "Running without prometheus" echo "Running without prometheus"
../bin/turnserver & $BINDIR/turnserver /dev/null &
turnserver_pid="$!" turnserver_pid="$!"
sleep 2 sleep 2
assert_prom_no_response "http://localhost:9641/metrics" assert_prom_no_response "http://localhost:9641/metrics"
kill "$turnserver_pid" kill "$turnserver_pid"
echo "Running turnserver with prometheus, using defaults" echo "Running turnserver with prometheus, using defaults"
../bin/turnserver --prometheus & $BINDIR/turnserver --prometheus > /dev/null &
turnserver_pid="$!" turnserver_pid="$!"
sleep 2 sleep 2
assert_prom_response "http://localhost:9641/metrics" assert_prom_response "http://localhost:9641/metrics"
kill "$turnserver_pid" kill "$turnserver_pid"
echo "Running turnserver with prometheus, using custom address" echo "Running turnserver with prometheus, using custom address"
../bin/turnserver --prometheus --prometheus-address="127.0.0.1" & $BINDIR/turnserver --prometheus --prometheus-address="127.0.0.1" > /dev/null &
turnserver_pid="$!" turnserver_pid="$!"
sleep 2 sleep 2
assert_prom_response "http://127.0.0.1:9641/metrics" assert_prom_response "http://127.0.0.1:9641/metrics"
kill "$turnserver_pid" kill "$turnserver_pid"
echo "Running turnserver with prometheus, using custom port" echo "Running turnserver with prometheus, using custom port"
../bin/turnserver --prometheus --prometheus-port="8080" & $BINDIR/turnserver --prometheus --prometheus-port="8080" > /dev/null &
turnserver_pid="$!" turnserver_pid="$!"
sleep 2 sleep 2
assert_prom_response "http://localhost:8080/metrics" assert_prom_response "http://localhost:8080/metrics"
kill "$turnserver_pid" kill "$turnserver_pid"
echo "Running turnserver with prometheus, using custom address and port" echo "Running turnserver with prometheus, using custom address and port"
../bin/turnserver --prometheus --prometheus-address="127.0.0.1" --prometheus-port="8080" & $BINDIR/turnserver --prometheus --prometheus-address="127.0.0.1" --prometheus-port="8080" > /dev/null &
turnserver_pid="$!" turnserver_pid="$!"
sleep 2 sleep 2
assert_prom_response "http://127.0.0.1:8080/metrics" assert_prom_response "http://127.0.0.1:8080/metrics"