.PHONY: build check doctor dev-config dev-up dev-down dev-status dev-smoke dev-shell dev-restart-check dev-migration-test dev-native-build dev-native-test dev-smallfiles-test dev-million-start dev-million-status dev-million-finish
build:
	go build -buildvcs=false -o bin/cephmig ./cmd/cephmig
check:
	go vet ./...
	go test ./...
	bash -n dev/cluster.sh dev/client.sh dev/smoke.sh dev/restart-check.sh dev/migration-test.sh dev/native-test.sh dev/smallfiles-test.sh dev/million-start.sh dev/million-finish.sh
	python3 -c 'import ast,pathlib; [ast.parse(pathlib.Path(p).read_text()) for p in ("dev/native-fixture.py", "dev/smallfiles.py", "dev/million.py")]'
doctor:
	go run ./cmd/cephmig doctor
dev-config:
	docker compose -f dev/compose.yaml config --quiet
dev-up:
	docker compose -f dev/compose.yaml up -d --wait --wait-timeout 300
dev-down:
	docker compose -f dev/compose.yaml down
dev-status:
	docker compose -f dev/compose.yaml ps
	docker compose -f dev/compose.yaml exec source ceph -s
	docker compose -f dev/compose.yaml exec target ceph -s
dev-smoke:
	docker compose -f dev/compose.yaml exec client timeout --kill-after=10s 90s bash /lab/smoke.sh
dev-shell:
	docker compose -f dev/compose.yaml exec client bash
dev-restart-check:
	bash dev/restart-check.sh
dev-migration-test: build
	docker compose -f dev/compose.yaml exec -T client timeout --kill-after=10s 600s bash /lab/migration-test.sh
dev-native-build:
	docker compose -f dev/compose.yaml build native
dev-native-test: dev-native-build
	docker compose -f dev/compose.yaml up -d --wait --wait-timeout 300 native
	bash dev/native-test.sh
dev-smallfiles-test: dev-native-build
	docker compose -f dev/compose.yaml up -d --wait --wait-timeout 300 client native
	bash dev/smallfiles-test.sh
dev-million-start: dev-native-build
	bash dev/million-start.sh
dev-million-status:
	docker compose -p cephmig-million -f dev/compose.yaml -f dev/compose.million.yaml ps -a
	python3 -m json.tool .dev/million/main/status.json
dev-million-finish:
	bash dev/million-finish.sh
