Use pytest for tests.
This commit is contained in:
parent
6c1659a20b
commit
1e183a3fa9
9 changed files with 474 additions and 2050 deletions
92
.github/workflows/ubuntu.yml
vendored
92
.github/workflows/ubuntu.yml
vendored
|
|
@ -8,71 +8,14 @@ on:
|
|||
|
||||
jobs:
|
||||
build-module:
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y cmake libc-ares-dev libre2-dev
|
||||
- name: Checkout nginx
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
repository: nginx/nginx
|
||||
path: nginx
|
||||
- name: Configure nginx
|
||||
working-directory: nginx
|
||||
run: auto/configure --with-compat
|
||||
- name: Create build directory
|
||||
run: mkdir build
|
||||
- name: Build module
|
||||
working-directory: build
|
||||
run: |
|
||||
cmake -DNGX_OTEL_NGINX_BUILD_DIR=${PWD}/../nginx/objs \
|
||||
-DNGX_OTEL_DEV=ON ..
|
||||
make -j 4
|
||||
strip ngx_otel_module.so
|
||||
- name: Archive module
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: nginx-otel-module
|
||||
path: build/ngx_otel_module.so
|
||||
- name: Archive protoc and opentelemetry-proto
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: protoc-opentelemetry-proto
|
||||
path: |
|
||||
build/_deps/grpc-build/third_party/protobuf/protoc
|
||||
build/_deps/otelcpp-src/third_party/opentelemetry-proto
|
||||
test-module:
|
||||
needs: build-module
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
- name: Download module
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: nginx-otel-module
|
||||
path: build
|
||||
- name: Download protoc and opentelemetry-proto
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: protoc-opentelemetry-proto
|
||||
path: build/_deps
|
||||
- name: List files
|
||||
run: ls -laR .
|
||||
- name: Fix protoc file permissions
|
||||
run: chmod +x build/_deps/grpc-build/third_party/protobuf/protoc
|
||||
- name: Install perl modules
|
||||
run: sudo cpan IO::Socket::SSL Crypt::Misc
|
||||
- name: Download otelcol
|
||||
run: |
|
||||
curl -LO https://github.com/\
|
||||
open-telemetry/opentelemetry-collector-releases/releases/download/\
|
||||
v0.76.1/otelcol_0.76.1_linux_amd64.tar.gz
|
||||
tar -xzf otelcol_0.76.1_linux_amd64.tar.gz
|
||||
sudo apt-get install -y cmake libc-ares-dev
|
||||
- name: Checkout nginx
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
|
|
@ -83,17 +26,22 @@ jobs:
|
|||
run: |
|
||||
auto/configure --with-compat --with-debug --with-http_ssl_module \
|
||||
--with-http_v2_module --with-http_v3_module
|
||||
make -j 4
|
||||
- name: Checkout lib from nginx-tests
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
repository: nginx/nginx-tests
|
||||
sparse-checkout: |
|
||||
lib
|
||||
path: nginx-tests
|
||||
- name: Run tests
|
||||
working-directory: tests
|
||||
make -j $(nproc)
|
||||
- name: Build module
|
||||
run: |
|
||||
PERL5LIB=../nginx-tests/lib TEST_NGINX_UNSAFE=1 \
|
||||
TEST_NGINX_VERBOSE=1 TEST_NGINX_GLOBALS="load_module \
|
||||
${PWD}/../build/ngx_otel_module.so;" prove -v .
|
||||
mkdir build
|
||||
cd build
|
||||
cmake -DNGX_OTEL_NGINX_BUILD_DIR=${PWD}/../nginx/objs \
|
||||
-DNGX_OTEL_DEV=ON ..
|
||||
make -j $(nproc)
|
||||
- name: Download otelcol
|
||||
run: |
|
||||
curl -sLo - https://github.com/\
|
||||
open-telemetry/opentelemetry-collector-releases/releases/download/\
|
||||
v0.115.1/otelcol_0.115.1_linux_amd64.tar.gz | tar -xzv
|
||||
- name: Install test dependencies
|
||||
run: pip install -r tests/requirements.txt
|
||||
- name: Run tests
|
||||
run: |
|
||||
pytest tests --maxfail=10 --nginx=nginx/objs/nginx \
|
||||
--module=build/ngx_otel_module.so --otelcol=./otelcol
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue