-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
64 lines (49 loc) · 1.31 KB
/
Makefile
File metadata and controls
64 lines (49 loc) · 1.31 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
.PHONY: test test-unit test-integration docker-up docker-down docker-restart docker-logs wait-for-ssh deps fmt lint ci clean
DEBUG ?= YES
INSECURE_IGNORE_HOST_KEY ?= YES
SSH_HOST ?= localhost
SSH_PORT ?= 2222
export DEBUG
export INSECURE_IGNORE_HOST_KEY
export SSH_HOST
export SSH_PORT
# Run all tests (unit + integration with fresh container)
test: test-unit docker-restart wait-for-ssh test-integration docker-down
# Unit tests only - packages that don't require SSH
test-unit:
go test -v -race ./passwd/... ./group/... ./authorized_keys/...
# Integration tests - requires running SSH container
test-integration:
go test -v -race .
# Docker management
docker-up:
docker compose up -d
docker-down:
docker compose down -v
docker-restart: docker-down
docker compose up -d --build
wait-for-ssh:
@for i in $$(seq 1 30); do \
if nc -z $(SSH_HOST) $(SSH_PORT) 2>/dev/null; then \
echo "SSH server is ready"; \
exit 0; \
fi; \
echo "Waiting for SSH server... ($$i/30)"; \
sleep 1; \
done; \
echo "Timeout waiting for SSH server"; \
exit 1
docker-logs:
docker compose logs -f
# Development tasks
deps:
go mod download
go mod tidy
fmt:
go fmt ./...
lint:
go vet ./...
clean:
docker compose down -v 2>/dev/null || true
# CI pipeline - runs everything
ci: deps fmt lint docker-restart wait-for-ssh test