Skip to content

Commit 4453939

Browse files
committed
feat(test): change default make test to unit,systest,core + integration2
The default `make test` (no args) previously ran --suite=all (~60+ min). Now it runs unit,systest,core suites plus integration2 tests (~30 min) for a faster local feedback loop. Changes: - Split the else branch in `test` target: SUITE set → explicit suite; nothing set → default (unit,systest,core + integration2) - Add $(origin) guards on all test-* targets to prevent confusing variable conflicts (e.g. `make test-unit SUITE=ldbc` now errors) - Add `test-suites` target (runs all t/ runner suites via SUITE=all) - Add `test-everything` target (all suites + integration + integration2 + upgrade + fuzz) - Update TESTING.md, CONTRIBUTING.md, AGENTS.md to reflect new defaults - Update `make help` output with new default description
1 parent 75293c0 commit 4453939

4 files changed

Lines changed: 68 additions & 14 deletions

File tree

AGENTS.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Repository Guidelines
2+
3+
## Project Structure & Module Organization
4+
The Go module is rooted here, with entrypoints and CLI tooling under `dgraph/` for Alpha, Zero, Live, and companions. Core execution sits in `worker/`, `query/`, and `posting/`, the GraphQL adapters in `graphql/`, and shared helpers in packages like `x/` and `testutil/`. Protocol definitions live in `protos/` (regenerate via `make regenerate` inside that folder). Integration harnesses are in `t/`, broader system scenarios in `systest/`, and container assets under `contrib/` and `compose/`.
5+
6+
## Build, Test, and Development Commands
7+
Use `make dgraph` to compile the Linux AMD64 binaries into `./dgraph/dgraph`, or `make install` to drop them into `$GOPATH/bin`. Run `go test ./path/to/package` for focused checks or `go test ./...` for a fast repo-wide sweep. `make test` (no args) runs the default suite (`unit,systest,core` + `integration2`, ~30 min); use `make test SUITE=all` for all t/ runner suites or `make test-everything` for every test in the repo. Keep Docker running for integration tests. When debugging version info, `make version` surfaces the embedded build metadata.
8+
9+
## Coding Style & Naming Conventions
10+
Follow standard Go conventions: exported identifiers start with capitals, packages use lowercase, and tests use `TestXxx` names. Format every change with `go fmt` (or `gofmt -w`) before committing; CI runs `golangci-lint`, so keep `//nolint` waivers rare and justified. Maintain the SPDX license header block on all new source files and avoid introducing unused helpers or dead code.
11+
12+
## Testing Guidelines
13+
Unit tests live beside their packages in `_test.go` files and run with `go test`. The `t/` harness drives integration clusters; add new scenarios under targeted subdirectories. `systest/` and `graphql/e2e/` capture longer system flows—mirror their layout when extending coverage. Before opening a PR, run `go test ./...` and the `t` or `systest` suites touched by your change, and include regression tests for new behaviour.
14+
15+
## Commit & Pull Request Guidelines
16+
Recent history favors `type(scope): short message` commits (for example, `fix(compose): ...` or `chore: ...`). Keep commits atomic with clear intent, sign when possible, and reference issues using `Fixes #1234` when applicable. PRs should describe the motivation, summarize testing (`go test ./...`, `make test`, etc.), and call out configuration or data migrations. Include doc updates for user-facing behaviour changes and attach CLI output or screenshots if tooling UX shifts.

CONTRIBUTING.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,16 +144,20 @@ directory, providing control and flexibility beyond the standard Go testing fram
144144
The simplest way to run tests is via Make:
145145

146146
```bash
147-
# Run all tests
147+
# Run default tests (~30 min): unit, systest, core suites + integration2
148148
make test
149149

150+
# Run every test in the repo
151+
make test-everything
152+
150153
# Run specific test types
151154
make test-unit # Unit tests only (no Docker)
152155
make test-integration2 # Integration2 tests via dgraphtest
153156
make test-upgrade # Upgrade tests
154157

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

Makefile

Lines changed: 36 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ dgraph-installed:
7979
fi
8080

8181
.PHONY: test
82-
test: dgraph-installed local-image ## Run tests (see 'make help' for options)
82+
test: dgraph-installed local-image ## Run tests (default: unit,systest,core + integration2)
8383
ifdef TAGS
8484
@echo "Running tests with tags: $(TAGS)"
8585
go test -v --tags="$(TAGS)" \
@@ -97,54 +97,82 @@ else
9797
done
9898
endif
9999
else
100-
@echo "Running test suite: $(or $(SUITE),all)"
101-
$(MAKE) -C t test args="--suite=$(or $(SUITE),all) $(if $(PKG),--pkg=\"$(PKG)\") $(if $(TEST),--test=\"$(TEST)\") $(if $(TIMEOUT),--timeout=$(TIMEOUT))"
100+
ifdef SUITE
101+
@echo "Running test suite: $(SUITE)"
102+
$(MAKE) -C t test args="--suite=$(SUITE) $(if $(PKG),--pkg=\"$(PKG)\") $(if $(TEST),--test=\"$(TEST)\") $(if $(TIMEOUT),--timeout=$(TIMEOUT))"
103+
else
104+
@echo "Running test suites: unit, systest, core"
105+
$(MAKE) -C t test args="--suite=unit,systest,core $(if $(PKG),--pkg=\"$(PKG)\") $(if $(TEST),--test=\"$(TEST)\") $(if $(TIMEOUT),--timeout=$(TIMEOUT))"
106+
@echo "Running integration2 tests..."
107+
go test -v --tags="integration2" \
108+
$(if $(TEST),--run="$(TEST)") \
109+
$(if $(PKG),./$(PKG)/...,./...)
110+
endif
102111
endif
103112

104-
.PHONY: test-all
105-
test-all: ## All test suites via t/ runner (i.e. 'make test SUITE=all')
113+
.PHONY: test-suites
114+
test-suites: ## All test suites via t/ runner (i.e. 'make test SUITE=all')
115+
$(if $(filter command line,$(origin SUITE)),$(error SUITE= cannot be passed to test-suites; use 'make test SUITE=...' instead))
106116
@SUITE=all $(MAKE) test
107117

108118
.PHONY: test-unit
109-
test-unit: ## Unit tests, no Docker (i.e. 'make test SUITE=unit')
119+
test-unit: ## Unit tests (i.e. 'make test SUITE=unit')
120+
$(if $(filter command line,$(origin SUITE)),$(error SUITE= cannot be passed to test-unit; use 'make test SUITE=...' instead))
110121
@SUITE=unit $(MAKE) test
111122

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

116128
.PHONY: test-integration
117129
test-integration: ## Integration tests (i.e. 'make test TAGS=integration')
130+
$(if $(filter command line,$(origin TAGS)),$(error TAGS= cannot be passed to test-integration; use 'make test TAGS=...' instead))
118131
@TAGS=integration $(MAKE) test
119132

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

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

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

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

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

140158
.PHONY: test-ldbc
141159
test-ldbc: ## LDBC benchmark tests (i.e. 'make test SUITE=ldbc')
160+
$(if $(filter command line,$(origin SUITE)),$(error SUITE= cannot be passed to test-ldbc; use 'make test SUITE=...' instead))
142161
@SUITE=ldbc $(MAKE) test
143162

144163
.PHONY: test-load
145164
test-load: ## Heavy load tests (i.e. 'make test SUITE=load')
165+
$(if $(filter command line,$(origin SUITE)),$(error SUITE= cannot be passed to test-load; use 'make test SUITE=...' instead))
146166
@SUITE=load $(MAKE) test
147167

168+
.PHONY: test-everything
169+
test-everything: ## Every test: all suites + integration + integration2 + upgrade + fuzz
170+
$(MAKE) test-suites
171+
$(MAKE) test-integration
172+
$(MAKE) test-integration2
173+
$(MAKE) test-upgrade
174+
$(MAKE) test-fuzz
175+
148176
.PHONY: test-benchmark
149177
test-benchmark: ## Go benchmarks (i.e. 'go test -bench')
150178
go test -bench=. -benchmem $(if $(PKG),./$(PKG)/...,./...)
@@ -201,7 +229,7 @@ help: ## Show available targets and variables
201229
awk 'BEGIN {FS = ":.*?## "}; {printf " %-20s %s\n", $$1, $$2}'
202230
@echo ""
203231
@echo "Variables that can be passed to 'test':"
204-
@echo " SUITE Select t/ runner suite (e.g., make test SUITE=systest)"
232+
@echo " SUITE Select t/ runner suite (default: unit,systest,core + integration2)"
205233
@echo " TAGS Go build tags - bypasses t/ runner (e.g., make test TAGS=integration2)"
206234
@echo " PKG Limit to specific package (e.g., make test PKG=systest/export)"
207235
@echo " TEST Run specific test function (e.g., make test TEST=TestGQLSchema)"

TESTING.md

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -304,12 +304,15 @@ If both pass, you're ready to run all test types!
304304
The simplest way to run tests:
305305

306306
```bash
307-
# Run all tests (default)
307+
# Run default tests (~30 min): unit, systest, core suites + integration2
308308
make test
309309

310+
# Run every test in the repo (all suites + all tag-based tests + fuzz)
311+
make test-everything
312+
310313
# Common shortcuts (run 'make help' for full list)
311-
make test-all # All test suites via t/ runner (i.e. 'make test SUITE=all')
312-
make test-unit # Unit tests, no Docker (i.e. 'make test SUITE=unit')
314+
make test-suites # All t/ runner suites (i.e. 'make test SUITE=all')
315+
make test-unit # Unit tests (i.e. 'make test SUITE=unit')
313316
make test-core # Core tests (i.e. 'make test SUITE=core')
314317
make test-systest # System integration tests (i.e. 'make test SUITE=systest')
315318
make test-vector # Vector search tests (i.e. 'make test SUITE=vector')
@@ -318,7 +321,7 @@ make test-load # Heavy load tests (i.e. 'make test SUITE=load')
318321
make test-integration # Integration tests (i.e. 'make test TAGS=integration')
319322
make test-integration2 # Integration2 tests via dgraphtest (i.e. 'make test TAGS=integration2')
320323
make test-upgrade # Upgrade tests (i.e. 'make test TAGS=upgrade')
321-
make test-fuzz # Fuzz tests, auto-discovers packages (i.e. 'make test FUZZ=1')
324+
make test-fuzz # Fuzz tests (i.e. 'make test FUZZ=1')
322325
make test-benchmark # Go benchmarks (i.e. 'go test -bench')
323326
```
324327

@@ -339,7 +342,8 @@ For more control, pass variables to `make test`:
339342
| `FUZZ` | Enable fuzz testing | `make test FUZZ=1` |
340343
| `FUZZTIME` | Fuzz duration per package | `make test FUZZ=1 FUZZTIME=60s` |
341344

342-
**Precedence:** `TAGS` > `FUZZ` > `SUITE` (first match wins)
345+
**Precedence:** `TAGS` > `FUZZ` > `SUITE` > default (first match wins). When no
346+
variable is set, `make test` runs suites `unit,systest,core` plus `integration2`.
343347

344348
### Examples
345349

@@ -1288,6 +1292,8 @@ The following items from the original wishlist have been implemented:
12881292

12891293
- **✅ Unified test interface:** A single `make test` entry point that accepts arguments to run any
12901294
test type (unit, integration, integration2, upgrade, fuzz) with environment variables for control.
1295+
The default (`make test` with no args) runs `unit,systest,core` suites plus `integration2` for a
1296+
fast feedback loop (~30 min). Use `make test-everything` to run all tests.
12911297

12921298
- **✅ Example commands that "just work":** The following now work as expected:
12931299

0 commit comments

Comments
 (0)