Skip to content

fix(test): resolve macOS binary selection and test data clobbering#9606

Merged
matthewmcneely merged 6 commits intomainfrom
fix/shiva-test-mac-os
Feb 23, 2026
Merged

fix(test): resolve macOS binary selection and test data clobbering#9606
matthewmcneely merged 6 commits intomainfrom
fix/shiva-test-mac-os

Conversation

@mlwelles
Copy link
Copy Markdown
Contributor

@mlwelles mlwelles commented Feb 19, 2026

Description

This PR builds upon #9603 by @shiva-istari and adds fixes for issues exposed when macOS skip guards are removed.

Original PR (#9603)

On macOS, setupBinary() now copies both the Linux binary (for Docker containers) and the host-native binary (for local bulk/live loader commands) into tempBinDir. On Linux, a single binary serves both purposes. BulkLoad() and LiveLoad() use hostDgraphBinaryPath() to pick the correct one based on the platform. Removed macOS skip guards from 13 test files so all tests run on both platforms after make install.

Fix 1: test data clobbering in --suite=all (t/t.go)

When running make test (--suite=all), the load and ldbc download blocks shared *tmp. The LDBC block's MakeDirEmpty wiped load data files, causing systest/1million to fail. Fixed by hoisting directory init above both download blocks so MakeDirEmpty runs once. Also uses a dedicated subdirectory (dgraph-test-data) instead of bare os.TempDir().

Fix 2: $GOPATH/bin in Docker Compose files (30 files)

30 Docker Compose files hardcoded $GOPATH/bin as the binary mount source. On macOS this mounts the native binary into Linux containers, crashing them. Replaced all 78 occurrences with ${LINUX_GOBIN:-$GOPATH/bin} to match the pattern in dgraph/docker-compose.yml.

Fix 3: add --timeout flag to t/ runner

The per-package test timeout was hardcoded to 30m, which is too short for the 21million/live test on macOS (where Docker runs in a VM with I/O overhead). Added a --timeout flag to t/t.go and wired it through the Makefile as TIMEOUT:

make test TIMEOUT=90m
cd t && ./t --suite=all --timeout=60m

Defaults remain unchanged: 30m normal, 180m with --race. An explicit --timeout overrides both. Updated docs in Makefile help, CONTRIBUTING.md, and TESTING.md.

Checklist

  • The PR title follows the Conventional Commits syntax
  • Code compiles correctly and linting passes locally

Shiva and others added 2 commits February 19, 2026 18:19
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.
@mlwelles mlwelles requested a review from a team as a code owner February 19, 2026 22:17
@github-actions github-actions bot added area/testing Testing related issues area/live-loader Issues related to live loading. go Pull requests that update Go code labels Feb 19, 2026
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.
@github-actions github-actions bot added area/graphql Issues related to GraphQL support on Dgraph. area/core internal mechanisms labels Feb 19, 2026
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.
@github-actions github-actions bot added the area/documentation Documentation related issues. label Feb 19, 2026
@blacksmith-sh

This comment has been minimized.

Remove empty if-branch flagged by staticcheck SA9003 in t/t.go and
fix markdown table alignment in TESTING.md for prettier compliance.
@matthewmcneely matthewmcneely merged commit ffab4bb into main Feb 23, 2026
26 checks passed
@matthewmcneely matthewmcneely deleted the fix/shiva-test-mac-os branch February 23, 2026 18:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/core internal mechanisms area/documentation Documentation related issues. area/graphql Issues related to GraphQL support on Dgraph. area/live-loader Issues related to live loading. area/testing Testing related issues go Pull requests that update Go code

Development

Successfully merging this pull request may close these issues.

2 participants