prole/pg-knoe-auth/test/unit/Makefile
chrisfu 57886f9268 feat(pg-knoe-auth): import upstream PostgreSQL JWT auth extension; compile in knoe-db image
- Copy pg-knoe-auth/ wholesale from upstream/knoe-db/20260523 (Task 1 of
  docs/plans/junie/upstream-knoe-db-20260523-integration.md).
- Extension: PG18 OAUTHBEARER JWT validator using libcurl + OpenSSL RS256.
- knoe-db/Dockerfile: add libcurl4-openssl-dev to dev deps; COPY src/ and
  build with make USE_PGXS=1 install after tds_fdw.
- NOT enabled in the default database build (absent from 20_create_extensions.sh).
  To enable: CREATE EXTENSION pg_knoe_auth; (requires pg_hba.conf oauth_issuer).

Closes Task 1 of upstream-knoe-db-20260523-integration.md.
2026-05-23 21:52:06 -07:00

56 lines
1.3 KiB
Makefile

# Makefile for pg_knoe_auth unit tests
# Run with: make check
# No PG cluster required — tests link only against OpenSSL.
CC = gcc
CFLAGS = -std=c11 -Wall -Wextra -g \
$(shell pkg-config --cflags openssl 2>/dev/null)
LDFLAGS = $(shell pkg-config --libs openssl 2>/dev/null)
TESTS = test_alg_validation \
test_aud_check \
test_aud_pipeline \
test_jwks_cache \
test_response_bound \
test_base64url
all: $(TESTS)
test_alg_validation: test_alg_validation.c test_helpers.h
$(CC) $(CFLAGS) -o $@ $< $(LDFLAGS)
test_aud_check: test_aud_check.c test_helpers.h
$(CC) $(CFLAGS) -o $@ $< $(LDFLAGS)
test_aud_pipeline: test_aud_pipeline.c test_helpers.h
$(CC) $(CFLAGS) -o $@ $< $(LDFLAGS)
test_jwks_cache: test_jwks_cache.c test_helpers.h
$(CC) $(CFLAGS) -o $@ $< $(LDFLAGS)
test_response_bound: test_response_bound.c test_helpers.h
$(CC) $(CFLAGS) -o $@ $< $(LDFLAGS)
test_base64url: test_base64url.c test_helpers.h
$(CC) $(CFLAGS) -o $@ $< $(LDFLAGS)
check: all
@echo "=== pg_knoe_auth unit tests ==="
@failed=0; \
for t in $(TESTS); do \
echo "--- $$t ---"; \
./$$t || failed=$$((failed + 1)); \
done; \
echo ""; \
if [ $$failed -eq 0 ]; then \
echo "All unit tests passed."; \
else \
echo "$$failed test(s) FAILED."; \
exit 1; \
fi
clean:
rm -f $(TESTS)
.PHONY: all check clean