Add countersend test tool and project CLAUDE.md

countersend send plays mailqueuer against /in and /out, and
countersend receive writes each notification to a file in place of
the web app. send refuses a run that would notify unless given
--allow-notify. The Makefile builds it in build, freebsd and
build-linux. docs/testing-with-countersend.md has the steps.

Also add CLAUDE.md and gitignore .claude/.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Dimitrije Dimitrijevic
2026-11-18 13:04:03 +01:00
co-authored by Claude Opus 5.5
parent 54f9626121
commit d465739f6d
10 changed files with 1969 additions and 3 deletions
+13 -3
View File
@@ -1,4 +1,4 @@
.PHONY: all build build-daemon build-ctl test test-contrib vet coverage freebsd build-linux clean help
.PHONY: all build build-daemon build-ctl build-send test test-contrib vet coverage freebsd build-linux clean help
# ====================================================================================
# Variables
@@ -9,6 +9,8 @@ CTL_BINARY ?= counterctl
BIN_DIR ?= ./bin
SRC = ./cmd/migadu_counters
CTL_SRC = ./cmd/counterctl
SEND_BINARY ?= countersend
SEND_SRC = ./cmd/countersend
# Version information (falls back when not in a git checkout)
VERSION ?= $(shell git describe --tags --always --dirty --match='v*' 2>/dev/null || echo dev)
@@ -21,8 +23,10 @@ LDFLAGS = -ldflags="${LDFLAGS_VARS}"
# Cross-compilation (FreeBSD hosts run these under rc.d + daemon(8))
FREEBSD_BINARY ?= migadu_counters-freebsd-amd64
CTL_FREEBSD_BINARY ?= counterctl-freebsd-amd64
SEND_FREEBSD_BINARY ?= countersend-freebsd-amd64
LINUX_BINARY ?= migadu_counters-linux-amd64
CTL_LINUX_BINARY ?= counterctl-linux-amd64
SEND_LINUX_BINARY ?= countersend-linux-amd64
# ====================================================================================
# Targets
@@ -30,7 +34,7 @@ CTL_LINUX_BINARY ?= counterctl-linux-amd64
all: build
build: build-daemon build-ctl
build: build-daemon build-ctl build-send
build-daemon:
@mkdir -p $(BIN_DIR)
@@ -40,6 +44,10 @@ build-ctl:
@mkdir -p $(BIN_DIR)
go build $(LDFLAGS) -o $(BIN_DIR)/$(CTL_BINARY) $(CTL_SRC)
build-send:
@mkdir -p $(BIN_DIR)
go build $(LDFLAGS) -o $(BIN_DIR)/$(SEND_BINARY) $(SEND_SRC)
test:
go test -race ./...
@@ -59,18 +67,20 @@ freebsd:
@mkdir -p $(BIN_DIR)
CGO_ENABLED=0 GOOS=freebsd GOARCH=amd64 go build -ldflags="${LDFLAGS_VARS}" -o $(BIN_DIR)/$(FREEBSD_BINARY) $(SRC)
CGO_ENABLED=0 GOOS=freebsd GOARCH=amd64 go build -ldflags="${LDFLAGS_VARS}" -o $(BIN_DIR)/$(CTL_FREEBSD_BINARY) $(CTL_SRC)
CGO_ENABLED=0 GOOS=freebsd GOARCH=amd64 go build -ldflags="${LDFLAGS_VARS}" -o $(BIN_DIR)/$(SEND_FREEBSD_BINARY) $(SEND_SRC)
build-linux:
@mkdir -p $(BIN_DIR)
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="${LDFLAGS_VARS}" -o $(BIN_DIR)/$(LINUX_BINARY) $(SRC)
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="${LDFLAGS_VARS}" -o $(BIN_DIR)/$(CTL_LINUX_BINARY) $(CTL_SRC)
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="${LDFLAGS_VARS}" -o $(BIN_DIR)/$(SEND_LINUX_BINARY) $(SEND_SRC)
clean:
rm -rf $(BIN_DIR) coverage.out
help:
@echo "Targets:"
@echo " build Build migadu_counters and counterctl into $(BIN_DIR)"
@echo " build Build migadu_counters, counterctl and countersend into $(BIN_DIR)"
@echo " test go test -race ./..."
@echo " test-contrib Shell test for contrib/pull-domains.sh"
@echo " vet go vet + gofmt check"