Skip to content

Commit

Permalink
Add integration testing scaffolding
Browse files Browse the repository at this point in the history
  • Loading branch information
omus committed Mar 6, 2024
1 parent f5478e4 commit 74e0c48
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 5 deletions.
18 changes: 17 additions & 1 deletion .github/workflows/CI.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}
jobs:
test:
unit-test:
name: Julia ${{ matrix.version }} - ${{ matrix.runs-on }} - ${{ matrix.arch }} - ${{ matrix.threads}} threads
# These permissions are needed to:
# - Delete old caches: https://github.com/julia-actions/cache#cache-retention
Expand All @@ -44,6 +44,7 @@ jobs:
threads:
- 1
env:
RUN_TESTS: unit,quality-assurance
JULIA_NUM_THREADS: ${{ matrix.threads }}
steps:
- uses: actions/checkout@v4
Expand All @@ -60,6 +61,11 @@ jobs:

integration-test:
name: Integration Test - Julia ${{ matrix.julia-version }} - K8s ${{ matrix.k8s-version }} - minikube ${{ matrix.minikube-version }}
# These permissions are needed to:
# - Delete old caches: https://github.com/julia-actions/cache#cache-retention
permissions:
actions: write
contents: read
runs-on: ubuntu-latest
strategy:
fail-fast: false
Expand All @@ -76,9 +82,14 @@ jobs:
minikube-version:
- "1.32.0"
env:
RUN_TESTS: integration
SKAFFOLD_INTERACTIVE: "false" # Disable survey prompts
steps:
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v1
with:
version: ${{ matrix.julia-version }}
- uses: julia-actions/cache@v1
- uses: yokawasa/[email protected]
with:
setup-tools: |-
Expand Down Expand Up @@ -106,3 +117,8 @@ jobs:
JULIA_VERSION: ${{ matrix.julia-version }}
run: skaffold build
working-directory: test/integration
- uses: julia-actions/julia-runtest@v1
- uses: julia-actions/julia-processcoverage@v1
- uses: codecov/codecov-action@v3
with:
file: lcov.info
1 change: 1 addition & 0 deletions test/integration.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@test false
33 changes: 29 additions & 4 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,41 @@ using Mocking: Mocking, @mock, @patch, apply
using Sockets: localhost
using Test

const RUN_TESTS = let
valid_types = ("unit", "integration", "quality_assurance")
run_tests = get(ENV, "RUN_TESTS", "unit,quality-assurance")
types = map(t -> replace(t, '-' => '_'), split(run_tests, ','))
NamedTuple([Symbol(t) => t in types for t in valid_types])
end

# https://en.wikipedia.org/wiki/Ephemeral_port
const EPHEMERAL_PORT_RANGE = 49152:65535

Mocking.activate()

@testset "K8sDeputy.jl" begin
@testset "Aqua" begin
Aqua.test_all(K8sDeputy; ambiguities=false)
if RUN_TESTS.quality_assurance
@testset "Quality Assurance" begin
Aqua.test_all(K8sDeputy; ambiguities=false)
end
else
@warn "Skipping quality assurance tests"
end

include("graceful_termination.jl")
include("health.jl")
if RUN_TESTS.unit
@testset "Unit" begin
include("graceful_termination.jl")
include("health.jl")
end
else
@warn "Skipping unit tests"
end

if RUN_TESTS.integration
@testset "Integration" begin
include("integration.jl")
end
else
@warn "Skipping integration tests"
end
end

0 comments on commit 74e0c48

Please sign in to comment.