-
-
Notifications
You must be signed in to change notification settings - Fork 40
Expand file tree
/
Copy pathMakefile
More file actions
109 lines (91 loc) · 4.13 KB
/
Copy pathMakefile
File metadata and controls
109 lines (91 loc) · 4.13 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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
.PHONY: build run stop \
test test-java test-python test-node test-go \
compat-docker clean
MVN = ./mvnw
PORT = 4588
PID_FILE = emulator.pid
JAVA_DIR = compatibility-tests/sdk-test-java
PYTHON_DIR = compatibility-tests/sdk-test-python
NODE_DIR = compatibility-tests/sdk-test-node
GO_DIR = compatibility-tests/sdk-test-go
# ── Build ─────────────────────────────────────────────────────────────────────
build:
$(MVN) compile
# ── Emulator: start / stop ────────────────────────────────────────────────────
run:
$(MVN) quarkus:dev -Dno-color > emulator.log 2>&1 & echo $$! > $(PID_FILE)
@echo "Waiting for emulator to start on port $(PORT)..."
@until curl -s http://localhost:$(PORT)/health > /dev/null; do sleep 1; done
@echo "Emulator is up!"
stop:
@if [ -f $(PID_FILE) ]; then \
kill $$(cat $(PID_FILE)) 2>/dev/null || true; \
rm $(PID_FILE); \
fi
@kill $$(lsof -ti :$(PORT) -P 2>/dev/null) 2>/dev/null || true
@until ! lsof -ti :$(PORT) -P > /dev/null 2>&1; do sleep 1; done
@echo "Emulator stopped."
# ── SDK compatibility tests ───────────────────────────────────────────────────
test-java:
@echo "==> Java SDK compatibility tests"
cd $(JAVA_DIR) && mvn test -q
test-python:
@echo "==> Python SDK compatibility tests"
@cd $(PYTHON_DIR) && \
if [ ! -d .venv ]; then python3 -m venv .venv; fi && \
.venv/bin/pip install -q -r requirements.txt && \
.venv/bin/pytest tests/ -v
test-node:
@echo "==> Node.js SDK compatibility tests"
@cd $(NODE_DIR) && \
npm install --silent && \
npm test
test-go:
@echo "==> Go SDK compatibility tests"
@cd $(GO_DIR) && \
go test ./tests/... -v -timeout 120s
# ── Full test suite ───────────────────────────────────────────────────────────
test: build
$(MVN) test
$(MAKE) run
$(MAKE) test-java
$(MAKE) test-python
$(MAKE) test-node
$(MAKE) test-go
$(MAKE) stop
# ── Docker-based compat tests (requires: docker compose up -d) ────────────────
# Runs every suite against the single shared compose emulator with ALL mocks off
# (real Redpanda / Postgres / Cloud Run). The emulator's
# FLOCI_GCP_SERVICES_DOCKER_NETWORK (set in docker-compose.yml) attaches spawned
# sidecars to the compose network so they are reachable. Per-service
# *_EMULATOR_HOST values are baked into each suite Dockerfile, so only the shared
# endpoint vars + the Cloud Run execution gate are passed here.
COMPAT_NET = floci_gcp_default
COMPAT_RESULTS = /tmp/floci-gcp-compat-results
COMPAT_SUITES = sdk-test-java sdk-test-node sdk-test-python sdk-test-go sdk-test-gcloud compat-terraform compat-opentofu
compat-docker:
@echo "==> Building test images..."
@for suite in $(COMPAT_SUITES); do \
echo " compat-$$suite"; \
docker build -q -t compat-$$suite compatibility-tests/$$suite/ > /dev/null; \
done
@fail=0; \
for suite in $(COMPAT_SUITES); do \
echo "==> $$suite"; \
mkdir -p $(COMPAT_RESULTS)/$$suite; \
docker run --rm --network $(COMPAT_NET) \
-e FLOCI_GCP_ENDPOINT=http://floci-gcp:4588 \
-e FLOCI_ENDPOINT=http://floci-gcp:4588 \
-e FLOCI_HOST=floci-gcp:4588 \
-e FLOCI_PROJECT=test-project \
-e FLOCI_GCP_CLOUDRUN_EXECUTION_ENABLED=true \
-v $(COMPAT_RESULTS)/$$suite:/results \
compat-$$suite || fail=1; \
done; \
exit $$fail
# ── Cleanup ───────────────────────────────────────────────────────────────────
clean:
$(MVN) clean
rm -rf $(PYTHON_DIR)/.venv $(PYTHON_DIR)/__pycache__ $(PYTHON_DIR)/tests/__pycache__
rm -rf $(NODE_DIR)/node_modules $(NODE_DIR)/dist
rm -f emulator.log $(PID_FILE)