Skip to content
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
702e740
resolve dgraph binary selection for macOS in dgraphtest and testutil
Feb 18, 2026
e3e8a39
fix(test): prevent data file clobbering when running --suite=all
mlwelles Feb 19, 2026
53bad0f
fix(test): use LINUX_GOBIN in all Docker Compose files for macOS compat
mlwelles Feb 19, 2026
cc9e2cb
Merge branch 'main' into fix/shiva-test-mac-os
mlwelles Feb 19, 2026
1679571
feat(test): add --timeout flag to t/ runner and make test
mlwelles Feb 19, 2026
75293c0
fix(test): resolve staticcheck SA9003 and prettier formatting
mlwelles Feb 20, 2026
4453939
feat(test): change default make test to unit,systest,core + integration2
mlwelles Feb 23, 2026
f6e5e74
Merge branch 'main' into fix/shiva-test-mac-os
mlwelles Feb 24, 2026
8d3ae16
refactor(test): rename test-everything → test-full
mlwelles Feb 24, 2026
404c552
refactor(test): rename test-suites → test-suite, accept SUITE arg
mlwelles Feb 24, 2026
d04e7b9
chore: remove AGENTS.md from repo, add to .gitignore
mlwelles Feb 24, 2026
3d85069
chore: add CLAUDE.md to .gitignore
mlwelles Feb 24, 2026
dfef2c3
fix(test): resolve integration test routing, gotestsum PATH, and cros…
mlwelles Feb 24, 2026
cb87a32
fix(test): enable CGO cross-compilation for plugin support on macOS
mlwelles Feb 25, 2026
e929c1a
fix(test): add Docker memory limits, cluster pause/resume, and resili…
mlwelles Feb 25, 2026
b408180
fix(test): add Docker memory limits and cache flags to dgraph docker-…
mlwelles Feb 25, 2026
b8b5ec9
fix(lint): resolve shellcheck SC2312 in check-cross-compiler.sh
mlwelles Feb 25, 2026
cd2029a
refactor(test): split suites into integration/systest-heavy and add t…
mlwelles Feb 25, 2026
c81aad9
fix(test): add retry logic to import client for transient Raft errors
mlwelles Feb 25, 2026
62728c9
revert: remove Docker memory limits and cache flags from compose files
mlwelles Feb 25, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,5 @@ x/log_test/*.enc
*.buf
.osgrep
.worktrees/
AGENTS.md
CLAUDE.md
20 changes: 15 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@
```bash
git clone https://github.com/dgraph-io/dgraph.git
cd ./dgraph
make install
make setup # auto-install tool dependencies (gotestsum, ack, etc.)
make install # build and install the dgraph binary
```

This will put the source code in a Git repo under `$GOPATH/src/github.com/dgraph-io/dgraph` and
Expand Down Expand Up @@ -144,16 +145,25 @@ directory, providing control and flexibility beyond the standard Go testing fram
The simplest way to run tests is via Make:

```bash
# Run all tests
# First-time setup: install tool dependencies
make setup

# Run default tests (~30 min): integration suite + integration2
make test

# Run every test in the repo
make test-all

# Run specific test types
make test-unit # Unit tests only (no Docker)
make test-integration2 # Integration2 tests via dgraphtest
make test-upgrade # Upgrade tests
make test-unit # True unit tests only — no Docker, no build tags
make test-integration # Integration tests via t/ runner with Docker
make test-integration-heavy # All heavy tests: systest-heavy + ldbc + load
make test-integration2 # Integration2 tests via dgraphtest
make test-upgrade # Upgrade tests

# Use variables for more control
make test TAGS=integration2 PKG=systest/vector
make test SUITE=all # All t/ runner suites
make test TIMEOUT=90m # Override per-package timeout (default: 30m)
```

Expand Down
103 changes: 73 additions & 30 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,20 @@ ifeq ($(GOPATH),)
$(error GOPATH is not set. Please set it explicitly, e.g. export GOPATH=$$HOME/go)
endif

# On non-Linux systems, use a separate directory for Linux binaries
# On non-Linux systems, use a separate directory for Linux binaries and
# a cross-compiler so that CGO is available (required for plugin support).
ifeq ($(GOHOSTOS),linux)
export LINUX_GOBIN ?= $(GOPATH)/bin
LINUX_CC ?= gcc
else
export LINUX_GOBIN ?= $(GOPATH)/linux_$(GOHOSTARCH)
ifeq ($(GOHOSTARCH),arm64)
LINUX_CC ?= aarch64-unknown-linux-gnu-gcc
else ifeq ($(GOHOSTARCH),amd64)
LINUX_CC ?= x86_64-unknown-linux-gnu-gcc
else
LINUX_CC ?= gcc
endif
endif

######################
Expand Down Expand Up @@ -60,7 +69,7 @@ install: ## Install dgraph binary
ifneq ($(GOHOSTOS),linux)
@mkdir -p $(LINUX_GOBIN)
@echo "Installing dgraph (linux/$(GOHOSTARCH))..."
@GOOS=linux GOARCH=$(GOHOSTARCH) $(MAKE) -C dgraph dgraph
@GOOS=linux GOARCH=$(GOHOSTARCH) CGO_ENABLED=1 CC=$(LINUX_CC) $(MAKE) -C dgraph BUILD_TAGS= EXTLDFLAGS=-fuse-ld=bfd dgraph
@mv dgraph/dgraph $(LINUX_GOBIN)/dgraph
@echo "Installed dgraph (linux/$(GOHOSTARCH)) to $(LINUX_GOBIN)/dgraph"
endif
Expand All @@ -73,13 +82,18 @@ uninstall: ## Uninstall dgraph binary

.PHONY: dgraph-installed
dgraph-installed:
@if [ ! -f "$(GOPATH)/bin/dgraph" ] || [ ! -f "$(LINUX_GOBIN)/dgraph" ]; then \
echo "Dgraph binary missing, running make install..."; \
$(MAKE) install; \
fi
$(MAKE) install

.PHONY: deps
deps: ## Check test dependencies (pass AUTO_INSTALL=true to auto-install missing ones)
$(MAKE) -C t deps

.PHONY: setup
setup: ## Install all test dependencies automatically
$(MAKE) deps AUTO_INSTALL=true

.PHONY: test
test: dgraph-installed local-image ## Run tests (see 'make help' for options)
test: dgraph-installed local-image ## Run tests (default: integration + integration2)
ifdef TAGS
@echo "Running tests with tags: $(TAGS)"
go test -v --tags="$(TAGS)" \
Expand All @@ -97,53 +111,70 @@ else
done
endif
else
@echo "Running test suite: $(or $(SUITE),all)"
$(MAKE) -C t test args="--suite=$(or $(SUITE),all) $(if $(PKG),--pkg=\"$(PKG)\") $(if $(TEST),--test=\"$(TEST)\") $(if $(TIMEOUT),--timeout=$(TIMEOUT))"
ifdef SUITE
@echo "Running test suite: $(SUITE)"
$(MAKE) -C t test args="--suite=$(SUITE) $(if $(PKG),--pkg=\"$(PKG)\") $(if $(TEST),--test=\"$(TEST)\") $(if $(TIMEOUT),--timeout=$(TIMEOUT))"
else
@echo "Running test suite: integration"
$(MAKE) -C t test args="--suite=integration $(if $(PKG),--pkg=\"$(PKG)\") $(if $(TEST),--test=\"$(TEST)\") $(if $(TIMEOUT),--timeout=$(TIMEOUT))"
@echo "Running integration2 tests..."
go test -v --tags="integration2" \
$(if $(TEST),--run="$(TEST)") \
$(if $(PKG),./$(PKG)/...,./...)
endif
endif

.PHONY: test-all
test-all: ## All test suites via t/ runner (i.e. 'make test SUITE=all')
@SUITE=all $(MAKE) test

.PHONY: test-unit
test-unit: ## Unit tests, no Docker (i.e. 'make test SUITE=unit')
test-unit: ## True unit tests only — no Docker, no integration build tag (i.e. 'make test SUITE=unit')
$(if $(filter command line,$(origin SUITE)),$(error SUITE= cannot be passed to test-unit; use 'make test SUITE=...' instead))
@SUITE=unit $(MAKE) test

.PHONY: test-integration
test-integration: ## Integration tests via t/ runner with Docker (i.e. 'make test SUITE=integration')
$(if $(filter command line,$(origin SUITE)),$(error SUITE= cannot be passed to test-integration; use 'make test SUITE=...' instead))
@SUITE=integration $(MAKE) test

.PHONY: test-core
test-core: ## Core tests (i.e. 'make test SUITE=core')
$(if $(filter command line,$(origin SUITE)),$(error SUITE= cannot be passed to test-core; use 'make test SUITE=...' instead))
@SUITE=core $(MAKE) test

.PHONY: test-integration
test-integration: ## Integration tests (i.e. 'make test TAGS=integration')
@TAGS=integration $(MAKE) test

.PHONY: test-integration2
test-integration2: ## Integration2 tests via dgraphtest (i.e. 'make test TAGS=integration2')
$(if $(filter command line,$(origin TAGS)),$(error TAGS= cannot be passed to test-integration2; use 'make test TAGS=...' instead))
@TAGS=integration2 $(MAKE) test

.PHONY: test-upgrade
test-upgrade: ## Upgrade tests (i.e. 'make test TAGS=upgrade')
$(if $(filter command line,$(origin TAGS)),$(error TAGS= cannot be passed to test-upgrade; use 'make test TAGS=...' instead))
@TAGS=upgrade $(MAKE) test

.PHONY: test-systest
test-systest: ## System integration tests (i.e. 'make test SUITE=systest')
test-systest: ## All systest packages: systest-baseline + systest-heavy (i.e. 'make test SUITE=systest')
$(if $(filter command line,$(origin SUITE)),$(error SUITE= cannot be passed to test-systest; use 'make test SUITE=...' instead))
@SUITE=systest $(MAKE) test

.PHONY: test-integration-heavy
test-integration-heavy: ## All heavy tests: systest-heavy + ldbc + load
$(if $(filter command line,$(origin SUITE)),$(error SUITE= cannot be passed to test-integration-heavy; use 'make test SUITE=...' instead))
@SUITE=systest-heavy,ldbc,load $(MAKE) test

.PHONY: test-vector
test-vector: ## Vector search tests (i.e. 'make test SUITE=vector')
$(if $(filter command line,$(origin SUITE)),$(error SUITE= cannot be passed to test-vector; use 'make test SUITE=...' instead))
@SUITE=vector $(MAKE) test

.PHONY: test-fuzz
test-fuzz: ## Fuzz tests, auto-discovers packages (i.e. 'make test FUZZ=1')
test-fuzz: ## Fuzz tests (i.e. 'make test FUZZ=1')
$(if $(filter command line,$(origin FUZZ)),$(error FUZZ= cannot be passed to test-fuzz; use 'make test FUZZ=...' instead))
@FUZZ=1 $(MAKE) test

.PHONY: test-ldbc
test-ldbc: ## LDBC benchmark tests (i.e. 'make test SUITE=ldbc')
@SUITE=ldbc $(MAKE) test

.PHONY: test-load
test-load: ## Heavy load tests (i.e. 'make test SUITE=load')
@SUITE=load $(MAKE) test
.PHONY: test-all
test-all: ## Every test: all t/ suites + integration2 + upgrade + fuzz
$(MAKE) test SUITE=all
$(MAKE) test-integration2
$(MAKE) test-upgrade
$(MAKE) test-fuzz

.PHONY: test-benchmark
test-benchmark: ## Go benchmarks (i.e. 'go test -bench')
Expand All @@ -152,7 +183,11 @@ test-benchmark: ## Go benchmarks (i.e. 'go test -bench')
.PHONY: local-image
local-image: ## Build local Docker image (dgraph/dgraph:local)
@echo building local docker image
@GOOS=linux GOARCH=amd64 $(MAKE) dgraph
ifneq ($(GOHOSTOS),linux)
@GOOS=linux GOARCH=$(GOHOSTARCH) CGO_ENABLED=1 CC=$(LINUX_CC) $(MAKE) BUILD_TAGS= EXTLDFLAGS=-fuse-ld=bfd dgraph
else
@GOOS=linux GOARCH=$(GOHOSTARCH) $(MAKE) dgraph
endif
@mkdir -p linux
@mv ./dgraph/dgraph ./linux/dgraph
@docker build -f contrib/Dockerfile -t dgraph/dgraph:local .
Expand All @@ -161,6 +196,13 @@ local-image: ## Build local Docker image (dgraph/dgraph:local)
.PHONY: image-local
image-local: local-image ## Alias for local-image

.PHONY: clean
clean: ## Clean build artifacts
$(MAKE) -C dgraph clean
$(MAKE) -C compose clean
@rm -rf linux
@go clean -testcache

.PHONY: docker-image
docker-image: dgraph ## Build Docker image (dgraph/dgraph:$VERSION)
@mkdir -p linux
Expand Down Expand Up @@ -201,7 +243,7 @@ help: ## Show available targets and variables
awk 'BEGIN {FS = ":.*?## "}; {printf " %-20s %s\n", $$1, $$2}'
@echo ""
@echo "Variables that can be passed to 'test':"
@echo " SUITE Select t/ runner suite (e.g., make test SUITE=systest)"
@echo " SUITE Select t/ runner suite (default: integration + integration2)"
@echo " TAGS Go build tags - bypasses t/ runner (e.g., make test TAGS=integration2)"
@echo " PKG Limit to specific package (e.g., make test PKG=systest/export)"
@echo " TEST Run specific test function (e.g., make test TEST=TestGQLSchema)"
Expand All @@ -216,8 +258,9 @@ help: ## Show available targets and variables
@printf " Available TAGS values: "
@grep -roh "//go:build [a-z0-9]*" --include="*_test.go" . 2>/dev/null | \
awk '{print $$2}' | \
grep -E '^(integration|integration2|upgrade)$$' | \
grep -E '^(integration2|upgrade)$$' | \
sort -u | tr '\n' ' ' && echo ""
@echo " Note: 'integration' tests require the t/ runner (use SUITE=, not TAGS=)"
@echo ""
@echo "Examples:"
@echo " make test TAGS=integration2 PKG=systest/vector # integration2 tests for vector"
Expand Down
Loading
Loading