-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
94 lines (81 loc) · 3.67 KB
/
Copy pathMakefile
File metadata and controls
94 lines (81 loc) · 3.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# Dataflow module — test and lint helpers.
#
# Tests run from the test/ harness. app:db is file-backed rather than :memory:
# because a plain in-memory DB gives each pooled connection its own empty
# database, so the schema vanishes ("no such table: dataflow_data") under the
# parallel connections the recovery/signal suites open. `make test` recreates
# the DB each run for a clean slate.
TEST_DIR := test
TEST_DB := .wippy/test.db
DATAFLOW_PG_HOST ?= 127.0.0.1
DATAFLOW_PG_PORT ?= 5432
DATAFLOW_PG_DATABASE ?= dataflow_test
DATAFLOW_PG_USERNAME ?= dataflow
DATAFLOW_PG_PASSWORD ?= dataflow
WIPPY ?= wippy
PUBLISH_DRY_RUN_TOKEN ?= wpy_ci_dry_run_0123456789abcdef0123456789abcdef
.PHONY: test test-sqlite test-postgres test-restart-sqlite test-restart-postgres test-static lint install verify-lock verify-package clean
test: test-sqlite
test-sqlite: clean test-static
cd $(TEST_DIR) && $(WIPPY) run test --profile sqlite
test-postgres: test-static
cd $(TEST_DIR) && $(WIPPY) run test --profile postgres \
--set "vars.postgres_host=$(DATAFLOW_PG_HOST)" \
--set "vars.postgres_port=$(DATAFLOW_PG_PORT)" \
--set "vars.postgres_database=$(DATAFLOW_PG_DATABASE)" \
--set "vars.postgres_username=$(DATAFLOW_PG_USERNAME)" \
--set "vars.postgres_password=$(DATAFLOW_PG_PASSWORD)"
test-restart-sqlite: test-static
./scripts/restart-proof.sh
test-restart-postgres: test-static
DATAFLOW_RESTART_DIALECT=postgres \
DATAFLOW_PG_HOST=$(DATAFLOW_PG_HOST) \
DATAFLOW_PG_PORT=$(DATAFLOW_PG_PORT) \
DATAFLOW_PG_DATABASE=$(DATAFLOW_PG_DATABASE)_restart \
DATAFLOW_PG_USERNAME=$(DATAFLOW_PG_USERNAME) \
DATAFLOW_PG_PASSWORD=$(DATAFLOW_PG_PASSWORD) \
./scripts/restart-proof.sh
test-static:
@command -v rg >/dev/null 2>&1 || { echo "test-static requires ripgrep (rg)"; exit 1; }
@if rg -n "keeper\\.views\\.dataflow|dataflow-link|Open full view" src/session/views/state.jet; then \
echo "dataflow state view must not link to keeper-owned UI"; \
exit 1; \
fi
@if rg -n "user_security_scope|runtime_process_(spawn|registry)" src test/_index.yaml; then \
echo "dataflow execution must inherit the exact caller actor and scope"; \
exit 1; \
fi
@if rg --files-without-match "test\.run_cases\(" src --glob '*_test.lua' | rg -q .; then \
echo "every source test must execute through test.run_cases"; \
rg --files-without-match "test\.run_cases\(" src --glob '*_test.lua'; \
exit 1; \
fi
@for test_file in $$(rg --files src -g '*_test.lua'); do \
test_name="$${test_file##*/}"; \
test_index="$${test_file%/*}/_index.yaml"; \
if ! test -f "$$test_index" || ! rg -q --fixed-strings "source: file://$$test_name" "$$test_index"; then \
echo "source test is not registered in its own index: $$test_file"; \
exit 1; \
fi; \
done
@if rg -n "name: (overseer|wake|sweeper)_security_scope" src/_index.yaml; then \
echo "overseer authority must be module-owned, not consumer-injected"; \
exit 1; \
fi
@awk 'BEGIN { in_service=0; has_root_scope=0 } \
/^ - name: overseer\.service$$/ { in_service=1; next } \
/^ - name: / { in_service=0 } \
in_service && /userspace\.dataflow\.security:root/ { has_root_scope=1 } \
END { if (!has_root_scope) { print "overseer service must use the canonical root process scope"; exit 1 } }' src/runner/_index.yaml
lint:
cd $(TEST_DIR) && $(WIPPY) lint --profile sqlite --ns app --ns 'userspace.dataflow.**'
install:
cd $(TEST_DIR) && $(WIPPY) install
verify-lock:
git diff --exit-code -- test/wippy.lock
verify-package:
@version="$$(awk '/^version:/ { print $$2; exit }' wippy.yaml)"; \
test -n "$$version"; \
WIPPY_TOKEN="$(PUBLISH_DRY_RUN_TOKEN)" $(WIPPY) publish --version "$$version" --dry-run
clean:
cd $(TEST_DIR) && rm -f $(TEST_DB) $(TEST_DB)-wal $(TEST_DB)-shm