feat(seed): add API test-data seeding script and make testdata target
- scripts/seed.py: stdlib HTTP client, JPEG+EXIF via optional Pillow (PNG fallback), additive-only, dry-run - Makefile: testdata target with ALBUMS/PHOTOS/SEED/TIMEOUT and boolean flags - README: usage section; new dev-seed-data capability spec
This commit is contained in:
@@ -1,8 +1,16 @@
|
||||
.PHONY: build build-release frontend backend run migrate reconcile reconcile-delete tidy test clean
|
||||
.PHONY: build build-release frontend backend run migrate reconcile reconcile-delete tidy test testdata clean
|
||||
|
||||
# Release version stamped into the binary (-X main.version). Override with VERSION=...
|
||||
VERSION ?= $(shell git describe --tags --always --dirty 2>/dev/null || echo dev)
|
||||
|
||||
# Seed testdata parameters (see `make testdata`). Counts: ALBUMS, PHOTOS, SEED, TIMEOUT.
|
||||
# Boolean (set to 1 to enable): TAGS, COMMENTS, LIKES, SHARE, INVITES, WAIT, DRY.
|
||||
# Extra passthrough flags: ARGS.
|
||||
ALBUMS ?= 2
|
||||
PHOTOS ?= 10
|
||||
SEED ?= 0
|
||||
TIMEOUT ?= 30
|
||||
|
||||
frontend:
|
||||
cd frontend && npm ci && npm run build
|
||||
rm -rf backend/static/*
|
||||
@@ -53,6 +61,25 @@ tidy:
|
||||
test:
|
||||
cd backend && go test ./...
|
||||
|
||||
# Seed test data into a running instance through the public API (additive only).
|
||||
# Credentials come from the environment: GALO_EMAIL, GALO_PASSWORD
|
||||
# (optional GALO_BASE_URL). Example:
|
||||
# make testdata ALBUMS=3 PHOTOS=5 TAGS=1 LIKES=1 SEED=42
|
||||
testdata:
|
||||
@python3 scripts/seed.py \
|
||||
--albums $(ALBUMS) \
|
||||
--photos-per-album $(PHOTOS) \
|
||||
--seed $(SEED) \
|
||||
--timeout $(TIMEOUT) \
|
||||
$(if $(filter 1,$(TAGS)),--tags,) \
|
||||
$(if $(filter 1,$(COMMENTS)),--comments,) \
|
||||
$(if $(filter 1,$(LIKES)),--likes,) \
|
||||
$(if $(filter 1,$(SHARE)),--share-links,) \
|
||||
$(if $(filter 1,$(INVITES)),--invites,) \
|
||||
$(if $(filter 1,$(WAIT)),--wait-variants,) \
|
||||
$(if $(filter 1,$(DRY)),--dry-run,) \
|
||||
$(ARGS)
|
||||
|
||||
clean:
|
||||
rm -rf bin backend/static/*
|
||||
touch backend/static/.gitkeep
|
||||
|
||||
Reference in New Issue
Block a user