tests for nginx-otel

Signed-off-by: Ava Hahn <a.hahn@f5.com>
This commit is contained in:
Ava Hahn 2025-01-22 19:08:52 -08:00
parent 1ed551b70b
commit e7b504fa40
5 changed files with 15 additions and 15 deletions

View file

@ -35,18 +35,18 @@ For Otel module build and tests:
- c-ares
- linux-headers
- g++ / clang++ / etc
- python3, pytest, pip
- protobuf, grpc
### FreeBSD
- need to install bash
- need to set login shell to bash
- need to install pkgconfig
### Fedora
- install zlib-ng-compat-devel and zlib-ng-compat-static for zlib, not zlibrary-devel or zlib-ng-devel.
- fedora also seems to need the openssl-devel-engine package.
### Alpine
- need to install clang instead of gcc
## Usage
Invoke `test.sh` with some or all of the following flags:
- `--nginx <nginx>` takes an nginx code directory and builds it on remote hosts

View file

@ -55,7 +55,7 @@ function parallel_invoke_and_wait() {
wait $p
local code=$?
log "procedure with input $input returned $code"
if [[ $3 && ! $code == 0 ]]; then # needs to catch code==2, etc
if [[ $3 && ! $code == 0 ]]; then
log "tail of related logs..."
tail ${3}${input}.log
log "see more in ${3}${input}.log"

View file

@ -69,12 +69,17 @@ function clean_nginx() {
function build_otel() {
mkdir -p build && \
cd build && \
cmake -DNGX_OTEL_NGINX_BUILD_DIR=../../nginx/objs .. && \
cmake -DCMAKE_CXX_COMPILER=$(which g++) \
-DNGX_OTEL_NGINX_BUILD_DIR=../../nginx/objs \
-DNGX_OTEL_GRPC=package \
-DCMAKE_CXX_FLAGS="-D_LARGEFILE64_SOURCE" .. && \
make -j$(num_jobs)
}
function test_otel() {
echo "UNIMPLEMENTED!"
pip install --break-system-packages -r tests/requirements.txt
pytest tests --maxfail=10 --nginx=../nginx/objs/nginx \
--module=build/ngx_otel_module.so
}
function clean_otel() {

10
test.sh
View file

@ -47,7 +47,7 @@ while [ $# -gt 0 ]; do
log "tests flag requires valid dir" && \
exit 1 )
[ $nginx_dir ] || [ $otel_dir ] || ( \
log "must set nginx flag before tests flag" && \
log "must set nginx or otel flag before tests flag" && \
exit 1 )
tests_dir=$2
;;
@ -56,11 +56,7 @@ while [ $# -gt 0 ]; do
[ $2 ] || ( \
log "VM must be specified" && \
exit 1 )
[[ $vms_available == *"$2"* ]] || ( \
log "VM not available" && \
exit 1 )
[ $vm_list ] && vm_list+="\n"
vm_list+=$2
vm_list="${vm_list}$2"$'\n'
;;
*)
@ -76,7 +72,7 @@ done
[ $otel_dir ] && vm_otel_dir=$(basename $otel_dir)
[ $tests_dir ] && vm_tests_dir=$(basename $tests_dir)
if [ ! $vm_list ]; then
if [[ ! $vm_list ]]; then
vm_list=$(vms_avail)
fi

View file

@ -164,11 +164,10 @@ function vsh() {
exit 1
fi
get_vm_ip $1
sshpass -p $PASSP \
ssh -o PreferredAuthentications=password \
-o StrictHostKeyChecking=no \
$USERN@$ret
$USERN@$(get_vm_ip $1)
turn_off_vm $1
}