fix(test): make test defaults to fast suite + macOS compat#9609
Closed
mlwelles wants to merge 14 commits intodgraph-io:mainfrom
Closed
fix(test): make test defaults to fast suite + macOS compat#9609mlwelles wants to merge 14 commits intodgraph-io:mainfrom
mlwelles wants to merge 14 commits intodgraph-io:mainfrom
Conversation
When running `make test` (--suite=all), the load and ldbc download
blocks in t/t.go shared the same *tmp directory. The ldbc block's
MakeDirEmpty call wiped files downloaded by the load block, causing
systest/1million to fail with missing schema files.
Hoist directory initialization above both download blocks so
MakeDirEmpty runs exactly once. Both datasets coexist in the same
directory since their filenames don't overlap. Also use a dedicated
subdirectory (dgraph-test-data) instead of bare os.TempDir() to
avoid wiping the system temp directory.
Add testSuiteContainsAny() helper to replace repeated
testSuiteContains("x") || testSuiteContains("y") patterns.
30 Docker Compose files hardcoded $GOPATH/bin as the binary mount
source. On macOS, this mounts the native macOS binary into Linux
containers, causing them to fail on startup.
Replace all 78 occurrences with ${LINUX_GOBIN:-$GOPATH/bin} to match
the pattern already used in dgraph/docker-compose.yml. On Linux,
LINUX_GOBIN defaults to $GOPATH/bin (no change). On macOS, it points
to the cross-compiled Linux binary directory.
Add a configurable per-package test timeout flag to the t/ runner. Previously the timeout was hardcoded to 30m (or 180m with --race), which caused the 21million/live test to time out on slower machines. Usage: make test TIMEOUT=90m cd t && ./t --suite=all --timeout=60m Defaults remain unchanged: 30m normal, 180m with --race. An explicit --timeout overrides both.
Remove empty if-branch flagged by staticcheck SA9003 in t/t.go and fix markdown table alignment in TESTING.md for prettier compliance.
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
Resolve conflicts in Makefile and CONTRIBUTING.md, keeping the PR's dual-command default (unit,systest,core + integration2) and the SUITE=all example line.
Shorter, clearer name for the target that runs every test in the repo (all suites + integration + integration2 + upgrade + fuzz).
test-suite now accepts an optional SUITE= argument (defaults to all), making it a flexible entry point for running any t/ runner suite.
AGENTS.md is a local Claude Code config file that should not be tracked in version control.
…s-compilation - Remove broken test-integration target: TAGS=integration bypassed the t/ runner, skipping Docker Compose orchestration and plugin compilation that integration tests require. Use SUITE= to route through the t/ runner instead. - Fix gotestsum PATH resolution in t/t.go: add gotestsumBin() that resolves to $GOPATH/bin/gotestsum instead of relying on PATH lookup, which fails on machines where $GOPATH/bin is not in PATH. - Add cross-compilation support for Go plugins on macOS: detect non-Linux hosts and set CGO_ENABLED=1, CC to the appropriate cross-compiler, and use the BFD linker (both testutil/plugin.go and dgraphtest/local_cluster.go). - Add check-cross-compiler.sh dependency check script. - Add top-level make deps and make setup targets for dependency management. - Update TESTING.md and CONTRIBUTING.md to document new targets and recommend make setup for first-time onboarding. - Remove test-integration from test-full (redundant: SUITE=all covers it).
The local-image and install targets cross-compiled the dgraph binary without CGO, producing a statically linked binary that cannot dlopen() Go plugin .so files. This caused all plugin tests to fail on macOS with "Invalid tokenizer anagram". Changes: - Add LINUX_CC variable for architecture-aware cross-compiler selection - Enable CGO_ENABLED=1 with cross-compiler in install and local-image - Use BFD linker (-fuse-ld=bfd) since gold is not in cross-toolchains - Skip jemalloc (BUILD_TAGS=) for cross-compilation (headers unavailable) - Add EXTLDFLAGS support to dgraph/Makefile for external linker flags - Split t/Makefile check into deps (tools) + check (tools + binary) - Top-level setup now calls t/deps so it no longer requires the binary
Contributor
Author
|
Closing fork PR — reopening from upstream branch to fix CI permission issues (label, Trunk token). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
make testdefault from--suite=all(~60+ min) tounit,systest,core+integration2(~30 min) for faster local feedback$(origin)guards on alltest-*targets to prevent confusing variable conflicts (e.g.,make test-unit SUITE=ldbcnow errors with a clear message)test-suitetarget — runs t/ runner suites (defaults to all, acceptsSUITE=arg)test-fulltarget — runs every test in the repo (all suites + integration2 + upgrade + fuzz)test-integrationtarget —TAGS=integrationbypassed the t/ runner, skipping Docker Compose orchestration and plugin compilation that integration tests require. These tests should be run viaSUITE=which routes through the t/ runner.LINUX_GOBINhandling in Docker Compose files, cross-compiler detection scriptdlopen()Go plugin.sofiles. Without CGO, the binary was statically linked andplugin.Open()silently failed.t/t.gonow resolves gotestsum via$GOPATH/binabsolute path instead of relying on$PATH, which fails on machines where$GOPATH/binis not in PATHmake depsandmake setup— top-level targets for dependency checking and auto-installation (replacescd t && make check)t/Makefilecheckis split intodeps(external tools only) andcheck(tools + binary verification).make setupcallsdepsso it no longer requires the dgraph binary to exist.--timeoutflag tot/runner andmake testmake setupfor onboardingCross-compilation details (macOS → Linux)
The
installandlocal-imagetargets now cross-compile with:CGO_ENABLED=1— produces a dynamically linked binary (required fordlopen()/plugin support)CC=$(LINUX_CC)— uses architecture-appropriate cross-compiler (aarch64-unknown-linux-gnu-gccon ARM,x86_64-unknown-linux-gnu-gccon x86)BUILD_TAGS=— disables jemalloc (Linux jemalloc headers not available on macOS cross-toolchain)EXTLDFLAGS=-fuse-ld=bfd— uses BFD linker since gold linker is not shipped with cross-compiler toolchainsOn Linux, all targets behave as before (native CGO, native jemalloc, default linker).
Make targets after this PR
make testmake test SUITE=allmake test-suitemake test-suite SUITE=unitmake test-fullmake test-unitmake test-coremake test-systestmake test-integration2make test-upgrademake test-fuzzmake depsAUTO_INSTALL=trueto auto-install)make setupVariable conflict guards
Convenience targets now reject conflicting CLI variables:
Test plan
make test→ prints "Running test suites: unit, systest, core" then "Running integration2 tests..."make test SUITE=all→ runs only all suites, no integration2 appendedmake test TAGS=integration2→ runs only integration2make test FUZZ=1→ runs only fuzzmake test-unit SUITE=ldbc→ errors with clear messagemake test-integration2 TAGS=upgrade→ errors with clear messagemake test-fuzz FUZZ=0→ errors with clear messagemake test-unit PKG=query→ works (PKG is a filter, not a conflict)make help→ reflects new defaultsmake setup→ auto-installs missing tool dependencies (no binary required)make clean setup test-suite PKG=systest/plugin→ all 7 plugin tests passmake clean setup test-suite PKG=systest/plugin→ all 7 plugin tests passdocker inspect dgraph/dgraph:local --format '{{.Architecture}}'→arm64on M-series Macmake testrun completes within ~30 min threshold