Skip to content

Commit

Permalink
chore(tests): move env var to the step that actually needs it
Browse files Browse the repository at this point in the history
  • Loading branch information
fffonion authored and bungle committed Mar 15, 2023
1 parent b6396cc commit f62b329
Showing 1 changed file with 29 additions and 37 deletions.
66 changes: 29 additions & 37 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,6 @@ jobs:
runs-on: ubuntu-22.04
needs: build

env:
KONG_TEST_PG_DATABASE: kong
KONG_TEST_PG_USER: kong

services:
postgres:
image: postgres:13
Expand Down Expand Up @@ -147,6 +143,9 @@ jobs:
scripts/check_spec_files_spelling.sh
- name: Unit tests
env:
KONG_TEST_PG_DATABASE: kong
KONG_TEST_PG_USER: kong
run: |
source ${{ env.INSTALL_ROOT }}-venv.sh
bin/busted -v -o htest spec/01-unit
Expand All @@ -162,16 +161,6 @@ jobs:
suite: [integration, plugins]
split: [first (01-04), second (>= 05)]

env:
KONG_TEST_PG_DATABASE: kong
KONG_TEST_PG_USER: kong
KONG_TEST_DATABASE: postgres
KONG_SPEC_TEST_GRPCBIN_PORT: "15002"
KONG_SPEC_TEST_GRPCBIN_SSL_PORT: "15003"
KONG_SPEC_TEST_OTELCOL_FILE_EXPORTER_PATH: ${{ github.workspace }}/tmp/otel/file_exporter.json
TEST_SUITE: ${{ matrix.suite }}
TEST_SPLIT: ${{ matrix.split }}

services:
postgres:
image: postgres:13
Expand Down Expand Up @@ -248,6 +237,15 @@ jobs:
docker logs opentelemetry-collector
- name: Tests
env:
KONG_TEST_PG_DATABASE: kong
KONG_TEST_PG_USER: kong
KONG_TEST_DATABASE: postgres
KONG_SPEC_TEST_GRPCBIN_PORT: "15002"
KONG_SPEC_TEST_GRPCBIN_SSL_PORT: "15003"
KONG_SPEC_TEST_OTELCOL_FILE_EXPORTER_PATH: ${{ github.workspace }}/tmp/otel/file_exporter.json
TEST_SUITE: ${{ matrix.suite }}
TEST_SPLIT: ${{ matrix.split }}
run: |
make dev # required to install other dependencies like bin/grpcurl
source ${{ env.INSTALL_ROOT }}-venv.sh
Expand All @@ -258,15 +256,6 @@ jobs:
runs-on: ubuntu-22.04
needs: build

env:
KONG_TEST_PG_DATABASE: kong
KONG_TEST_PG_USER: kong
KONG_TEST_DATABASE: 'off'
KONG_SPEC_TEST_GRPCBIN_PORT: "15002"
KONG_SPEC_TEST_GRPCBIN_SSL_PORT: "15003"
KONG_SPEC_TEST_OTELCOL_FILE_EXPORTER_PATH: ${{ github.workspace }}/tmp/otel/file_exporter.json
TEST_SUITE: dbless

services:
grpcbin:
image: moul/grpcbin
Expand Down Expand Up @@ -311,6 +300,14 @@ jobs:
docker logs opentelemetry-collector
- name: Tests
env:
KONG_TEST_PG_DATABASE: kong
KONG_TEST_PG_USER: kong
KONG_TEST_DATABASE: 'off'
KONG_SPEC_TEST_GRPCBIN_PORT: "15002"
KONG_SPEC_TEST_GRPCBIN_SSL_PORT: "15003"
KONG_SPEC_TEST_OTELCOL_FILE_EXPORTER_PATH: ${{ github.workspace }}/tmp/otel/file_exporter.json
TEST_SUITE: dbless
run: |
make dev # required to install other dependencies like bin/grpcurl
source ${{ env.INSTALL_ROOT }}-venv.sh
Expand All @@ -328,14 +325,6 @@ jobs:
cassandra_version: [3]
split: [first (01-04), second (>= 05)]

env:
KONG_TEST_DATABASE: cassandra
KONG_SPEC_TEST_GRPCBIN_PORT: "15002"
KONG_SPEC_TEST_GRPCBIN_SSL_PORT: "15003"
KONG_SPEC_TEST_OTELCOL_FILE_EXPORTER_PATH: ${{ github.workspace }}/tmp/otel/file_exporter.json
TEST_SUITE: ${{ matrix.suite }}
TEST_SPLIT: ${{ matrix.split }}

services:
cassandra:
image: cassandra:${{ matrix.cassandra_version }}
Expand Down Expand Up @@ -411,6 +400,13 @@ jobs:
docker logs opentelemetry-collector
- name: Tests
env:
KONG_TEST_DATABASE: cassandra
KONG_SPEC_TEST_GRPCBIN_PORT: "15002"
KONG_SPEC_TEST_GRPCBIN_SSL_PORT: "15003"
KONG_SPEC_TEST_OTELCOL_FILE_EXPORTER_PATH: ${{ github.workspace }}/tmp/otel/file_exporter.json
TEST_SUITE: ${{ matrix.suite }}
TEST_SPLIT: ${{ matrix.split }}
run: |
make dev # required to install other dependencies like bin/grpcurl
source ${{ env.INSTALL_ROOT }}-venv.sh
Expand All @@ -421,9 +417,6 @@ jobs:
runs-on: ubuntu-22.04
needs: build

env:
TEST_SUITE: pdk

steps:
- name: Set environment variables
run: |
Expand All @@ -441,9 +434,6 @@ jobs:
${{ env.INSTALL_ROOT }}-venv.sh
key: ${{ hashFiles('.requirements', 'kong-*.rockspec', '.bazelversion', '.bazelrc', 'build/**', 'BUILD.bazel', 'WORKSPACE', '.github/workflows/build_and_test.yml') }}

- name: Add to Path
run: echo "$INSTALL_ROOT/bin:$INSTALL_ROOT/openresty/nginx/sbin:$INSTALL_ROOT/openresty/bin" >> $GITHUB_PATH

- name: Install Test::Nginx
run: |
CPAN_DOWNLOAD=./cpanm
Expand All @@ -456,6 +446,8 @@ jobs:
$CPAN_DOWNLOAD/cpanm --notest Test::Nginx
- name: Tests
env:
TEST_SUITE: pdk
run: |
source ${{ env.INSTALL_ROOT }}-venv.sh
Expand Down

1 comment on commit f62b329

@khcp-gha-bot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bazel Build

Docker image available kong/kong:f62b3298e0f8c56f09c536db446ce62ea8dfac2e
Artifacts available https://github.com/Kong/kong/actions/runs/4423733816

Please sign in to comment.