NAME
k8s-test - Run DBIO tests against Kubernetes-provisioned databases
SYNOPSIS
# Set kubeconfig (or use KUBECONFIG / default ~/.kube/config)
export DBIO_TEST_KUBECONFIG=~/.kube/config
# Local mode (default): port-forward, run prove on your machine
xbin/k8s-test # run all tests
xbin/k8s-test t/72pg.t t/71mysql.t # specific tests
xbin/k8s-test --keep # leave what the run created
# An account confined to one namespace: work in it, create and delete none
xbin/k8s-test --existing-namespace dev-dbio t/kubernetes/smoke.t
# In-cluster mode: build image, run as Job inside the cluster
xbin/k8s-test --mode cluster
xbin/k8s-test --mode cluster --image my-registry/dbio-test:v1
# Coverage
xbin/k8s-test --cover # run with Devel::Cover
xbin/k8s-test --cover t/72pg.t # coverage for specific tests
# Options
--mode local|cluster Test execution mode (default: local)
--keep Don't delete anything after tests
--cover Run with Devel::Cover and generate report
--namespace NAME Create a namespace of this name, delete it afterwards
(default: a generated dbio-test-XXXXXXXX)
--existing-namespace NAME
Work in a namespace that is already there; it is
neither created nor deleted
--image IMAGE Docker image for cluster mode (default: dbio-test:latest)
--db pg,mysql,pg-ext,duckdb Which databases to provision (default: pg,mysql)
--timeout SECS Readiness timeout in seconds (default: 120)
DESCRIPTION
Provisions temporary PostgreSQL and MySQL pods in a Kubernetes cluster, then runs the DBIO test suite against them. Cleans up automatically unless --keep is specified.
By default the run gets a namespace of its own, created at the start and deleted at the end. --existing-namespace is for an account that may not create namespaces: the pods and services go into the named namespace under names and labels that carry the id of the run, and the cleanup deletes exactly those objects. --namespace and --existing-namespace exclude each other. See "NAMESPACES" in DBIO::Test::Kubernetes.
With --keep the script prints what it left behind and how to remove it: the namespace, or, in an existing namespace, each object by name.
Uses Kubernetes::REST and IO::K8s for all API interactions (no kubectl shelling out, except for port-forward in local mode).