Skip to content

feat: control the proxy_upstream in lua side #1415

feat: control the proxy_upstream in lua side

feat: control the proxy_upstream in lua side #1415

Workflow file for this run

name: Tests
on:
pull_request:
push:
env:
KONG_VERSION: master
BUILD_ROOT: ${{ github.workspace }}/kong/bazel-bin/build
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
build:
name: Build dependencies
runs-on: ubuntu-22.04
steps:
- name: Checkout source code
uses: actions/checkout@v3
- name: Checkout Kong source code
uses: actions/checkout@v3
with:
repository: kong/kong
ref: ${{ env.KONG_VERSION }}
path: kong
- name: Set the LUA_KONG_NGINX_MODULE in kong/.requirements
run: |
cd kong
branch=""
if [ ${{ github.event_name }} == 'pull_request' ]; then
branch=${GITHUB_HEAD_REF}
else
branch=${GITHUB_REF}
fi
branch=$(echo "$branch" | sed 's/\//\\\//g')
sed -i "s/LUA_KONG_NGINX_MODULE=.\+/LUA_KONG_NGINX_MODULE=${branch}/" .requirements
cat .requirements
- name: Lookup build cache
id: cache-deps
uses: actions/cache@v3
with:
path: |
${{ env.BUILD_ROOT }}
key: ${{ hashFiles('src/**', 'lualib/**', '.github/workflows/tests.yml', 'kong/.requirements') }}
- name: Install packages
if: steps.cache-deps.outputs.cache-hit != 'true'
run: |
sudo apt update
sudo apt install libyaml-dev valgrind libprotobuf-dev cpanminus net-tools libpcre3-dev build-essential
- name: Build Kong
if: steps.cache-deps.outputs.cache-hit != 'true'
env:
GH_TOKEN: ${{ github.token }}
run: |
cd kong
make build-kong
make build-venv
BUILD_PREFIX=$BUILD_ROOT/kong-dev
export PATH="$BUILD_PREFIX/bin:$BUILD_PREFIX/openresty/nginx/sbin:$BUILD_PREFIX/openresty/bin:$PATH"
chmod +rw -R $BUILD_PREFIX
nginx -V
ldd $(which nginx)
luarocks
test:
name: Test
runs-on: ubuntu-22.04
needs: build
steps:
- name: Checkout source code
uses: actions/checkout@v3
- name: Checkout Kong source code
uses: actions/checkout@v3
with:
repository: kong/kong
ref: ${{ env.KONG_VERSION }}
path: kong
- name: Set the LUA_KONG_NGINX_MODULE in kong/.requirements
run: |
cd kong
branch=""
if [ ${{ github.event_name }} == 'pull_request' ]; then
branch=${GITHUB_HEAD_REF}
else
branch=${GITHUB_REF}
fi
branch=$(echo "$branch" | sed 's/\//\\\//g')
sed -i "s/LUA_KONG_NGINX_MODULE=.\+/LUA_KONG_NGINX_MODULE=${branch}/" .requirements
cat .requirements
- name: Load build cache
id: cache-deps
uses: actions/cache@v3
with:
path: |
${{ env.BUILD_ROOT }}
key: ${{ hashFiles('src/**', 'lualib/**', '.github/workflows/tests.yml', 'kong/.requirements') }}
- name: Install packages
run: |
sudo apt update
sudo apt install libyaml-dev valgrind libprotobuf-dev cpanminus net-tools libpcre3-dev build-essential
- name: Install Test::Nginx
run: |
if [ ! -e perl ]; then
sudo cpanm --notest Test::Nginx > build.log 2>&1 || (cat build.log && exit 1)
cp -r /usr/local/share/perl/ .
else
sudo cp -r perl /usr/local/share
fi
- name: Run Test
run: |
source ${{ env.BUILD_ROOT }}/kong-dev-venv.sh
nginx -V
resty -V
luarocks --version
openssl version
prove -r t
- name: Run Test with Valgrind
run: |
source ${{ env.BUILD_ROOT }}/kong-dev-venv.sh
export TEST_NGINX_VALGRIND='--num-callers=100 -q --tool=memcheck --leak-check=full --show-possibly-lost=no --gen-suppressions=all --suppressions=valgrind.suppress --track-origins=yes' TEST_NGINX_TIMEOUT=60 TEST_NGINX_SLEEP=1
export TEST_NGINX_USE_VALGRIND=1
nginx -V
resty -V
luarocks --version
openssl version
# fail if definite leak found
prove -r t 2>&1 | tee /dev/stderr | grep -q "match-leak-kinds: definite" && exit 1 || exit 0