From 702e7401946129d3d406cf5839e443e3ce23c3ac Mon Sep 17 00:00:00 2001 From: Shiva Date: Wed, 18 Feb 2026 16:40:24 +0530 Subject: [PATCH 01/18] resolve dgraph binary selection for macOS in dgraphtest and testutil --- check_upgrade/check_upgrade_test.go | 12 ++----- dgraph/cmd/dgraphimport/import_test.go | 7 ---- dgraph/cmd/live/load-json/load_test.go | 7 ---- dgraph/cmd/live/load-uids/load_test.go | 6 ---- dgraph/cmd/version/version_test.go | 7 ---- dgraphtest/image.go | 45 ++++++++++++++++++++---- dgraphtest/load.go | 25 +++++++------ systest/1million/1million_test.go | 6 ---- systest/21million/bulk/run_test.go | 5 --- systest/audit_encrypted/audit_test.go | 6 ---- systest/cdc/cdc_test.go | 5 --- systest/export/export_test.go | 7 ---- systest/integration2/bulk_loader_test.go | 6 ---- systest/ldbc/ldbc_test.go | 6 ---- systest/loader/loader_test.go | 6 ---- testutil/exec.go | 5 --- 16 files changed, 55 insertions(+), 106 deletions(-) diff --git a/check_upgrade/check_upgrade_test.go b/check_upgrade/check_upgrade_test.go index 29ffc8f97ab..7b75fa230e1 100644 --- a/check_upgrade/check_upgrade_test.go +++ b/check_upgrade/check_upgrade_test.go @@ -10,11 +10,8 @@ package checkupgrade import ( "context" "fmt" - "os" "os/exec" - "path/filepath" "regexp" - "runtime" "testing" "time" @@ -28,11 +25,6 @@ import ( ) func TestCheckUpgrade(t *testing.T) { - if runtime.GOOS != "linux" && os.Getenv("DGRAPH_BINARY") == "" { - fmt.Println("Skipping live load-uids tests on non-Linux platforms due to dgraph binary dependency") - fmt.Println("You can set the DGRAPH_BINARY environment variable to path of a native dgraph binary to run these tests") - os.Exit(0) - } conf := dgraphtest.NewClusterConfig().WithNumAlphas(1).WithNumZeros(1).WithReplicas(1). WithACL(time.Hour).WithVersion("57aa5c4ac") c, err := dgraphtest.NewLocalCluster(conf) @@ -88,7 +80,7 @@ func TestCheckUpgrade(t *testing.T) { "--namespace", "1", } - cmd := exec.Command(filepath.Join(c1.GetTempDir(), "dgraph"), args...) + cmd := exec.Command(c1.HostDgraphBinaryPath(), args...) out, err := cmd.CombinedOutput() require.NoError(t, err) actualOutput := string(out) @@ -108,7 +100,7 @@ func TestQueryDuplicateNodes(t *testing.T) { WithACL(time.Hour).WithVersion("57aa5c4ac").WithAclAlg(jwt.GetSigningMethod("HS256")) c, err := dgraphtest.NewLocalCluster(conf) require.NoError(t, err) - // defer func() { c.Cleanup(t.Failed()) }() + defer func() { c.Cleanup(t.Failed()) }() require.NoError(t, c.Start()) gc, cleanup, err := c.Client() require.NoError(t, err) diff --git a/dgraph/cmd/dgraphimport/import_test.go b/dgraph/cmd/dgraphimport/import_test.go index b6925775a33..ccec66324a8 100644 --- a/dgraph/cmd/dgraphimport/import_test.go +++ b/dgraph/cmd/dgraphimport/import_test.go @@ -10,9 +10,7 @@ import ( "context" "encoding/json" "fmt" - "os" "path/filepath" - "runtime" "strconv" "strings" "testing" @@ -326,11 +324,6 @@ func runImportTest(t *testing.T, tt testcase) { // setupBulkCluster creates and configures a cluster for bulk loading data func setupBulkCluster(t *testing.T, numAlphas int, encrypted bool) (*dgraphtest.LocalCluster, string) { - if runtime.GOOS != "linux" && os.Getenv("DGRAPH_BINARY") == "" { - fmt.Println("You can set the DGRAPH_BINARY environment variable to path of a native dgraph binary to run these tests") - t.Skip("Skipping test on non-Linux platforms due to dgraph binary dependency") - } - baseDir := t.TempDir() bulkConf := dgraphtest.NewClusterConfig(). WithNumAlphas(numAlphas). diff --git a/dgraph/cmd/live/load-json/load_test.go b/dgraph/cmd/live/load-json/load_test.go index 7cf96c4504f..d4f0616e28a 100644 --- a/dgraph/cmd/live/load-json/load_test.go +++ b/dgraph/cmd/live/load-json/load_test.go @@ -9,7 +9,6 @@ package live import ( "context" - "fmt" "os" "path/filepath" "runtime" @@ -162,12 +161,6 @@ func TestLiveLoadJSONMultipleFiles(t *testing.T) { } func TestMain(m *testing.M) { - if runtime.GOOS != "linux" && os.Getenv("DGRAPH_BINARY") == "" { - fmt.Println("Skipping live load-json tests on non-Linux platforms due to dgraph binary dependency") - fmt.Println("You can set the DGRAPH_BINARY environment variable to path of a native dgraph binary to run these tests") - os.Exit(0) - } - _, thisFile, _, _ := runtime.Caller(0) testDataDir = filepath.Dir(thisFile) diff --git a/dgraph/cmd/live/load-uids/load_test.go b/dgraph/cmd/live/load-uids/load_test.go index f194d6c3ba2..f3f44f5b23f 100644 --- a/dgraph/cmd/live/load-uids/load_test.go +++ b/dgraph/cmd/live/load-uids/load_test.go @@ -351,12 +351,6 @@ func TestLiveLoadFileNameMultipleCorrect(t *testing.T) { } func TestMain(m *testing.M) { - if runtime.GOOS != "linux" && os.Getenv("DGRAPH_BINARY") == "" { - fmt.Println("Skipping live load-uids tests on non-Linux platforms due to dgraph binary dependency") - fmt.Println("You can set the DGRAPH_BINARY environment variable to path of a native dgraph binary to run these tests") - os.Exit(0) - } - alphaService = testutil.GetSockAddr() alphaName = testutil.Instance diff --git a/dgraph/cmd/version/version_test.go b/dgraph/cmd/version/version_test.go index f63c28da553..3ee8c3e5267 100644 --- a/dgraph/cmd/version/version_test.go +++ b/dgraph/cmd/version/version_test.go @@ -6,10 +6,8 @@ package version import ( - "fmt" "os" "path/filepath" - "runtime" "testing" "github.com/stretchr/testify/require" @@ -19,11 +17,6 @@ import ( // Test `dgraph version` with an empty config file. func TestMain(m *testing.M) { - if runtime.GOOS != "linux" && os.Getenv("DGRAPH_BINARY") == "" { - fmt.Println("Skipping version tests on non-Linux platforms due to dgraph binary dependency") - fmt.Println("You can set the DGRAPH_BINARY environment variable to path of a native dgraph binary to run these tests") - os.Exit(0) - } m.Run() } diff --git a/dgraphtest/image.go b/dgraphtest/image.go index c0e5f8f2bdb..d0417ed1814 100644 --- a/dgraphtest/image.go +++ b/dgraphtest/image.go @@ -12,6 +12,7 @@ import ( "os" "os/exec" "path/filepath" + "runtime" "strings" "sync" @@ -28,9 +29,18 @@ func (c *LocalCluster) dgraphImage() string { return "dgraph/dgraph:local" } -// setupBinary sets up the dgraph binary. The binary is expected to be a version -// compiled that is compatible with the host OS and architecture. Search this repo -// for DGRAPH_BINARY to learn its use. +// setupBinary sets up dgraph binaries in tempBinDir. +// +// On Linux a single "dgraph" binary from $GOPATH/bin serves both Docker +// containers and local commands (bulk/live loader). +// +// On non-Linux (macOS) two binaries are placed in tempBinDir: +// - "dgraph" – a Linux binary for Docker containers, from +// $GOPATH/linux_ (or LINUX_GOBIN if set). +// - "dgraph_host" – the host-native binary for local commands, +// from $GOPATH/bin. +// +// Both are produced by "make install". func (c *LocalCluster) setupBinary() error { if err := ensureDgraphClone(); err != nil { panic(err) @@ -43,11 +53,34 @@ func (c *LocalCluster) setupBinary() error { } } if c.conf.version == localVersion { - if os.Getenv("GOPATH") == "" { + gopath := os.Getenv("GOPATH") + if gopath == "" { return errors.New("GOPATH is not set") } - fromDir := filepath.Join(os.Getenv("GOPATH"), "bin") - return copyBinary(fromDir, c.tempBinDir, c.conf.version) + + if runtime.GOOS == "linux" { + // On Linux $GOPATH/bin/dgraph is both the native and Docker binary. + return copyBinary(filepath.Join(gopath, "bin"), c.tempBinDir, c.conf.version) + } + + // Non-Linux (macOS): need separate Linux and host-native binaries. + // 1. Copy the Linux binary (for Docker containers) as "dgraph". + linuxDir := os.Getenv("LINUX_GOBIN") + if linuxDir == "" { + linuxDir = filepath.Join(gopath, "linux_"+runtime.GOARCH) + } + if err := copyBinary(linuxDir, c.tempBinDir, c.conf.version); err != nil { + return err + } + + // 2. Copy the host-native binary (for local bulk/live commands) as "dgraph_host". + hostSrc := filepath.Join(gopath, "bin", "dgraph") + + hostDst := filepath.Join(c.tempBinDir, "dgraph_host") + if err := copy(hostSrc, hostDst); err != nil { + return errors.Wrapf(err, "error copying host-native binary from [%v] to [%v]", hostSrc, hostDst) + } + return nil } binaryPath := filepath.Join(binariesPath, fmt.Sprintf(binaryNameFmt, c.conf.version)) diff --git a/dgraphtest/load.go b/dgraphtest/load.go index a356f66612c..66131d7125d 100644 --- a/dgraphtest/load.go +++ b/dgraphtest/load.go @@ -17,6 +17,7 @@ import ( "os" "os/exec" "path/filepath" + "runtime" "strconv" "strings" @@ -28,6 +29,17 @@ import ( "github.com/dgraph-io/dgraph/v25/x" ) +// HostDgraphBinaryPath returns the path to the host-OS-native dgraph binary +// in tempBinDir. On Linux this is simply "dgraph" (the same binary used by +// Docker containers). On non-Linux (macOS) it is "dgraph_host", a separate +// native binary copied by setupBinary(). +func (c *LocalCluster) HostDgraphBinaryPath() string { + if runtime.GOOS == "linux" { + return filepath.Join(c.tempBinDir, "dgraph") + } + return filepath.Join(c.tempBinDir, "dgraph_host") +} + var datafiles = map[string]string{ "1million.schema": "https://github.com/dgraph-io/dgraph-benchmarks/blob/main/data/1million.schema?raw=true", "1million.rdf.gz": "https://github.com/dgraph-io/dgraph-benchmarks/blob/main/data/1million.rdf.gz?raw=true", @@ -245,7 +257,7 @@ func (c *LocalCluster) LiveLoad(opts LiveOpts) error { } log.Printf("[INFO] running live loader with args: [%v]", strings.Join(args, " ")) - cmd := exec.Command(filepath.Join(c.tempBinDir, "dgraph"), args...) + cmd := exec.Command(c.HostDgraphBinaryPath(), args...) if out, err := cmd.CombinedOutput(); err != nil { return errors.Wrapf(err, "error running live loader: %v", string(out)) } else { @@ -505,17 +517,8 @@ func (c *LocalCluster) BulkLoad(opts BulkOpts) error { args = append(args, "-g", strings.Join(opts.GQLSchemaFiles, ",")) } - // dgraphCmdPath := os.Getenv("DGRAPH_CMD_PATH") - // if dgraphCmdPath == "" { - // dgraphCmdPath = filepath.Join(c.tempBinDir, "dgraph") - // } - log.Printf("[INFO] running bulk loader with args: [%v]", strings.Join(args, " ")) - binaryName := "dgraph" - if os.Getenv("DGRAPH_BINARY") != "" { - binaryName = filepath.Base(os.Getenv("DGRAPH_BINARY")) - } - cmd := exec.Command(filepath.Join(c.tempBinDir, binaryName), args...) + cmd := exec.Command(c.HostDgraphBinaryPath(), args...) if out, err := cmd.CombinedOutput(); err != nil { return errors.Wrapf(err, "error running bulk loader: %v", string(out)) } else { diff --git a/systest/1million/1million_test.go b/systest/1million/1million_test.go index 936821684e2..e3a46df1f76 100644 --- a/systest/1million/1million_test.go +++ b/systest/1million/1million_test.go @@ -12,7 +12,6 @@ import ( "fmt" "os" "path/filepath" - "runtime" "testing" "time" @@ -44,11 +43,6 @@ func Test1Million(t *testing.T) { } func TestMain(m *testing.M) { - if runtime.GOOS != "linux" && os.Getenv("DGRAPH_BINARY") == "" { - fmt.Println("Skipping 1million tests on non-Linux platforms due to dgraph binary dependency") - fmt.Println("You can set the DGRAPH_BINARY environment variable to path of a native dgraph binary to run these tests") - os.Exit(0) - } noschemaFile := filepath.Join(testutil.TestDataDirectory, "1million-noindex.schema") rdfFile := filepath.Join(testutil.TestDataDirectory, "1million.rdf.gz") if err := testutil.MakeDirEmpty([]string{"out/0", "out/1", "out/2"}); err != nil { diff --git a/systest/21million/bulk/run_test.go b/systest/21million/bulk/run_test.go index ef4905a400b..6e3a7d16b44 100644 --- a/systest/21million/bulk/run_test.go +++ b/systest/21million/bulk/run_test.go @@ -69,11 +69,6 @@ func BenchmarkQueries(b *testing.B) { } func TestMain(m *testing.M) { - if runtime.GOOS != "linux" && os.Getenv("DGRAPH_BINARY") == "" { - fmt.Println("Skipping 21million bulk tests on non-Linux platforms due to dgraph binary dependency") - fmt.Println("You can set the DGRAPH_BINARY environment variable to path of a native dgraph binary to run these tests") - os.Exit(0) - } schemaFile := filepath.Join(testutil.TestDataDirectory, "21million.schema") rdfFile := filepath.Join(testutil.TestDataDirectory, "21million.rdf.gz") if err := testutil.MakeDirEmpty([]string{"out/0", "out/1", "out/2"}); err != nil { diff --git a/systest/audit_encrypted/audit_test.go b/systest/audit_encrypted/audit_test.go index f8ed786c87e..9126dc63ecb 100644 --- a/systest/audit_encrypted/audit_test.go +++ b/systest/audit_encrypted/audit_test.go @@ -11,7 +11,6 @@ import ( "fmt" "os" "os/exec" - "runtime" "testing" "github.com/stretchr/testify/require" @@ -21,11 +20,6 @@ import ( ) func TestMain(m *testing.M) { - if runtime.GOOS != "linux" && os.Getenv("DGRAPH_BINARY") == "" { - fmt.Println("Skipping audit_encrypted tests on non-Linux platforms due to dgraph binary dependency") - fmt.Println("You can set the DGRAPH_BINARY environment variable to path of a native dgraph binary to run these tests") - os.Exit(0) - } m.Run() } diff --git a/systest/cdc/cdc_test.go b/systest/cdc/cdc_test.go index 4d438ed5f6e..164081338af 100644 --- a/systest/cdc/cdc_test.go +++ b/systest/cdc/cdc_test.go @@ -14,7 +14,6 @@ import ( "os" "os/exec" "path/filepath" - "runtime" "testing" "time" @@ -24,10 +23,6 @@ import ( ) func TestCDC(t *testing.T) { - if runtime.GOOS != "linux" && os.Getenv("DGRAPH_BINARY") == "" { - fmt.Println("You can set the DGRAPH_BINARY environment variable to path of a native dgraph binary to run these tests") - t.Skip("Skipping test on non-Linux platforms due to dgraph binary dependency") - } defer os.RemoveAll("./cdc_logs/sink.log") path := testutil.DgraphBinaryPath() cmd := exec.Command(path, "increment", "--num", "10", diff --git a/systest/export/export_test.go b/systest/export/export_test.go index b35f1eaca7f..409597061b7 100644 --- a/systest/export/export_test.go +++ b/systest/export/export_test.go @@ -12,12 +12,10 @@ import ( "compress/gzip" "context" "encoding/json" - "fmt" "io" "net/http" "os" "path/filepath" - "runtime" "strings" "testing" @@ -32,11 +30,6 @@ import ( ) func TestMain(m *testing.M) { - if runtime.GOOS != "linux" && os.Getenv("DGRAPH_BINARY") == "" { - fmt.Println("Skipping export tests on non-Linux platforms due to dgraph binary dependency") - fmt.Println("You can set the DGRAPH_BINARY environment variable to path of a native dgraph binary to run these tests") - os.Exit(0) - } m.Run() } diff --git a/systest/integration2/bulk_loader_test.go b/systest/integration2/bulk_loader_test.go index f688730544c..11a59c35a98 100644 --- a/systest/integration2/bulk_loader_test.go +++ b/systest/integration2/bulk_loader_test.go @@ -8,10 +8,8 @@ package main import ( - "fmt" "os" "path/filepath" - "runtime" "testing" "time" @@ -65,10 +63,6 @@ const ( ) func TestBulkLoaderNoDqlSchema(t *testing.T) { - if runtime.GOOS != "linux" && os.Getenv("DGRAPH_BINARY") == "" { - fmt.Println("You can set the DGRAPH_BINARY environment variable to path of a native dgraph binary to run these tests") - t.Skip("Skipping test on non-Linux platforms due to dgraph binary dependency") - } conf := dgraphtest.NewClusterConfig().WithNumAlphas(2).WithNumZeros(1). WithACL(time.Hour).WithReplicas(1).WithBulkLoadOutDir(t.TempDir()) c, err := dgraphtest.NewLocalCluster(conf) diff --git a/systest/ldbc/ldbc_test.go b/systest/ldbc/ldbc_test.go index c01551ea22e..608728b7579 100644 --- a/systest/ldbc/ldbc_test.go +++ b/systest/ldbc/ldbc_test.go @@ -12,7 +12,6 @@ import ( "fmt" "os" "path/filepath" - "runtime" "testing" "time" @@ -72,11 +71,6 @@ func TestQueries(t *testing.T) { } func TestMain(m *testing.M) { - if runtime.GOOS != "linux" && os.Getenv("DGRAPH_BINARY") == "" { - fmt.Println("Skipping LDBC tests on non-Linux platforms due to dgraph binary dependency") - fmt.Println("You can set the DGRAPH_BINARY environment variable to path of a native dgraph binary to run these tests") - os.Exit(0) - } noschemaFile := filepath.Join(testutil.TestDataDirectory, "ldbcTypes.schema") rdfFile := testutil.TestDataDirectory if err := testutil.MakeDirEmpty([]string{"out/0"}); err != nil { diff --git a/systest/loader/loader_test.go b/systest/loader/loader_test.go index d134a17752e..724f31c04bd 100644 --- a/systest/loader/loader_test.go +++ b/systest/loader/loader_test.go @@ -12,7 +12,6 @@ import ( "fmt" "os" "path/filepath" - "runtime" "testing" "github.com/spf13/viper" @@ -24,11 +23,6 @@ import ( ) func TestMain(m *testing.M) { - if runtime.GOOS != "linux" && os.Getenv("DGRAPH_BINARY") == "" { - fmt.Println("Skipping loader tests on non-Linux platforms due to dgraph binary dependency") - fmt.Println("You can set the DGRAPH_BINARY environment variable to path of a native dgraph binary to run these tests") - os.Exit(0) - } m.Run() } diff --git a/testutil/exec.go b/testutil/exec.go index 5a07ffa1e61..bd986136569 100644 --- a/testutil/exec.go +++ b/testutil/exec.go @@ -116,11 +116,6 @@ func pipelineInternal(cmds [][]string, opts []CmdOpts) (string, error) { } func DgraphBinaryPath() string { - // Useful for OSX, as $GOPATH/bin/dgraph is set to the linux binary for docker - if dgraphBinary := os.Getenv("DGRAPH_BINARY"); dgraphBinary != "" { - return dgraphBinary - } - gopath := os.Getenv("GOPATH") if gopath == "" { From e3e8a39e2cbbba494c70dfdc078802a413cc21f0 Mon Sep 17 00:00:00 2001 From: Michael Welles Date: Thu, 19 Feb 2026 17:15:21 -0500 Subject: [PATCH 02/18] fix(test): prevent data file clobbering when running --suite=all 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. --- t/t.go | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/t/t.go b/t/t.go index b6dda3e46ac..7b3c553a84f 100644 --- a/t/t.go +++ b/t/t.go @@ -899,6 +899,15 @@ func testSuiteContains(suite string) bool { return false } +func testSuiteContainsAny(suites ...string) bool { + for _, suite := range suites { + if testSuiteContains(suite) { + return true + } + } + return false +} + func isValidPackageForSuite(pkg string) bool { valid := false if testSuiteContains("all") { @@ -1211,19 +1220,18 @@ func run() error { go func() { defer close(testCh) valid := getPackages() - - if testSuiteContains("load") || testSuiteContains("all") { - if *tmp == "" { - *tmp = os.TempDir() - } + // in "all" mode we can download both data files and + // ldbc files into the same directory, no duplicated + // filenames between the two + needsData := testSuiteContainsAny("load", "ldbc", "all") + if needsData && *tmp == "" { + *tmp = filepath.Join(os.TempDir(), "dgraph-test-data") x.Check(testutil.MakeDirEmpty([]string{*tmp})) + } + if testSuiteContainsAny("load", "all") { downloadDataFiles() } - if testSuiteContains("ldbc") || testSuiteContains("all") { - if *tmp == "" { - *tmp = filepath.Join(os.TempDir(), "/ldbcdata") - } - x.Check(testutil.MakeDirEmpty([]string{*tmp})) + if testSuiteContainsAny("ldbc", "all") { downloadLDBCFiles() } for i, task := range valid { From 53bad0fefdefdc70b11d7617eaed960d3e76fc93 Mon Sep 17 00:00:00 2001 From: Michael Welles Date: Thu, 19 Feb 2026 17:35:04 -0500 Subject: [PATCH 03/18] fix(test): use LINUX_GOBIN in all Docker Compose files for macOS compat 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. --- .../alpha/mutations_mode/docker-compose.yml | 12 ++++++------ .../admin_auth/poorman_auth/docker-compose.yml | 4 ++-- .../poorman_auth_with_acl/docker-compose.yml | 4 ++-- graphql/e2e/auth/debug_off/docker-compose.yml | 4 ++-- graphql/e2e/auth/docker-compose.yml | 4 ++-- .../auth_closed_by_default/docker-compose.yml | 4 ++-- graphql/e2e/custom_logic/docker-compose.yml | 4 ++-- graphql/e2e/directives/docker-compose.yml | 4 ++-- graphql/e2e/multi_tenancy/docker-compose.yml | 8 ++++---- graphql/e2e/normal/docker-compose.yml | 4 ++-- graphql/e2e/schema/docker-compose.yml | 8 ++++---- graphql/e2e/subscription/docker-compose.yml | 8 ++++---- .../custom_bench/profiling/docker-compose.yml | 4 ++-- ocagent/docker-compose.yml | 4 ++-- systest/1million/alpha.yml | 2 +- systest/21million/bulk/alpha.yml | 2 +- systest/bulk_live/bulk/alpha.yml | 2 +- systest/bulk_live/bulk/alpha_acl.yml | 2 +- systest/ldbc/alpha.yml | 2 +- testutil/testaudit/docker-compose.yml | 4 ++-- tlstest/acl/docker-compose.yml | 4 ++-- tlstest/certrequest/docker-compose.yml | 4 ++-- .../certrequireandverify/docker-compose.yml | 4 ++-- tlstest/certverifyifgiven/docker-compose.yml | 4 ++-- .../mtls_internal/ha_6_node/docker-compose.yml | 12 ++++++------ .../multi_group/docker-compose.yml | 8 ++++---- .../single_node/docker-compose.yml | 4 ++-- .../all_routes_tls/docker-compose.yml | 4 ++-- tlstest/zero_https/no_tls/docker-compose.yml | 4 ++-- worker/docker-compose.yml | 18 +++++++++--------- 30 files changed, 78 insertions(+), 78 deletions(-) diff --git a/dgraph/cmd/alpha/mutations_mode/docker-compose.yml b/dgraph/cmd/alpha/mutations_mode/docker-compose.yml index 442a065d540..7f420eb2e40 100644 --- a/dgraph/cmd/alpha/mutations_mode/docker-compose.yml +++ b/dgraph/cmd/alpha/mutations_mode/docker-compose.yml @@ -13,7 +13,7 @@ services: - "9080" volumes: - type: bind - source: $GOPATH/bin + source: ${LINUX_GOBIN:-$GOPATH/bin} target: /gobin read_only: true command: @@ -30,7 +30,7 @@ services: - "9080" volumes: - type: bind - source: $GOPATH/bin + source: ${LINUX_GOBIN:-$GOPATH/bin} target: /gobin read_only: true command: @@ -47,7 +47,7 @@ services: - "9080" volumes: - type: bind - source: $GOPATH/bin + source: ${LINUX_GOBIN:-$GOPATH/bin} target: /gobin read_only: true command: @@ -64,7 +64,7 @@ services: - "6080" volumes: - type: bind - source: $GOPATH/bin + source: ${LINUX_GOBIN:-$GOPATH/bin} target: /gobin read_only: true command: @@ -82,7 +82,7 @@ services: - "6080" volumes: - type: bind - source: $GOPATH/bin + source: ${LINUX_GOBIN:-$GOPATH/bin} target: /gobin read_only: true command: @@ -100,7 +100,7 @@ services: - "6080" volumes: - type: bind - source: $GOPATH/bin + source: ${LINUX_GOBIN:-$GOPATH/bin} target: /gobin read_only: true command: diff --git a/graphql/e2e/admin_auth/poorman_auth/docker-compose.yml b/graphql/e2e/admin_auth/poorman_auth/docker-compose.yml index b38e6054bec..de069b2d946 100644 --- a/graphql/e2e/admin_auth/poorman_auth/docker-compose.yml +++ b/graphql/e2e/admin_auth/poorman_auth/docker-compose.yml @@ -11,7 +11,7 @@ services: service: zero1 volumes: - type: bind - source: $GOPATH/bin + source: ${LINUX_GOBIN:-$GOPATH/bin} target: /gobin read_only: true command: @@ -23,7 +23,7 @@ services: working_dir: /data/alpha1 volumes: - type: bind - source: $GOPATH/bin + source: ${LINUX_GOBIN:-$GOPATH/bin} target: /gobin read_only: true ports: diff --git a/graphql/e2e/admin_auth/poorman_auth_with_acl/docker-compose.yml b/graphql/e2e/admin_auth/poorman_auth_with_acl/docker-compose.yml index b12604e4383..e609ffe15a2 100644 --- a/graphql/e2e/admin_auth/poorman_auth_with_acl/docker-compose.yml +++ b/graphql/e2e/admin_auth/poorman_auth_with_acl/docker-compose.yml @@ -11,7 +11,7 @@ services: service: zero1 volumes: - type: bind - source: $GOPATH/bin + source: ${LINUX_GOBIN:-$GOPATH/bin} target: /gobin read_only: true command: @@ -23,7 +23,7 @@ services: working_dir: /data/alpha1 volumes: - type: bind - source: $GOPATH/bin + source: ${LINUX_GOBIN:-$GOPATH/bin} target: /gobin read_only: true - type: bind diff --git a/graphql/e2e/auth/debug_off/docker-compose.yml b/graphql/e2e/auth/debug_off/docker-compose.yml index ec5d1007e42..240ecc77633 100644 --- a/graphql/e2e/auth/debug_off/docker-compose.yml +++ b/graphql/e2e/auth/debug_off/docker-compose.yml @@ -11,7 +11,7 @@ services: service: zero1 volumes: - type: bind - source: $GOPATH/bin + source: ${LINUX_GOBIN:-$GOPATH/bin} target: /gobin read_only: true command: @@ -23,7 +23,7 @@ services: working_dir: /data/alpha1 volumes: - type: bind - source: $GOPATH/bin + source: ${LINUX_GOBIN:-$GOPATH/bin} target: /gobin read_only: true ports: diff --git a/graphql/e2e/auth/docker-compose.yml b/graphql/e2e/auth/docker-compose.yml index 805523d7a69..fc5bc5632a5 100644 --- a/graphql/e2e/auth/docker-compose.yml +++ b/graphql/e2e/auth/docker-compose.yml @@ -11,7 +11,7 @@ services: service: zero1 volumes: - type: bind - source: $GOPATH/bin + source: ${LINUX_GOBIN:-$GOPATH/bin} target: /gobin read_only: true command: @@ -23,7 +23,7 @@ services: working_dir: /data/alpha1 volumes: - type: bind - source: $GOPATH/bin + source: ${LINUX_GOBIN:-$GOPATH/bin} target: /gobin read_only: true ports: diff --git a/graphql/e2e/auth_closed_by_default/docker-compose.yml b/graphql/e2e/auth_closed_by_default/docker-compose.yml index 805523d7a69..fc5bc5632a5 100644 --- a/graphql/e2e/auth_closed_by_default/docker-compose.yml +++ b/graphql/e2e/auth_closed_by_default/docker-compose.yml @@ -11,7 +11,7 @@ services: service: zero1 volumes: - type: bind - source: $GOPATH/bin + source: ${LINUX_GOBIN:-$GOPATH/bin} target: /gobin read_only: true command: @@ -23,7 +23,7 @@ services: working_dir: /data/alpha1 volumes: - type: bind - source: $GOPATH/bin + source: ${LINUX_GOBIN:-$GOPATH/bin} target: /gobin read_only: true ports: diff --git a/graphql/e2e/custom_logic/docker-compose.yml b/graphql/e2e/custom_logic/docker-compose.yml index 8ed8f0859bf..3dbd0994ff3 100644 --- a/graphql/e2e/custom_logic/docker-compose.yml +++ b/graphql/e2e/custom_logic/docker-compose.yml @@ -12,7 +12,7 @@ services: - 9080 volumes: - type: bind - source: $GOPATH/bin + source: ${LINUX_GOBIN:-$GOPATH/bin} target: /gobin read_only: true command: @@ -28,7 +28,7 @@ services: - 6080 volumes: - type: bind - source: $GOPATH/bin + source: ${LINUX_GOBIN:-$GOPATH/bin} target: /gobin read_only: true command: diff --git a/graphql/e2e/directives/docker-compose.yml b/graphql/e2e/directives/docker-compose.yml index a68793034d9..fb1ba6a92b9 100644 --- a/graphql/e2e/directives/docker-compose.yml +++ b/graphql/e2e/directives/docker-compose.yml @@ -11,7 +11,7 @@ services: service: zero1 volumes: - type: bind - source: $GOPATH/bin + source: ${LINUX_GOBIN:-$GOPATH/bin} target: /gobin read_only: true command: @@ -23,7 +23,7 @@ services: working_dir: /data/alpha1 volumes: - type: bind - source: $GOPATH/bin + source: ${LINUX_GOBIN:-$GOPATH/bin} target: /gobin read_only: true ports: diff --git a/graphql/e2e/multi_tenancy/docker-compose.yml b/graphql/e2e/multi_tenancy/docker-compose.yml index 9caa50aff87..662baf1ca2e 100644 --- a/graphql/e2e/multi_tenancy/docker-compose.yml +++ b/graphql/e2e/multi_tenancy/docker-compose.yml @@ -12,7 +12,7 @@ services: - 9080 volumes: - type: bind - source: $GOPATH/bin + source: ${LINUX_GOBIN:-$GOPATH/bin} target: /gobin read_only: true - type: bind @@ -35,7 +35,7 @@ services: - 9080 volumes: - type: bind - source: $GOPATH/bin + source: ${LINUX_GOBIN:-$GOPATH/bin} target: /gobin read_only: true - type: bind @@ -58,7 +58,7 @@ services: - 9080 volumes: - type: bind - source: $GOPATH/bin + source: ${LINUX_GOBIN:-$GOPATH/bin} target: /gobin read_only: true - type: bind @@ -79,7 +79,7 @@ services: - 6080 volumes: - type: bind - source: $GOPATH/bin + source: ${LINUX_GOBIN:-$GOPATH/bin} target: /gobin read_only: true command: diff --git a/graphql/e2e/normal/docker-compose.yml b/graphql/e2e/normal/docker-compose.yml index a68793034d9..fb1ba6a92b9 100644 --- a/graphql/e2e/normal/docker-compose.yml +++ b/graphql/e2e/normal/docker-compose.yml @@ -11,7 +11,7 @@ services: service: zero1 volumes: - type: bind - source: $GOPATH/bin + source: ${LINUX_GOBIN:-$GOPATH/bin} target: /gobin read_only: true command: @@ -23,7 +23,7 @@ services: working_dir: /data/alpha1 volumes: - type: bind - source: $GOPATH/bin + source: ${LINUX_GOBIN:-$GOPATH/bin} target: /gobin read_only: true ports: diff --git a/graphql/e2e/schema/docker-compose.yml b/graphql/e2e/schema/docker-compose.yml index 669d63c18a4..92224334e1b 100644 --- a/graphql/e2e/schema/docker-compose.yml +++ b/graphql/e2e/schema/docker-compose.yml @@ -16,7 +16,7 @@ services: - 9080 volumes: - type: bind - source: $GOPATH/bin + source: ${LINUX_GOBIN:-$GOPATH/bin} target: /gobin read_only: true command: @@ -38,7 +38,7 @@ services: - 9080 volumes: - type: bind - source: $GOPATH/bin + source: ${LINUX_GOBIN:-$GOPATH/bin} target: /gobin read_only: true command: @@ -60,7 +60,7 @@ services: - 9080 volumes: - type: bind - source: $GOPATH/bin + source: ${LINUX_GOBIN:-$GOPATH/bin} target: /gobin read_only: true command: @@ -76,7 +76,7 @@ services: - 6080 volumes: - type: bind - source: $GOPATH/bin + source: ${LINUX_GOBIN:-$GOPATH/bin} target: /gobin read_only: true command: diff --git a/graphql/e2e/subscription/docker-compose.yml b/graphql/e2e/subscription/docker-compose.yml index 06804881f8f..fb732fb5246 100644 --- a/graphql/e2e/subscription/docker-compose.yml +++ b/graphql/e2e/subscription/docker-compose.yml @@ -12,7 +12,7 @@ services: - 9080 volumes: - type: bind - source: $GOPATH/bin + source: ${LINUX_GOBIN:-$GOPATH/bin} target: /gobin read_only: true command: @@ -30,7 +30,7 @@ services: - 9080 volumes: - type: bind - source: $GOPATH/bin + source: ${LINUX_GOBIN:-$GOPATH/bin} target: /gobin read_only: true command: @@ -48,7 +48,7 @@ services: - 9080 volumes: - type: bind - source: $GOPATH/bin + source: ${LINUX_GOBIN:-$GOPATH/bin} target: /gobin read_only: true command: @@ -64,7 +64,7 @@ services: - 6080 volumes: - type: bind - source: $GOPATH/bin + source: ${LINUX_GOBIN:-$GOPATH/bin} target: /gobin read_only: true command: diff --git a/graphql/testdata/custom_bench/profiling/docker-compose.yml b/graphql/testdata/custom_bench/profiling/docker-compose.yml index 870332f5d7a..360ad14634a 100644 --- a/graphql/testdata/custom_bench/profiling/docker-compose.yml +++ b/graphql/testdata/custom_bench/profiling/docker-compose.yml @@ -17,7 +17,7 @@ services: - 9180:9180 volumes: - type: bind - source: $GOPATH/bin + source: ${LINUX_GOBIN:-$GOPATH/bin} target: /gobin read_only: true - type: bind @@ -42,7 +42,7 @@ services: - 6180:6180 volumes: - type: bind - source: $GOPATH/bin + source: ${LINUX_GOBIN:-$GOPATH/bin} target: /gobin read_only: true command: diff --git a/ocagent/docker-compose.yml b/ocagent/docker-compose.yml index b656b351b00..7d8a797a03b 100644 --- a/ocagent/docker-compose.yml +++ b/ocagent/docker-compose.yml @@ -11,7 +11,7 @@ services: - 9180:9180 volumes: - type: bind - source: $GOPATH/bin + source: ${LINUX_GOBIN:-$GOPATH/bin} target: /gobin read_only: true command: @@ -28,7 +28,7 @@ services: - 6180:6180 volumes: - type: bind - source: $GOPATH/bin + source: ${LINUX_GOBIN:-$GOPATH/bin} target: /gobin read_only: true command: diff --git a/systest/1million/alpha.yml b/systest/1million/alpha.yml index a146ca4c16f..7060f292df3 100644 --- a/systest/1million/alpha.yml +++ b/systest/1million/alpha.yml @@ -10,7 +10,7 @@ services: - "9080" volumes: - type: bind - source: $GOPATH/bin + source: ${LINUX_GOBIN:-$GOPATH/bin} target: /gobin read_only: true - type: bind diff --git a/systest/21million/bulk/alpha.yml b/systest/21million/bulk/alpha.yml index a146ca4c16f..7060f292df3 100644 --- a/systest/21million/bulk/alpha.yml +++ b/systest/21million/bulk/alpha.yml @@ -10,7 +10,7 @@ services: - "9080" volumes: - type: bind - source: $GOPATH/bin + source: ${LINUX_GOBIN:-$GOPATH/bin} target: /gobin read_only: true - type: bind diff --git a/systest/bulk_live/bulk/alpha.yml b/systest/bulk_live/bulk/alpha.yml index d6da171a02a..1ddc585e171 100644 --- a/systest/bulk_live/bulk/alpha.yml +++ b/systest/bulk_live/bulk/alpha.yml @@ -10,7 +10,7 @@ services: - "9080" volumes: - type: bind - source: $GOPATH/bin + source: ${LINUX_GOBIN:-$GOPATH/bin} target: /gobin read_only: true - type: bind diff --git a/systest/bulk_live/bulk/alpha_acl.yml b/systest/bulk_live/bulk/alpha_acl.yml index 59c7bbc0e4c..72ff22c80f9 100644 --- a/systest/bulk_live/bulk/alpha_acl.yml +++ b/systest/bulk_live/bulk/alpha_acl.yml @@ -10,7 +10,7 @@ services: - "9080" volumes: - type: bind - source: $GOPATH/bin + source: ${LINUX_GOBIN:-$GOPATH/bin} target: /gobin read_only: true - type: bind diff --git a/systest/ldbc/alpha.yml b/systest/ldbc/alpha.yml index 537b26760be..12951fac215 100644 --- a/systest/ldbc/alpha.yml +++ b/systest/ldbc/alpha.yml @@ -10,7 +10,7 @@ services: - "9080" volumes: - type: bind - source: $GOPATH/bin + source: ${LINUX_GOBIN:-$GOPATH/bin} target: /gobin read_only: true - type: bind diff --git a/testutil/testaudit/docker-compose.yml b/testutil/testaudit/docker-compose.yml index 9d0cca1cb9b..d063d81672c 100644 --- a/testutil/testaudit/docker-compose.yml +++ b/testutil/testaudit/docker-compose.yml @@ -8,7 +8,7 @@ services: - "9080" volumes: - type: bind - source: $GOPATH/bin + source: ${LINUX_GOBIN:-$GOPATH/bin} target: /gobin read_only: true - type: bind @@ -32,7 +32,7 @@ services: - "6080" volumes: - type: bind - source: $GOPATH/bin + source: ${LINUX_GOBIN:-$GOPATH/bin} target: /gobin read_only: true - type: bind diff --git a/tlstest/acl/docker-compose.yml b/tlstest/acl/docker-compose.yml index 19dc4ae8ac1..75cf9912415 100644 --- a/tlstest/acl/docker-compose.yml +++ b/tlstest/acl/docker-compose.yml @@ -10,7 +10,7 @@ services: - 9080 volumes: - type: bind - source: $GOPATH/bin + source: ${LINUX_GOBIN:-$GOPATH/bin} target: /gobin read_only: true - type: bind @@ -38,7 +38,7 @@ services: - 6080 volumes: - type: bind - source: $GOPATH/bin + source: ${LINUX_GOBIN:-$GOPATH/bin} target: /gobin read_only: true - type: bind diff --git a/tlstest/certrequest/docker-compose.yml b/tlstest/certrequest/docker-compose.yml index 8d45656e13b..f4fdd3bfc55 100644 --- a/tlstest/certrequest/docker-compose.yml +++ b/tlstest/certrequest/docker-compose.yml @@ -12,7 +12,7 @@ services: - "9080" volumes: - type: bind - source: $GOPATH/bin + source: ${LINUX_GOBIN:-$GOPATH/bin} target: /gobin read_only: true - type: bind @@ -33,7 +33,7 @@ services: - "6080" volumes: - type: bind - source: $GOPATH/bin + source: ${LINUX_GOBIN:-$GOPATH/bin} target: /gobin read_only: true command: diff --git a/tlstest/certrequireandverify/docker-compose.yml b/tlstest/certrequireandverify/docker-compose.yml index 34e07c41550..848f274644c 100644 --- a/tlstest/certrequireandverify/docker-compose.yml +++ b/tlstest/certrequireandverify/docker-compose.yml @@ -12,7 +12,7 @@ services: - "9080" volumes: - type: bind - source: $GOPATH/bin + source: ${LINUX_GOBIN:-$GOPATH/bin} target: /gobin read_only: true - type: bind @@ -34,7 +34,7 @@ services: - "6080" volumes: - type: bind - source: $GOPATH/bin + source: ${LINUX_GOBIN:-$GOPATH/bin} target: /gobin read_only: true command: diff --git a/tlstest/certverifyifgiven/docker-compose.yml b/tlstest/certverifyifgiven/docker-compose.yml index 3ecd29769ac..6c73fa17e0b 100644 --- a/tlstest/certverifyifgiven/docker-compose.yml +++ b/tlstest/certverifyifgiven/docker-compose.yml @@ -12,7 +12,7 @@ services: - "9080" volumes: - type: bind - source: $GOPATH/bin + source: ${LINUX_GOBIN:-$GOPATH/bin} target: /gobin read_only: true - type: bind @@ -34,7 +34,7 @@ services: - "6080" volumes: - type: bind - source: $GOPATH/bin + source: ${LINUX_GOBIN:-$GOPATH/bin} target: /gobin read_only: true command: diff --git a/tlstest/mtls_internal/ha_6_node/docker-compose.yml b/tlstest/mtls_internal/ha_6_node/docker-compose.yml index c9519ba4f8e..a892369930f 100644 --- a/tlstest/mtls_internal/ha_6_node/docker-compose.yml +++ b/tlstest/mtls_internal/ha_6_node/docker-compose.yml @@ -10,7 +10,7 @@ services: - 9080 volumes: - type: bind - source: $GOPATH/bin + source: ${LINUX_GOBIN:-$GOPATH/bin} target: /gobin read_only: true - type: bind @@ -32,7 +32,7 @@ services: - 9080 volumes: - type: bind - source: $GOPATH/bin + source: ${LINUX_GOBIN:-$GOPATH/bin} target: /gobin read_only: true - type: bind @@ -54,7 +54,7 @@ services: - 9080 volumes: - type: bind - source: $GOPATH/bin + source: ${LINUX_GOBIN:-$GOPATH/bin} target: /gobin read_only: true - type: bind @@ -76,7 +76,7 @@ services: - 6080 volumes: - type: bind - source: $GOPATH/bin + source: ${LINUX_GOBIN:-$GOPATH/bin} target: /gobin read_only: true - type: bind @@ -98,7 +98,7 @@ services: - 6080 volumes: - type: bind - source: $GOPATH/bin + source: ${LINUX_GOBIN:-$GOPATH/bin} target: /gobin read_only: true - type: bind @@ -121,7 +121,7 @@ services: - 6080 volumes: - type: bind - source: $GOPATH/bin + source: ${LINUX_GOBIN:-$GOPATH/bin} target: /gobin read_only: true - type: bind diff --git a/tlstest/mtls_internal/multi_group/docker-compose.yml b/tlstest/mtls_internal/multi_group/docker-compose.yml index 31ce5071f11..54bc2d133bb 100644 --- a/tlstest/mtls_internal/multi_group/docker-compose.yml +++ b/tlstest/mtls_internal/multi_group/docker-compose.yml @@ -10,7 +10,7 @@ services: - 9080 volumes: - type: bind - source: $GOPATH/bin + source: ${LINUX_GOBIN:-$GOPATH/bin} target: /gobin read_only: true - type: bind @@ -32,7 +32,7 @@ services: - 9080 volumes: - type: bind - source: $GOPATH/bin + source: ${LINUX_GOBIN:-$GOPATH/bin} target: /gobin read_only: true - type: bind @@ -54,7 +54,7 @@ services: - 9080 volumes: - type: bind - source: $GOPATH/bin + source: ${LINUX_GOBIN:-$GOPATH/bin} target: /gobin read_only: true - type: bind @@ -76,7 +76,7 @@ services: - 6080 volumes: - type: bind - source: $GOPATH/bin + source: ${LINUX_GOBIN:-$GOPATH/bin} target: /gobin read_only: true - type: bind diff --git a/tlstest/mtls_internal/single_node/docker-compose.yml b/tlstest/mtls_internal/single_node/docker-compose.yml index 8943f424326..fd02250e09f 100644 --- a/tlstest/mtls_internal/single_node/docker-compose.yml +++ b/tlstest/mtls_internal/single_node/docker-compose.yml @@ -10,7 +10,7 @@ services: - 9080 volumes: - type: bind - source: $GOPATH/bin + source: ${LINUX_GOBIN:-$GOPATH/bin} target: /gobin read_only: true - type: bind @@ -32,7 +32,7 @@ services: - 6080 volumes: - type: bind - source: $GOPATH/bin + source: ${LINUX_GOBIN:-$GOPATH/bin} target: /gobin read_only: true - type: bind diff --git a/tlstest/zero_https/all_routes_tls/docker-compose.yml b/tlstest/zero_https/all_routes_tls/docker-compose.yml index 61a35b59541..6070b92e77c 100644 --- a/tlstest/zero_https/all_routes_tls/docker-compose.yml +++ b/tlstest/zero_https/all_routes_tls/docker-compose.yml @@ -12,7 +12,7 @@ services: - "9080" volumes: - type: bind - source: $GOPATH/bin + source: ${LINUX_GOBIN:-$GOPATH/bin} target: /gobin read_only: true command: @@ -28,7 +28,7 @@ services: - "6080" volumes: - type: bind - source: $GOPATH/bin + source: ${LINUX_GOBIN:-$GOPATH/bin} target: /gobin read_only: true - type: bind diff --git a/tlstest/zero_https/no_tls/docker-compose.yml b/tlstest/zero_https/no_tls/docker-compose.yml index 3f65bb791a9..ebfd7765e3c 100644 --- a/tlstest/zero_https/no_tls/docker-compose.yml +++ b/tlstest/zero_https/no_tls/docker-compose.yml @@ -12,7 +12,7 @@ services: - "9080" volumes: - type: bind - source: $GOPATH/bin + source: ${LINUX_GOBIN:-$GOPATH/bin} target: /gobin read_only: true command: @@ -28,7 +28,7 @@ services: - "6080" volumes: - type: bind - source: $GOPATH/bin + source: ${LINUX_GOBIN:-$GOPATH/bin} target: /gobin read_only: true command: diff --git a/worker/docker-compose.yml b/worker/docker-compose.yml index ef4fe6587c3..6608011417d 100644 --- a/worker/docker-compose.yml +++ b/worker/docker-compose.yml @@ -12,7 +12,7 @@ services: - "9080" volumes: - type: bind - source: $GOPATH/bin + source: ${LINUX_GOBIN:-$GOPATH/bin} target: /gobin read_only: true command: @@ -29,7 +29,7 @@ services: - "9080" volumes: - type: bind - source: $GOPATH/bin + source: ${LINUX_GOBIN:-$GOPATH/bin} target: /gobin read_only: true command: @@ -46,7 +46,7 @@ services: - "9080" volumes: - type: bind - source: $GOPATH/bin + source: ${LINUX_GOBIN:-$GOPATH/bin} target: /gobin read_only: true command: @@ -63,7 +63,7 @@ services: - "9080" volumes: - type: bind - source: $GOPATH/bin + source: ${LINUX_GOBIN:-$GOPATH/bin} target: /gobin read_only: true command: @@ -80,7 +80,7 @@ services: - "9080" volumes: - type: bind - source: $GOPATH/bin + source: ${LINUX_GOBIN:-$GOPATH/bin} target: /gobin read_only: true command: @@ -97,7 +97,7 @@ services: - "9080" volumes: - type: bind - source: $GOPATH/bin + source: ${LINUX_GOBIN:-$GOPATH/bin} target: /gobin read_only: true command: @@ -125,7 +125,7 @@ services: - "6080" volumes: - type: bind - source: $GOPATH/bin + source: ${LINUX_GOBIN:-$GOPATH/bin} target: /gobin read_only: true command: @@ -144,7 +144,7 @@ services: - "6080" volumes: - type: bind - source: $GOPATH/bin + source: ${LINUX_GOBIN:-$GOPATH/bin} target: /gobin read_only: true command: @@ -163,7 +163,7 @@ services: - "6080" volumes: - type: bind - source: $GOPATH/bin + source: ${LINUX_GOBIN:-$GOPATH/bin} target: /gobin read_only: true command: From 1679571f656403823c8da208593cbb3619203fef Mon Sep 17 00:00:00 2001 From: Michael Welles Date: Thu, 19 Feb 2026 18:46:41 -0500 Subject: [PATCH 04/18] feat(test): add --timeout flag to t/ runner and make test 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. --- CONTRIBUTING.md | 1 + Makefile | 4 +++- TESTING.md | 20 +++++++++++--------- t/t.go | 15 +++++++++++---- 4 files changed, 26 insertions(+), 14 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 70da1eab9d7..75ccb8556b9 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -154,6 +154,7 @@ make test-upgrade # Upgrade tests # Use variables for more control make test TAGS=integration2 PKG=systest/vector +make test TIMEOUT=90m # Override per-package timeout (default: 30m) ``` Run `make help` to see all available targets and variables. diff --git a/Makefile b/Makefile index 196f2c07426..e4f6cdd3207 100644 --- a/Makefile +++ b/Makefile @@ -98,7 +98,7 @@ else 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)\")" + $(MAKE) -C t test args="--suite=$(or $(SUITE),all) $(if $(PKG),--pkg=\"$(PKG)\") $(if $(TEST),--test=\"$(TEST)\") $(if $(TIMEOUT),--timeout=$(TIMEOUT))" endif .PHONY: test-all @@ -205,6 +205,7 @@ help: ## Show available targets and variables @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)" + @echo " TIMEOUT Per-package test timeout (e.g., make test TIMEOUT=60m). Default: 30m" @echo " FUZZ Enable fuzz testing (e.g., make test FUZZ=1)" @echo " FUZZTIME Fuzz duration per package (e.g., make test FUZZ=1 FUZZTIME=60s)" @echo "" @@ -223,4 +224,5 @@ help: ## Show available targets and variables @echo " make test TAGS=upgrade PKG=acl TEST=TestACL # specific upgrade test" @echo " make test FUZZ=1 PKG=dql FUZZTIME=30s # fuzz dql package for 30s" @echo " make test SUITE=systest PKG=systest/backup/filesystem # systest for backup pkg" + @echo " make test TIMEOUT=90m # all suites with 90m timeout" @echo " make test-benchmark PKG=posting # benchmark posting package" diff --git a/TESTING.md b/TESTING.md index 2651341d05e..63e1e8d91c4 100644 --- a/TESTING.md +++ b/TESTING.md @@ -335,6 +335,7 @@ For more control, pass variables to `make test`: | `TAGS` | Go build tags - bypasses t/ runner | `make test TAGS=integration2` | | `PKG` | Limit to specific package | `make test PKG=systest/export` | | `TEST` | Run specific test function | `make test TEST=TestGQLSchema` | +| `TIMEOUT` | Per-package test timeout | `make test TIMEOUT=90m` | | `FUZZ` | Enable fuzz testing | `make test FUZZ=1` | | `FUZZTIME` | Fuzz duration per package | `make test FUZZ=1 FUZZTIME=60s` | @@ -578,15 +579,16 @@ cd t && go build . ### Key Flags -| Flag | Description | -| ------------- | ------------------------------------------------------------------ | -| `--suite=X` | Select test suite(s): all, ldbc, load, unit, systest, vector, core | -| `--pkg=X` | Run specific package | -| `--test=X` | Run specific test function | -| `-j=N` | Concurrency (default: 1) | -| `--keep` | Keep cluster running after tests | -| `-r` | Remove all test containers | -| `--skip-slow` | Skip slow packages | +| Flag | Description | +| --------------- | ------------------------------------------------------------------ | +| `--suite=X` | Select test suite(s): all, ldbc, load, unit, systest, vector, core | +| `--pkg=X` | Run specific package | +| `--test=X` | Run specific test function | +| `--timeout=X` | Per-package timeout (e.g. 60m, 2h). Default: 30m (180m with --race)| +| `-j=N` | Concurrency (default: 1) | +| `--keep` | Keep cluster running after tests | +| `-r` | Remove all test containers | +| `--skip-slow` | Skip slow packages | --- diff --git a/t/t.go b/t/t.go index 7b3c553a84f..79bdb2fd72b 100644 --- a/t/t.go +++ b/t/t.go @@ -92,7 +92,9 @@ var ( tmp = pflag.String("tmp", "", "Temporary directory used to download data.") downloadResources = pflag.BoolP("download", "d", true, "Flag to specify whether to download resources or not") - race = pflag.Bool("race", false, "Set true to build with race") + race = pflag.Bool("race", false, "Set true to build with race") + testTimeout = pflag.String("timeout", "", + "Timeout for each test package (e.g. 60m, 2h). Defaults to 30m (180m with --race).") skip = pflag.String("skip", "", "comma separated list of packages that needs to be skipped. "+ "Package Check uses string.Contains(). Please check the flag carefully") @@ -423,12 +425,17 @@ func sanitizeFilename(pkg string) string { func runTestsFor(ctx context.Context, pkg, prefix string, xmlFile string) error { args := []string{"gotestsum", "--junitfile", xmlFile, "--format", "standard-verbose", "--max-fails", "1", "--", "-v", "-failfast", "-tags=integration"} - if *race { + switch { + case *testTimeout != "": + args = append(args, "-timeout", *testTimeout) + case *race: args = append(args, "-timeout", "180m") + default: + args = append(args, "-timeout", "30m") + } + if *race { // Todo: There are few race errors in tests itself. Enable this once that is fixed. // args = append(args, "-race") - } else { - args = append(args, "-timeout", "30m") } if *count > 0 { From 75293c0cfa3f34e5dbba0891fba909c477415755 Mon Sep 17 00:00:00 2001 From: Michael Welles Date: Fri, 20 Feb 2026 14:00:40 -0500 Subject: [PATCH 05/18] fix(test): resolve staticcheck SA9003 and prettier formatting Remove empty if-branch flagged by staticcheck SA9003 in t/t.go and fix markdown table alignment in TESTING.md for prettier compliance. --- TESTING.md | 20 ++++++++++---------- t/t.go | 31 +++++++++++++++++++------------ 2 files changed, 29 insertions(+), 22 deletions(-) diff --git a/TESTING.md b/TESTING.md index 63e1e8d91c4..1c930479fc6 100644 --- a/TESTING.md +++ b/TESTING.md @@ -579,16 +579,16 @@ cd t && go build . ### Key Flags -| Flag | Description | -| --------------- | ------------------------------------------------------------------ | -| `--suite=X` | Select test suite(s): all, ldbc, load, unit, systest, vector, core | -| `--pkg=X` | Run specific package | -| `--test=X` | Run specific test function | -| `--timeout=X` | Per-package timeout (e.g. 60m, 2h). Default: 30m (180m with --race)| -| `-j=N` | Concurrency (default: 1) | -| `--keep` | Keep cluster running after tests | -| `-r` | Remove all test containers | -| `--skip-slow` | Skip slow packages | +| Flag | Description | +| ------------- | ------------------------------------------------------------------- | +| `--suite=X` | Select test suite(s): all, ldbc, load, unit, systest, vector, core | +| `--pkg=X` | Run specific package | +| `--test=X` | Run specific test function | +| `--timeout=X` | Per-package timeout (e.g. 60m, 2h). Default: 30m (180m with --race) | +| `-j=N` | Concurrency (default: 1) | +| `--keep` | Keep cluster running after tests | +| `-r` | Remove all test containers | +| `--skip-slow` | Skip slow packages | --- diff --git a/t/t.go b/t/t.go index 79bdb2fd72b..37ff7fe1795 100644 --- a/t/t.go +++ b/t/t.go @@ -433,10 +433,7 @@ func runTestsFor(ctx context.Context, pkg, prefix string, xmlFile string) error default: args = append(args, "-timeout", "30m") } - if *race { - // Todo: There are few race errors in tests itself. Enable this once that is fixed. - // args = append(args, "-race") - } + // Todo: There are few race errors in tests itself. Enable -race once that is fixed. if *count > 0 { args = append(args, "-count="+strconv.Itoa(*count)) @@ -458,7 +455,11 @@ func runTestsFor(ctx context.Context, pkg, prefix string, xmlFile string) error if err != nil { return fmt.Errorf("while getting absolute path of tmp directory: %v Error: %v", *tmp, err) } - cmd.Env = append(cmd.Env, "TEST_DATA_DIRECTORY="+abs) + dataDir := abs + if strings.Contains(pkg, "/ldbc") { + dataDir = filepath.Join(abs, "ldbc") + } + cmd.Env = append(cmd.Env, "TEST_DATA_DIRECTORY="+dataDir) // Use failureCatcher. cmd.Stdout = oc @@ -1036,7 +1037,7 @@ func downloadDataFiles() { } } -func downloadLDBCFiles() { +func downloadLDBCFiles(dir string) { if !*downloadResources { fmt.Print("Skipping downloading of resources\n") return @@ -1054,12 +1055,12 @@ func downloadLDBCFiles() { defer wg.Done() start := time.Now() cmd := exec.Command("wget", "-O", fname, link) - cmd.Dir = *tmp + cmd.Dir = dir if out, err := cmd.CombinedOutput(); err != nil { fmt.Printf("Error %v\n", err) panic(fmt.Sprintf("error downloading a file: %s", string(out))) } - fmt.Printf("Downloaded %s to %s in %s \n", fname, *tmp, time.Since(start)) + fmt.Printf("Downloaded %s to %s in %s \n", fname, dir, time.Since(start)) }(fname, link, &wg) } wg.Wait() @@ -1197,8 +1198,11 @@ func run() error { closer := z.NewCloser(N) testCh := make(chan task) errCh := make(chan error, 1000) + var runWg sync.WaitGroup for range N { + runWg.Add(1) go func() { + defer runWg.Done() if err := runTests(testCh, closer); err != nil { errCh <- err closer.Signal() @@ -1227,9 +1231,6 @@ func run() error { go func() { defer close(testCh) valid := getPackages() - // in "all" mode we can download both data files and - // ldbc files into the same directory, no duplicated - // filenames between the two needsData := testSuiteContainsAny("load", "ldbc", "all") if needsData && *tmp == "" { *tmp = filepath.Join(os.TempDir(), "dgraph-test-data") @@ -1239,7 +1240,12 @@ func run() error { downloadDataFiles() } if testSuiteContainsAny("ldbc", "all") { - downloadLDBCFiles() + // LDBC files go into a subdirectory because the LDBC test bulk-loads + // the entire directory (-f ). Mixing load data (1million, 21million) + // with LDBC data causes schema mismatches. + ldbcDir := filepath.Join(*tmp, "ldbc") + x.Check(os.MkdirAll(ldbcDir, 0755)) + downloadLDBCFiles(ldbcDir) } for i, task := range valid { select { @@ -1252,6 +1258,7 @@ func run() error { }() closer.Wait() + runWg.Wait() // Ensure wrapper goroutines finish sending to errCh before closing it. close(errCh) for err := range errCh { if err != nil { From 445393979f40e47ad33fcd0a83af9f2ab75ace70 Mon Sep 17 00:00:00 2001 From: Michael Welles Date: Mon, 23 Feb 2026 14:59:02 -0500 Subject: [PATCH 06/18] feat(test): change default make test to unit,systest,core + integration2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- AGENTS.md | 16 ++++++++++++++++ CONTRIBUTING.md | 6 +++++- Makefile | 44 ++++++++++++++++++++++++++++++++++++-------- TESTING.md | 16 +++++++++++----- 4 files changed, 68 insertions(+), 14 deletions(-) create mode 100644 AGENTS.md diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 00000000000..9dae56cc42a --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,16 @@ +# Repository Guidelines + +## Project Structure & Module Organization +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/`. + +## Build, Test, and Development Commands +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. + +## Coding Style & Naming Conventions +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. + +## Testing Guidelines +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. + +## Commit & Pull Request Guidelines +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. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 75ccb8556b9..192d6e5097f 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -144,9 +144,12 @@ directory, providing control and flexibility beyond the standard Go testing fram The simplest way to run tests is via Make: ```bash -# Run all tests +# Run default tests (~30 min): unit, systest, core suites + integration2 make test +# Run every test in the repo +make test-everything + # Run specific test types make test-unit # Unit tests only (no Docker) make test-integration2 # Integration2 tests via dgraphtest @@ -154,6 +157,7 @@ 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) ``` diff --git a/Makefile b/Makefile index e4f6cdd3207..890612f4fd7 100644 --- a/Makefile +++ b/Makefile @@ -79,7 +79,7 @@ dgraph-installed: fi .PHONY: test -test: dgraph-installed local-image ## Run tests (see 'make help' for options) +test: dgraph-installed local-image ## Run tests (default: unit,systest,core + integration2) ifdef TAGS @echo "Running tests with tags: $(TAGS)" go test -v --tags="$(TAGS)" \ @@ -97,54 +97,82 @@ 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 suites: unit, systest, core" + $(MAKE) -C t test args="--suite=unit,systest,core $(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') +.PHONY: test-suites +test-suites: ## All test suites via t/ runner (i.e. 'make test SUITE=all') + $(if $(filter command line,$(origin SUITE)),$(error SUITE= cannot be passed to test-suites; use 'make test SUITE=...' instead)) @SUITE=all $(MAKE) test .PHONY: test-unit -test-unit: ## Unit tests, no Docker (i.e. 'make test SUITE=unit') +test-unit: ## Unit tests (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-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') + $(if $(filter command line,$(origin TAGS)),$(error TAGS= cannot be passed to test-integration; use 'make test TAGS=...' instead)) @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') + $(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-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') + $(if $(filter command line,$(origin SUITE)),$(error SUITE= cannot be passed to test-ldbc; use 'make test SUITE=...' instead)) @SUITE=ldbc $(MAKE) test .PHONY: test-load test-load: ## Heavy load tests (i.e. 'make test SUITE=load') + $(if $(filter command line,$(origin SUITE)),$(error SUITE= cannot be passed to test-load; use 'make test SUITE=...' instead)) @SUITE=load $(MAKE) test +.PHONY: test-everything +test-everything: ## Every test: all suites + integration + integration2 + upgrade + fuzz + $(MAKE) test-suites + $(MAKE) test-integration + $(MAKE) test-integration2 + $(MAKE) test-upgrade + $(MAKE) test-fuzz + .PHONY: test-benchmark test-benchmark: ## Go benchmarks (i.e. 'go test -bench') go test -bench=. -benchmem $(if $(PKG),./$(PKG)/...,./...) @@ -201,7 +229,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: unit,systest,core + 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)" diff --git a/TESTING.md b/TESTING.md index 1c930479fc6..4efcc236310 100644 --- a/TESTING.md +++ b/TESTING.md @@ -304,12 +304,15 @@ If both pass, you're ready to run all test types! The simplest way to run tests: ```bash -# Run all tests (default) +# Run default tests (~30 min): unit, systest, core suites + integration2 make test +# Run every test in the repo (all suites + all tag-based tests + fuzz) +make test-everything + # Common shortcuts (run 'make help' for full list) -make test-all # All test suites via t/ runner (i.e. 'make test SUITE=all') -make test-unit # Unit tests, no Docker (i.e. 'make test SUITE=unit') +make test-suites # All t/ runner suites (i.e. 'make test SUITE=all') +make test-unit # Unit tests (i.e. 'make test SUITE=unit') make test-core # Core tests (i.e. 'make test SUITE=core') make test-systest # System integration tests (i.e. 'make test SUITE=systest') 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') make test-integration # Integration tests (i.e. 'make test TAGS=integration') make test-integration2 # Integration2 tests via dgraphtest (i.e. 'make test TAGS=integration2') make test-upgrade # Upgrade tests (i.e. 'make test TAGS=upgrade') -make test-fuzz # Fuzz tests, auto-discovers packages (i.e. 'make test FUZZ=1') +make test-fuzz # Fuzz tests (i.e. 'make test FUZZ=1') make test-benchmark # Go benchmarks (i.e. 'go test -bench') ``` @@ -339,7 +342,8 @@ For more control, pass variables to `make test`: | `FUZZ` | Enable fuzz testing | `make test FUZZ=1` | | `FUZZTIME` | Fuzz duration per package | `make test FUZZ=1 FUZZTIME=60s` | -**Precedence:** `TAGS` > `FUZZ` > `SUITE` (first match wins) +**Precedence:** `TAGS` > `FUZZ` > `SUITE` > default (first match wins). When no +variable is set, `make test` runs suites `unit,systest,core` plus `integration2`. ### Examples @@ -1288,6 +1292,8 @@ The following items from the original wishlist have been implemented: - **✅ Unified test interface:** A single `make test` entry point that accepts arguments to run any test type (unit, integration, integration2, upgrade, fuzz) with environment variables for control. + The default (`make test` with no args) runs `unit,systest,core` suites plus `integration2` for a + fast feedback loop (~30 min). Use `make test-everything` to run all tests. - **✅ Example commands that "just work":** The following now work as expected: From 8d3ae161218832b2fe0ace5225c31932f037b998 Mon Sep 17 00:00:00 2001 From: Michael Welles Date: Tue, 24 Feb 2026 14:24:58 -0500 Subject: [PATCH 07/18] =?UTF-8?q?refactor(test):=20rename=20test-everythin?= =?UTF-8?q?g=20=E2=86=92=20test-full?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Shorter, clearer name for the target that runs every test in the repo (all suites + integration + integration2 + upgrade + fuzz). --- AGENTS.md | 36 +++++++++++++++++++++++++++++++----- CONTRIBUTING.md | 2 +- Makefile | 4 ++-- TESTING.md | 8 ++++---- 4 files changed, 38 insertions(+), 12 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index 9dae56cc42a..36e4e1e3217 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -1,16 +1,42 @@ # Repository Guidelines ## Project Structure & Module Organization -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/`. + +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/`. ## Build, Test, and Development Commands -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. + +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-full` for +every test in the repo. Keep Docker running for integration tests. When debugging version info, +`make version` surfaces the embedded build metadata. ## Coding Style & Naming Conventions -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. + +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. ## Testing Guidelines -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. + +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. ## Commit & Pull Request Guidelines -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. + +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. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 192d6e5097f..ed4f48e3dcb 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -148,7 +148,7 @@ The simplest way to run tests is via Make: make test # Run every test in the repo -make test-everything +make test-full # Run specific test types make test-unit # Unit tests only (no Docker) diff --git a/Makefile b/Makefile index 890612f4fd7..b6b2e0d945d 100644 --- a/Makefile +++ b/Makefile @@ -165,8 +165,8 @@ test-load: ## Heavy load tests (i.e. 'make test SUITE=load') $(if $(filter command line,$(origin SUITE)),$(error SUITE= cannot be passed to test-load; use 'make test SUITE=...' instead)) @SUITE=load $(MAKE) test -.PHONY: test-everything -test-everything: ## Every test: all suites + integration + integration2 + upgrade + fuzz +.PHONY: test-full +test-full: ## Every test: all suites + integration + integration2 + upgrade + fuzz $(MAKE) test-suites $(MAKE) test-integration $(MAKE) test-integration2 diff --git a/TESTING.md b/TESTING.md index 4efcc236310..002439b2e6f 100644 --- a/TESTING.md +++ b/TESTING.md @@ -308,7 +308,7 @@ The simplest way to run tests: make test # Run every test in the repo (all suites + all tag-based tests + fuzz) -make test-everything +make test-full # Common shortcuts (run 'make help' for full list) make test-suites # All t/ runner suites (i.e. 'make test SUITE=all') @@ -342,8 +342,8 @@ For more control, pass variables to `make test`: | `FUZZ` | Enable fuzz testing | `make test FUZZ=1` | | `FUZZTIME` | Fuzz duration per package | `make test FUZZ=1 FUZZTIME=60s` | -**Precedence:** `TAGS` > `FUZZ` > `SUITE` > default (first match wins). When no -variable is set, `make test` runs suites `unit,systest,core` plus `integration2`. +**Precedence:** `TAGS` > `FUZZ` > `SUITE` > default (first match wins). When no variable is set, +`make test` runs suites `unit,systest,core` plus `integration2`. ### Examples @@ -1293,7 +1293,7 @@ The following items from the original wishlist have been implemented: - **✅ Unified test interface:** A single `make test` entry point that accepts arguments to run any test type (unit, integration, integration2, upgrade, fuzz) with environment variables for control. The default (`make test` with no args) runs `unit,systest,core` suites plus `integration2` for a - fast feedback loop (~30 min). Use `make test-everything` to run all tests. + fast feedback loop (~30 min). Use `make test-full` to run all tests. - **✅ Example commands that "just work":** The following now work as expected: From 404c5529c3bb4e4a1173a65dde280ec023a7fe36 Mon Sep 17 00:00:00 2001 From: Michael Welles Date: Tue, 24 Feb 2026 14:43:39 -0500 Subject: [PATCH 08/18] =?UTF-8?q?refactor(test):=20rename=20test-suites=20?= =?UTF-8?q?=E2=86=92=20test-suite,=20accept=20SUITE=20arg?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit test-suite now accepts an optional SUITE= argument (defaults to all), making it a flexible entry point for running any t/ runner suite. --- Makefile | 9 ++++----- TESTING.md | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index b6b2e0d945d..e60fb32ae1d 100644 --- a/Makefile +++ b/Makefile @@ -110,10 +110,9 @@ else endif endif -.PHONY: test-suites -test-suites: ## All test suites via t/ runner (i.e. 'make test SUITE=all') - $(if $(filter command line,$(origin SUITE)),$(error SUITE= cannot be passed to test-suites; use 'make test SUITE=...' instead)) - @SUITE=all $(MAKE) test +.PHONY: test-suite +test-suite: ## Run t/ runner suite (default: all). Ex: make test-suite SUITE=unit + @SUITE=$(or $(SUITE),all) $(MAKE) test .PHONY: test-unit test-unit: ## Unit tests (i.e. 'make test SUITE=unit') @@ -167,7 +166,7 @@ test-load: ## Heavy load tests (i.e. 'make test SUITE=load') .PHONY: test-full test-full: ## Every test: all suites + integration + integration2 + upgrade + fuzz - $(MAKE) test-suites + $(MAKE) test-suite $(MAKE) test-integration $(MAKE) test-integration2 $(MAKE) test-upgrade diff --git a/TESTING.md b/TESTING.md index 002439b2e6f..a276ecb4298 100644 --- a/TESTING.md +++ b/TESTING.md @@ -311,7 +311,7 @@ make test make test-full # Common shortcuts (run 'make help' for full list) -make test-suites # All t/ runner suites (i.e. 'make test SUITE=all') +make test-suite # All t/ runner suites (default), or: make test-suite SUITE=unit make test-unit # Unit tests (i.e. 'make test SUITE=unit') make test-core # Core tests (i.e. 'make test SUITE=core') make test-systest # System integration tests (i.e. 'make test SUITE=systest') From d04e7b937d65a7d6886836171775b0d22c1b63b9 Mon Sep 17 00:00:00 2001 From: Michael Welles Date: Tue, 24 Feb 2026 14:44:40 -0500 Subject: [PATCH 09/18] chore: remove AGENTS.md from repo, add to .gitignore AGENTS.md is a local Claude Code config file that should not be tracked in version control. --- .gitignore | 1 + AGENTS.md | 42 ------------------------------------------ 2 files changed, 1 insertion(+), 42 deletions(-) delete mode 100644 AGENTS.md diff --git a/.gitignore b/.gitignore index 248248ed6cb..fcd7ad370a9 100644 --- a/.gitignore +++ b/.gitignore @@ -48,3 +48,4 @@ x/log_test/*.enc *.buf .osgrep .worktrees/ +AGENTS.md diff --git a/AGENTS.md b/AGENTS.md deleted file mode 100644 index 36e4e1e3217..00000000000 --- a/AGENTS.md +++ /dev/null @@ -1,42 +0,0 @@ -# Repository Guidelines - -## Project Structure & Module Organization - -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/`. - -## Build, Test, and Development Commands - -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-full` for -every test in the repo. Keep Docker running for integration tests. When debugging version info, -`make version` surfaces the embedded build metadata. - -## Coding Style & Naming Conventions - -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. - -## Testing Guidelines - -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. - -## Commit & Pull Request Guidelines - -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. From 3d85069372c86dae314b23a3262d6e65e5c572ce Mon Sep 17 00:00:00 2001 From: Michael Welles Date: Tue, 24 Feb 2026 14:45:09 -0500 Subject: [PATCH 10/18] chore: add CLAUDE.md to .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index fcd7ad370a9..d45a04118c3 100644 --- a/.gitignore +++ b/.gitignore @@ -49,3 +49,4 @@ x/log_test/*.enc .osgrep .worktrees/ AGENTS.md +CLAUDE.md From dfef2c314b54eca94879d8b6467531a504b1b801 Mon Sep 17 00:00:00 2001 From: Michael Welles Date: Tue, 24 Feb 2026 18:41:34 -0500 Subject: [PATCH 11/18] fix(test): resolve integration test routing, gotestsum PATH, and cross-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). --- CONTRIBUTING.md | 6 +- Makefile | 26 +++++--- TESTING.md | 28 ++++---- dgraphtest/local_cluster.go | 30 ++++++++- t/Makefile | 6 +- t/scripts/check-cross-compiler.sh | 106 ++++++++++++++++++++++++++++++ t/t.go | 13 +++- testutil/plugin.go | 29 +++++++- 8 files changed, 216 insertions(+), 28 deletions(-) create mode 100755 t/scripts/check-cross-compiler.sh diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ed4f48e3dcb..f11cb5f8ddb 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -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 @@ -144,6 +145,9 @@ directory, providing control and flexibility beyond the standard Go testing fram The simplest way to run tests is via Make: ```bash +# First-time setup: install tool dependencies +make setup + # Run default tests (~30 min): unit, systest, core suites + integration2 make test diff --git a/Makefile b/Makefile index e60fb32ae1d..eec6b94484d 100644 --- a/Makefile +++ b/Makefile @@ -78,6 +78,14 @@ dgraph-installed: $(MAKE) install; \ fi +.PHONY: deps +deps: ## Check test dependencies (pass AUTO_INSTALL=true to auto-install missing ones) + $(MAKE) -C t check + +.PHONY: setup +setup: ## Install all test dependencies automatically + $(MAKE) deps AUTO_INSTALL=true + .PHONY: test test: dgraph-installed local-image ## Run tests (default: unit,systest,core + integration2) ifdef TAGS @@ -124,11 +132,6 @@ 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') - $(if $(filter command line,$(origin TAGS)),$(error TAGS= cannot be passed to test-integration; use 'make test TAGS=...' instead)) - @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)) @@ -165,9 +168,8 @@ test-load: ## Heavy load tests (i.e. 'make test SUITE=load') @SUITE=load $(MAKE) test .PHONY: test-full -test-full: ## Every test: all suites + integration + integration2 + upgrade + fuzz +test-full: ## Every test: all suites + integration2 + upgrade + fuzz $(MAKE) test-suite - $(MAKE) test-integration $(MAKE) test-integration2 $(MAKE) test-upgrade $(MAKE) test-fuzz @@ -188,6 +190,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 @@ -243,8 +252,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" diff --git a/TESTING.md b/TESTING.md index a276ecb4298..e3e9c155830 100644 --- a/TESTING.md +++ b/TESTING.md @@ -128,8 +128,9 @@ The codebase is organized into several key packages: Before running tests, ensure you have the following installed and configured. -> **TL;DR:** On a fresh checkout, just run `make install` followed by `make test`. The build system -> automatically handles OS detection, builds the correct binaries, and validates dependencies. +> **TL;DR:** On a fresh checkout, run `make setup` to auto-install tool dependencies, then +> `make install` followed by `make test`. The build system automatically handles OS detection, +> builds the correct binaries, and validates dependencies. ### Automatic Dependency Checking @@ -137,11 +138,14 @@ The test framework includes scripts that check for required dependencies and can auto-install them: ```bash -# Check all dependencies (run from t/ directory) -cd t && make check +# Auto-install all missing tool dependencies (recommended for first-time setup) +make setup -# Auto-install missing dependencies -AUTO_INSTALL=true make check +# Check dependencies without installing (reports what's missing) +make deps + +# Same as 'make deps' but auto-installs anything missing +make deps AUTO_INSTALL=true ``` The check scripts validate: @@ -154,9 +158,8 @@ The check scripts validate: ### Required Tools -> **Note:** You don't need to install these manually. Running `AUTO_INSTALL=true make check` from -> the `t/` directory (or `AUTO_INSTALL=true make test` from the repo root) automatically installs -> missing dependencies. The commands below are listed for reference. +> **Note:** You don't need to install these manually. Running `make setup` from the repo root +> automatically installs missing dependencies. The commands below are listed for reference. #### 1. Go (1.21+) @@ -222,8 +225,8 @@ dgraph version The build system now handles most setup automatically. On both Linux and macOS: ```bash -# Install dependencies (optional - auto-installs if missing) -cd t && AUTO_INSTALL=true make check && cd .. +# Auto-install tool dependencies (gotestsum, ack, etc.) +make setup # Build dgraph binary (automatically handles Linux binary on macOS) make install @@ -318,7 +321,6 @@ make test-systest # System integration tests (i.e. 'make test SUITE=systes make test-vector # Vector search tests (i.e. 'make test SUITE=vector') make test-ldbc # LDBC benchmark tests (i.e. 'make test SUITE=ldbc') make test-load # Heavy load tests (i.e. 'make test SUITE=load') -make test-integration # Integration tests (i.e. 'make test TAGS=integration') make test-integration2 # Integration2 tests via dgraphtest (i.e. 'make test TAGS=integration2') make test-upgrade # Upgrade tests (i.e. 'make test TAGS=upgrade') make test-fuzz # Fuzz tests (i.e. 'make test FUZZ=1') @@ -1301,7 +1303,7 @@ The following items from the original wishlist have been implemented: make test SUITE=systest make test FUZZ=1 PKG=dql make test TAGS=upgrade PKG=acl - make test TAGS=integration PKG=systest/plugin + make test-suite SUITE=systest PKG=systest/plugin ``` ### Remaining Ideas diff --git a/dgraphtest/local_cluster.go b/dgraphtest/local_cluster.go index 504feac2b26..80a0fb10b9e 100644 --- a/dgraphtest/local_cluster.go +++ b/dgraphtest/local_cluster.go @@ -1322,11 +1322,19 @@ func (c *LocalCluster) GeneratePlugins(raceEnabled bool) error { if raceEnabled { opts = append(opts, "-race") } - opts = append(opts, "-buildmode=plugin", "-o", so, src) - os.Setenv("GOOS", "linux") - os.Setenv("GOARCH", "amd64") + opts = append(opts, "-buildmode=plugin") + if runtime.GOOS != "linux" { + // Use the BFD linker; the default gold linker is not shipped + // with most cross-compiler toolchains. + opts = append(opts, "-ldflags", "-extldflags -fuse-ld=bfd") + } + opts = append(opts, "-o", so, src) cmd := exec.Command("go", opts...) cmd.Dir = filepath.Dir(curr) + cmd.Env = append(os.Environ(), "GOOS=linux", "GOARCH="+runtime.GOARCH) + if runtime.GOOS != "linux" { + cmd.Env = append(cmd.Env, "CGO_ENABLED=1", "CC="+linuxCrossCC()) + } if out, err := cmd.CombinedOutput(); err != nil { log.Printf("Error: %v\n", err) log.Printf("Output: %v\n", string(out)) @@ -1347,6 +1355,22 @@ func (c *LocalCluster) GeneratePlugins(raceEnabled bool) error { return nil } +// linuxCrossCC returns the C cross-compiler for targeting Linux from the current host. +// Respects the LINUX_CC environment variable if set. +func linuxCrossCC() string { + if cc := os.Getenv("LINUX_CC"); cc != "" { + return cc + } + switch runtime.GOARCH { + case "arm64": + return "aarch64-unknown-linux-gnu-gcc" + case "amd64": + return "x86_64-unknown-linux-gnu-gcc" + default: + return "gcc" + } +} + func (c *LocalCluster) GetAlphaGrpcPublicPort(id int) (string, error) { return publicPort(c.dcli, c.alphas[id], alphaGrpcPort) } diff --git a/t/Makefile b/t/Makefile index 14ed4d61d68..fc5be4b31f2 100644 --- a/t/Makefile +++ b/t/Makefile @@ -19,7 +19,7 @@ endif all: test .PHONY: check -check: check-go check-docker check-gotestsum check-ack +check: check-go check-docker check-gotestsum check-ack check-cross-compiler @if [ "$(GOOS)" = "linux" ]; then \ which protoc > /dev/null 2>&1 || (echo "Error: protoc is not installed or not in PATH" && exit 1); \ fi @@ -44,6 +44,10 @@ check-gotestsum: check-ack: @./scripts/check-ack.sh +.PHONY: check-cross-compiler +check-cross-compiler: + @./scripts/check-cross-compiler.sh + .PHONY: check-protoc check-protoc: @./scripts/check-protoc.sh diff --git a/t/scripts/check-cross-compiler.sh b/t/scripts/check-cross-compiler.sh new file mode 100755 index 00000000000..d59947ef397 --- /dev/null +++ b/t/scripts/check-cross-compiler.sh @@ -0,0 +1,106 @@ +#!/usr/bin/env bash +# shellcheck disable=SC2310 +set -euo pipefail + +# shellcheck source=checkhelper.sh +source "$(dirname "${BASH_SOURCE[0]}")/checkhelper.sh" + +BREW_TAP="messense/macos-cross-toolchains" + +# Return the expected cross-compiler binary name for the host architecture. +get_cross_compiler() { + if [[ -n ${LINUX_CC-} ]]; then + echo "${LINUX_CC}" + return + fi + local arch + arch="$(uname -m)" + case "${arch}" in + arm64 | aarch64) + echo "aarch64-unknown-linux-gnu-gcc" + ;; + x86_64) + echo "x86_64-unknown-linux-gnu-gcc" + ;; + *) + err "unsupported architecture: ${arch}" + return 1 + ;; + esac +} + +# Return the Homebrew formula name for the cross-compiler. +get_brew_formula() { + local arch + arch="$(uname -m)" + case "${arch}" in + arm64 | aarch64) + echo "aarch64-unknown-linux-gnu" + ;; + x86_64) + echo "x86_64-unknown-linux-gnu" + ;; + *) + err "unsupported architecture: ${arch}" + return 1 + ;; + esac +} + +install_cross_compiler_macos() { + ensure_brew || exit 1 + local formula + formula="$(get_brew_formula)" + brew tap "${BREW_TAP}" + brew install "${BREW_TAP}/${formula}" +} + +main() { + # Cross-compiler is only needed on non-Linux systems + if [[ "$(get_os)" == "Linux" ]]; then + exit 0 + fi + + local cc + cc="$(get_cross_compiler)" + + if command -v "${cc}" &>/dev/null; then + exit 0 + fi + + if [[ ${AUTO_INSTALL-} == "true" ]]; then + install_cross_compiler_macos + if command -v "${cc}" &>/dev/null; then + exit 0 + else + err "cross-compiler check still failing after installation" + exit 1 + fi + fi + + echo "" + err "Linux cross-compiler is not installed (needed for Go plugin builds)" + echo "" + err "Required binary: ${cc}" + echo "" + err "Please install manually:" + + case "$(get_os)" in + Darwin) + local formula + formula="$(get_brew_formula)" + err " brew tap ${BREW_TAP}" + err " brew install ${BREW_TAP}/${formula}" + echo "" + err 'Or set LINUX_CC to a custom cross-compiler (e.g. "zig cc -target ...")' + ;; + *) + err " (install a gcc cross-compiler targeting linux for your architecture)" + ;; + esac + + print_auto_install_hint + exit 1 +} + +main "$@" diff --git a/t/t.go b/t/t.go index 37ff7fe1795..9435c103109 100644 --- a/t/t.go +++ b/t/t.go @@ -422,8 +422,19 @@ func sanitizeFilename(pkg string) string { return strings.ReplaceAll(pkg, "/", "_") } +// gotestsumBin returns the absolute path to gotestsum inside $GOPATH/bin. +// This avoids relying on $PATH, which may not include $GOPATH/bin on all machines +// (the check-gotestsum.sh script validates at this same path). +func gotestsumBin() string { + gopath := os.Getenv("GOPATH") + if gopath == "" { + gopath = filepath.Join(os.Getenv("HOME"), "go") + } + return filepath.Join(gopath, "bin", "gotestsum") +} + func runTestsFor(ctx context.Context, pkg, prefix string, xmlFile string) error { - args := []string{"gotestsum", "--junitfile", xmlFile, "--format", "standard-verbose", "--max-fails", "1", "--", + args := []string{gotestsumBin(), "--junitfile", xmlFile, "--format", "standard-verbose", "--max-fails", "1", "--", "-v", "-failfast", "-tags=integration"} switch { case *testTimeout != "": diff --git a/testutil/plugin.go b/testutil/plugin.go index 6beda3ea5a7..f3e4b0d5843 100644 --- a/testutil/plugin.go +++ b/testutil/plugin.go @@ -7,6 +7,7 @@ package testutil import ( "fmt" + "os" "os/exec" "path/filepath" "runtime" @@ -33,9 +34,19 @@ func GeneratePlugins(raceEnabled bool) { if raceEnabled { opts = append(opts, "-race") } - opts = append(opts, "-buildmode=plugin", "-o", so, src) + opts = append(opts, "-buildmode=plugin") + if runtime.GOOS != "linux" { + // Use the BFD linker; the default gold linker is not shipped + // with most cross-compiler toolchains. + opts = append(opts, "-ldflags", "-extldflags -fuse-ld=bfd") + } + opts = append(opts, "-o", so, src) cmd := exec.Command("go", opts...) cmd.Dir = filepath.Dir(curr) + cmd.Env = append(os.Environ(), "GOOS=linux", "GOARCH="+runtime.GOARCH) + if runtime.GOOS != "linux" { + cmd.Env = append(cmd.Env, "CGO_ENABLED=1", "CC="+linuxCC()) + } if out, err := cmd.CombinedOutput(); err != nil { fmt.Printf("Error: %v\n", err) fmt.Printf("Output: %v\n", string(out)) @@ -51,3 +62,19 @@ func GeneratePlugins(raceEnabled bool) { fmt.Printf("plugin build completed. Files are: %s\n", strings.Join(soFiles, ",")) } + +// linuxCC returns the C cross-compiler for targeting Linux from the current host. +// Respects the LINUX_CC environment variable if set. +func linuxCC() string { + if cc := os.Getenv("LINUX_CC"); cc != "" { + return cc + } + switch runtime.GOARCH { + case "arm64": + return "aarch64-unknown-linux-gnu-gcc" + case "amd64": + return "x86_64-unknown-linux-gnu-gcc" + default: + return "gcc" + } +} From cb87a32984051c70d068692e36353965b516bad0 Mon Sep 17 00:00:00 2001 From: Michael Welles Date: Tue, 24 Feb 2026 19:56:06 -0500 Subject: [PATCH 12/18] fix(test): enable CGO cross-compilation for plugin support on macOS 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 --- Makefile | 21 +++++++++++++++++---- dgraph/Makefile | 3 ++- t/Makefile | 7 +++++-- 3 files changed, 24 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index eec6b94484d..54816437cd6 100644 --- a/Makefile +++ b/Makefile @@ -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 ###################### @@ -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 @@ -80,7 +89,7 @@ dgraph-installed: .PHONY: deps deps: ## Check test dependencies (pass AUTO_INSTALL=true to auto-install missing ones) - $(MAKE) -C t check + $(MAKE) -C t deps .PHONY: setup setup: ## Install all test dependencies automatically @@ -181,7 +190,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 . diff --git a/dgraph/Makefile b/dgraph/Makefile index 6608079782e..4a2de9bcc36 100644 --- a/dgraph/Makefile +++ b/dgraph/Makefile @@ -32,7 +32,8 @@ gitBranch = github.com/dgraph-io/dgraph/v25/x.gitBranch lastCommitSHA = github.com/dgraph-io/dgraph/v25/x.lastCommitSHA lastCommitTime = github.com/dgraph-io/dgraph/v25/x.lastCommitTime -BUILD_FLAGS ?= -ldflags '-X ${lastCommitSHA}=${BUILD} -X "${lastCommitTime}=${BUILD_DATE}" -X "${dgraphVersion}=${BUILD_VERSION}" -X "${dgraphCodename}=${BUILD_CODENAME}" -X ${gitBranch}=${BUILD_BRANCH}' +EXTLDFLAGS ?= +BUILD_FLAGS ?= -ldflags '-X ${lastCommitSHA}=${BUILD} -X "${lastCommitTime}=${BUILD_DATE}" -X "${dgraphVersion}=${BUILD_VERSION}" -X "${dgraphCodename}=${BUILD_CODENAME}" -X ${gitBranch}=${BUILD_BRANCH}$(if $(EXTLDFLAGS), -extldflags "$(EXTLDFLAGS)")' # Insert build tags if specified ifneq ($(strip $(BUILD_TAGS)),) diff --git a/t/Makefile b/t/Makefile index fc5be4b31f2..b6e35a851f5 100644 --- a/t/Makefile +++ b/t/Makefile @@ -18,12 +18,15 @@ endif all: test -.PHONY: check -check: check-go check-docker check-gotestsum check-ack check-cross-compiler +.PHONY: deps +deps: check-go check-docker check-gotestsum check-ack check-cross-compiler @if [ "$(GOOS)" = "linux" ]; then \ which protoc > /dev/null 2>&1 || (echo "Error: protoc is not installed or not in PATH" && exit 1); \ fi @echo "All dependencies are installed" + +.PHONY: check +check: deps @echo "LINUX_GOBIN=$(LINUX_GOBIN)" @if [ -f "$(LINUX_GOBIN)/dgraph" ]; then \ file $(LINUX_GOBIN)/dgraph | grep -q "ELF.*executable" || (echo "Error: dgraph binary at $(LINUX_GOBIN)/dgraph is not a Linux executable" && exit 1); \ From e929c1ac739b2939d2f721b935397463d0885546 Mon Sep 17 00:00:00 2001 From: Michael Welles Date: Wed, 25 Feb 2026 00:10:16 -0500 Subject: [PATCH 13/18] fix(test): add Docker memory limits, cluster pause/resume, and resilient restore waits - Add deploy memory limits to all docker-compose services (zeros: 512M, alphas: 2-4GB, minio: 512M) to prevent OOM kills on macOS Docker Desktop - Add --cache "size-mb=1024" to alpha commands for explicit cache sizing - Implement pause/resume of the default cluster during custom-cluster tests so the full Docker memory budget is available for custom clusters - Make WaitForRestore resilient to transient errors (connection reset, unavailable, transport errors) with a 10-minute deadline instead of infinite loop - Simplify dgraph-installed Make target to always rebuild - Ensure $GOPATH/bin is in PATH for subprocess tool discovery --- Makefile | 5 +- systest/online-restore/docker-compose.yml | 52 ++++++++++---- t/t.go | 86 ++++++++++++++++++++++- testutil/backup.go | 49 ++++++++++--- 4 files changed, 167 insertions(+), 25 deletions(-) diff --git a/Makefile b/Makefile index 54816437cd6..37116cc1eea 100644 --- a/Makefile +++ b/Makefile @@ -82,10 +82,7 @@ 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) diff --git a/systest/online-restore/docker-compose.yml b/systest/online-restore/docker-compose.yml index 51a69f056ed..2218d41bf95 100644 --- a/systest/online-restore/docker-compose.yml +++ b/systest/online-restore/docker-compose.yml @@ -8,6 +8,10 @@ services: ports: - 8080 - 9080 + deploy: + resources: + limits: + memory: 4096M volumes: - type: bind source: ${LINUX_GOBIN:-$GOPATH/bin} @@ -31,8 +35,8 @@ services: read_only: true command: /gobin/dgraph ${COVERAGE_OUTPUT} alpha --my=alpha1:7080 --zero=zero1:5080 --logtostderr -v=2 - --raft "idx=1;" --encryption "key-file=/data/keys/enc_key;" --security "whitelist=0.0.0.0/0;" - --tls "ca-cert=/dgraph-tls/ca.crt; server-cert=/dgraph-tls/node.crt; + --cache "size-mb=1024;" --raft "idx=1;" --encryption "key-file=/data/keys/enc_key;" --security + "whitelist=0.0.0.0/0;" --tls "ca-cert=/dgraph-tls/ca.crt; server-cert=/dgraph-tls/node.crt; server-key=/dgraph-tls/node.key; internal-port=true; client-cert=/dgraph-tls/client.alpha1.crt; client-key=/dgraph-tls/client.alpha1.key;" alpha2: @@ -45,6 +49,10 @@ services: ports: - 8080 - 9080 + deploy: + resources: + limits: + memory: 4096M volumes: - type: bind source: ${LINUX_GOBIN:-$GOPATH/bin} @@ -68,8 +76,8 @@ services: read_only: true command: /gobin/dgraph ${COVERAGE_OUTPUT} alpha --my=alpha2:7080 --zero=zero1:5080 --logtostderr -v=2 - --raft "idx=2;" --encryption "key-file=/data/keys/enc_key;" --security "whitelist=0.0.0.0/0;" - --tls "ca-cert=/dgraph-tls/ca.crt; server-cert=/dgraph-tls/node.crt; + --cache "size-mb=1024;" --raft "idx=2;" --encryption "key-file=/data/keys/enc_key;" --security + "whitelist=0.0.0.0/0;" --tls "ca-cert=/dgraph-tls/ca.crt; server-cert=/dgraph-tls/node.crt; server-key=/dgraph-tls/node.key; internal-port=true; client-cert=/dgraph-tls/client.alpha2.crt; client-key=/dgraph-tls/client.alpha2.key;" alpha3: @@ -82,6 +90,10 @@ services: ports: - 8080 - 9080 + deploy: + resources: + limits: + memory: 4096M volumes: - type: bind source: ${LINUX_GOBIN:-$GOPATH/bin} @@ -105,8 +117,8 @@ services: read_only: true command: /gobin/dgraph ${COVERAGE_OUTPUT} alpha --my=alpha3:7080 --zero=zero1:5080 --logtostderr -v=2 - --raft "idx=3;" --encryption "key-file=/data/keys/enc_key;" --security "whitelist=0.0.0.0/0;" - --tls "ca-cert=/dgraph-tls/ca.crt; server-cert=/dgraph-tls/node.crt; + --cache "size-mb=1024;" --raft "idx=3;" --encryption "key-file=/data/keys/enc_key;" --security + "whitelist=0.0.0.0/0;" --tls "ca-cert=/dgraph-tls/ca.crt; server-cert=/dgraph-tls/node.crt; server-key=/dgraph-tls/node.key; internal-port=true; client-cert=/dgraph-tls/client.alpha3.crt; client-key=/dgraph-tls/client.alpha3.key;" alpha4: @@ -119,6 +131,10 @@ services: ports: - 8080 - 9080 + deploy: + resources: + limits: + memory: 4096M volumes: - type: bind source: ${LINUX_GOBIN:-$GOPATH/bin} @@ -142,8 +158,8 @@ services: read_only: true command: /gobin/dgraph ${COVERAGE_OUTPUT} alpha --my=alpha4:7080 --zero=zero1:5080 --logtostderr -v=2 - --raft "idx=4;" --encryption "key-file=/data/keys/enc_key;" --security "whitelist=0.0.0.0/0;" - --tls "ca-cert=/dgraph-tls/ca.crt; server-cert=/dgraph-tls/node.crt; + --cache "size-mb=1024;" --raft "idx=4;" --encryption "key-file=/data/keys/enc_key;" --security + "whitelist=0.0.0.0/0;" --tls "ca-cert=/dgraph-tls/ca.crt; server-cert=/dgraph-tls/node.crt; server-key=/dgraph-tls/node.key; internal-port=true; client-cert=/dgraph-tls/client.alpha4.crt; client-key=/dgraph-tls/client.alpha4.key;" alpha5: @@ -156,6 +172,10 @@ services: ports: - 8080 - 9080 + deploy: + resources: + limits: + memory: 4096M volumes: - type: bind source: ${LINUX_GOBIN:-$GOPATH/bin} @@ -179,8 +199,8 @@ services: read_only: true command: /gobin/dgraph ${COVERAGE_OUTPUT} alpha --my=alpha5:7080 --zero=zero1:5080 --logtostderr -v=2 - --raft "idx=5;" --encryption "key-file=/data/keys/enc_key;" --security "whitelist=0.0.0.0/0;" - --tls "ca-cert=/dgraph-tls/ca.crt; server-cert=/dgraph-tls/node.crt; + --cache "size-mb=1024;" --raft "idx=5;" --encryption "key-file=/data/keys/enc_key;" --security + "whitelist=0.0.0.0/0;" --tls "ca-cert=/dgraph-tls/ca.crt; server-cert=/dgraph-tls/node.crt; server-key=/dgraph-tls/node.key; internal-port=true; client-cert=/dgraph-tls/client.alpha5.crt; client-key=/dgraph-tls/client.alpha5.key;" alpha6: @@ -193,6 +213,10 @@ services: ports: - 8080 - 9080 + deploy: + resources: + limits: + memory: 4096M volumes: - type: bind source: ${LINUX_GOBIN:-$GOPATH/bin} @@ -216,8 +240,8 @@ services: read_only: true command: /gobin/dgraph ${COVERAGE_OUTPUT} alpha --my=alpha6:7080 --zero=zero1:5080 --logtostderr -v=2 - --raft "idx=6;" --encryption "key-file=/data/keys/enc_key;" --security "whitelist=0.0.0.0/0;" - --tls "ca-cert=/dgraph-tls/ca.crt; server-cert=/dgraph-tls/node.crt; + --cache "size-mb=1024;" --raft "idx=6;" --encryption "key-file=/data/keys/enc_key;" --security + "whitelist=0.0.0.0/0;" --tls "ca-cert=/dgraph-tls/ca.crt; server-cert=/dgraph-tls/node.crt; server-key=/dgraph-tls/node.key; internal-port=true; client-cert=/dgraph-tls/client.alpha6.crt; client-key=/dgraph-tls/client.alpha6.key;" zero1: @@ -228,6 +252,10 @@ services: ports: - 5080 - 6080 + deploy: + resources: + limits: + memory: 1024M volumes: - type: bind source: ${LINUX_GOBIN:-$GOPATH/bin} diff --git a/t/t.go b/t/t.go index 9435c103109..5f73e015fa1 100644 --- a/t/t.go +++ b/t/t.go @@ -592,6 +592,76 @@ func runTests(taskCh chan task, closer *z.Closer) error { } }() + // defaultPaused tracks whether the default cluster has been stopped to + // free memory for custom-cluster tests. + var defaultPaused bool + + // pauseDefault stops the default cluster containers (without removing + // them) so that custom-cluster tests have the full Docker memory + // budget. On macOS/Docker-Desktop the VM is memory-constrained and + // running 16+ Dgraph processes simultaneously causes OOM kills. + pauseDefault := func() { + if !started || stopped { + return + } + cmd := command("docker", "compose", "--compatibility", + "-f", defaultCompose, "-p", prefix, "stop") + cmd.Stderr = nil + if err := cmd.Run(); err != nil { + fmt.Printf("Warning: failed to pause default cluster %s: %v\n", prefix, err) + } else { + defaultPaused = true + fmt.Printf("DEFAULT CLUSTER PAUSED: %s\n", prefix) + } + } + + // resumeDefault restarts the stopped default cluster containers and + // waits for them to become healthy. + resumeDefault := func() error { + if !started || stopped { + return start() + } + if !defaultPaused { + return nil // already running + } + cmd := command("docker", "compose", "--compatibility", + "-f", defaultCompose, "-p", prefix, "start") + cmd.Stderr = nil + if err := cmd.Run(); err != nil { + fmt.Printf("Warning: failed to resume default cluster %s: %v\n", prefix, err) + // If resume fails, recreate the cluster from scratch. + started = false + return start() + } + fmt.Printf("DEFAULT CLUSTER RESUMED: %s\n", prefix) + + // Wait for health after resume. + var resumeWg sync.WaitGroup + for i := 1; i <= NumZeroNodes; i++ { + resumeWg.Add(1) + go func(n int) { + defer resumeWg.Done() + in := testutil.GetContainerInstance(prefix, "zero"+strconv.Itoa(n)) + if err := in.BestEffortWaitForHealthy(ZeroPort); err != nil { + fmt.Printf("Warning: zero%d health check after resume: %v\n", n, err) + } + }(i) + } + for i := 1; i <= NumAlphaNodes; i++ { + resumeWg.Add(1) + go func(n int) { + defer resumeWg.Done() + in := testutil.GetContainerInstance(prefix, "alpha"+strconv.Itoa(n)) + if err := in.BestEffortWaitForHealthy(AlphaPort); err != nil { + fmt.Printf("Warning: alpha%d health check after resume: %v\n", n, err) + } + }(i) + } + resumeWg.Wait() + defaultPaused = false + return nil + } + for task := range taskCh { if ctx.Err() != nil { err = ctx.Err() @@ -608,7 +678,7 @@ func runTests(taskCh chan task, closer *z.Closer) error { // If we only need to run custom cluster tests, then skip this one. continue } - if err := start(); err != nil { + if err := resumeDefault(); err != nil { return err } if err = runTestsFor(ctx, task.pkg.ID, prefix, xmlFile); err != nil { @@ -616,6 +686,8 @@ func runTests(taskCh chan task, closer *z.Closer) error { return err } } else { + // Pause the default cluster to free memory for the custom cluster. + pauseDefault() // we are not using err variable here because we dont want to // print logs of default cluster in case of custom test fail. if cerr := runCustomClusterTest(ctx, task.pkg.ID, wg, xmlFile); cerr != nil { @@ -1179,6 +1251,18 @@ func run() error { fmt.Printf("Proc ID is %d\n", procId) fmt.Printf("Detected architecture: %s", runtime.GOARCH) + // Ensure $GOPATH/bin is in PATH so that tools installed via `go install` + // (e.g. protoc-gen-go) are found by subprocesses like protoc. + gopath := os.Getenv("GOPATH") + if gopath == "" { + gopath = filepath.Join(os.Getenv("HOME"), "go") + } + gopathBin := filepath.Join(gopath, "bin") + currentPath := os.Getenv("PATH") + if !strings.Contains(currentPath, gopathBin) { + os.Setenv("PATH", gopathBin+string(os.PathListSeparator)+currentPath) + } + start := time.Now() oc.Took(0, "START", time.Millisecond) diff --git a/testutil/backup.go b/testutil/backup.go index bc614ad8a7a..5aaa672cb4c 100644 --- a/testutil/backup.go +++ b/testutil/backup.go @@ -53,13 +53,28 @@ func openDgraph(pdir string) (*badger.DB, error) { } func WaitForRestore(t *testing.T, dg *dgo.Dgraph, HttpSocket string) { + // Use a 10-minute overall deadline so the test fails quickly if the + // cluster is in a permanently degraded state (e.g. OOM-killed containers) + // rather than hanging until the Go test timeout. + deadline := time.Now().Add(10 * time.Minute) + restoreDone := false - for { + for time.Now().Before(deadline) { resp, err := http.Get("http://" + HttpSocket + "/health") - require.NoError(t, err) + if err != nil { + // The health endpoint may be transiently unreachable while the + // server restarts during a restore. Keep retrying. + t.Logf("WaitForRestore: health check error (will retry): %v", err) + time.Sleep(1 * time.Second) + continue + } buf, err := io.ReadAll(resp.Body) - require.NoError(t, resp.Body.Close()) - require.NoError(t, err) + _ = resp.Body.Close() + if err != nil { + t.Logf("WaitForRestore: error reading health body (will retry): %v", err) + time.Sleep(1 * time.Second) + continue + } sbuf := string(buf) if !strings.Contains(sbuf, "opRestore") { restoreDone = true @@ -67,7 +82,7 @@ func WaitForRestore(t *testing.T, dg *dgo.Dgraph, HttpSocket string) { } time.Sleep(1 * time.Second) } - require.True(t, restoreDone) + require.True(t, restoreDone, "timed out waiting for restore operation to complete") // Wait for the client to exit draining mode. This is needed because the client might // be connected to a follower and might be behind the leader in applying the restore. @@ -75,7 +90,7 @@ func WaitForRestore(t *testing.T, dg *dgo.Dgraph, HttpSocket string) { // which the query succeeds at the first attempt because the follower is behind and // has not started to apply the restore proposal. numSuccess := 0 - for { + for time.Now().Before(deadline) { // This is a dummy query that returns no results. _, err := dg.NewTxn().Query(context.Background(), `{ q(func: has(invalid_pred)) { @@ -85,18 +100,36 @@ func WaitForRestore(t *testing.T, dg *dgo.Dgraph, HttpSocket string) { if err == nil { numSuccess++ } else { - require.Contains(t, err.Error(), "the server is in draining mode") + // During restore the server may be in draining mode, or it may be + // transiently unreachable (connection reset, TLS handshake failure, + // gRPC Unavailable, etc.). All of these are expected and retriable. + errMsg := err.Error() + transient := strings.Contains(errMsg, "the server is in draining mode") || + strings.Contains(errMsg, "Unavailable") || + strings.Contains(errMsg, "connection reset") || + strings.Contains(errMsg, "connection refused") || + strings.Contains(errMsg, "transport") || + strings.Contains(errMsg, "EOF") || + strings.Contains(errMsg, "overloaded") || + strings.Contains(errMsg, "context canceled") || + strings.Contains(errMsg, "Please retry") + if !transient { + require.Fail(t, "unexpected error while waiting for restore", + "error: %v", err) + } numSuccess = 0 } // Apply restore works differently with race enabled. // We are seeing delays in apply proposals hence failure of queries. if numSuccess == 10 { - // The server has been responsive three times in a row. + // The server has been responsive ten times in a row. break } time.Sleep(1 * time.Second) } + require.GreaterOrEqual(t, numSuccess, 10, + "timed out waiting for server to exit draining mode after restore") } // GetPredicateValues reads the specified p directory and returns the values for the given From b4081805fb6b5f923674f65c6ede89846b172324 Mon Sep 17 00:00:00 2001 From: Michael Welles Date: Wed, 25 Feb 2026 00:16:51 -0500 Subject: [PATCH 14/18] fix(test): add Docker memory limits and cache flags to dgraph docker-compose Add deploy memory limits (zeros: 512M, alphas: 2048M, minio: 512M) and --cache "size-mb=1024" to all alpha commands in the main dgraph test cluster docker-compose file, matching the changes in the online-restore compose file. Prevents OOM kills on memory-constrained Docker Desktop VMs. --- dgraph/docker-compose.yml | 89 ++++++++++++++++++++++++++++----------- 1 file changed, 65 insertions(+), 24 deletions(-) diff --git a/dgraph/docker-compose.yml b/dgraph/docker-compose.yml index 8bf64de8798..4e16185b4cf 100644 --- a/dgraph/docker-compose.yml +++ b/dgraph/docker-compose.yml @@ -9,6 +9,10 @@ services: labels: cluster: test service: zero + deploy: + resources: + limits: + memory: 512M volumes: - type: bind source: ${LINUX_GOBIN:-$GOPATH/bin} @@ -30,6 +34,10 @@ services: labels: cluster: test service: zero + deploy: + resources: + limits: + memory: 512M volumes: - type: bind source: ${LINUX_GOBIN:-$GOPATH/bin} @@ -50,6 +58,10 @@ services: labels: cluster: test service: zero + deploy: + resources: + limits: + memory: 512M volumes: - type: bind source: ${LINUX_GOBIN:-$GOPATH/bin} @@ -62,6 +74,10 @@ services: alpha1: image: dgraph/dgraph:local working_dir: /data/alpha1 + deploy: + resources: + limits: + memory: 2048M volumes: - type: bind source: ${LINUX_GOBIN:-$GOPATH/bin} @@ -82,16 +98,21 @@ services: cluster: test service: alpha command: - /gobin/dgraph ${COVERAGE_OUTPUT} alpha --telemetry "reports=false;" --encryption - "key-file=/dgraph-enc/enc-key;" --my=alpha1:7080 --zero=zero1:5080,zero2:5080,zero3:5080 - --expose_trace --profile_mode block --block_rate 10 --logtostderr -v=2 --security - "whitelist=0.0.0.0/0;" --acl "secret-file=/dgraph-acl/hmac-secret; access-ttl=20s;" + /gobin/dgraph ${COVERAGE_OUTPUT} alpha --cache "size-mb=1024;" --telemetry "reports=false;" + --encryption "key-file=/dgraph-enc/enc-key;" --my=alpha1:7080 + --zero=zero1:5080,zero2:5080,zero3:5080 --expose_trace --profile_mode block --block_rate 10 + --logtostderr -v=2 --security "whitelist=0.0.0.0/0;" --acl + "secret-file=/dgraph-acl/hmac-secret; access-ttl=20s;" alpha2: image: dgraph/dgraph:local working_dir: /data/alpha2 depends_on: - alpha1 + deploy: + resources: + limits: + memory: 2048M volumes: - type: bind source: ${LINUX_GOBIN:-$GOPATH/bin} @@ -112,16 +133,20 @@ services: cluster: test service: alpha command: - /gobin/dgraph ${COVERAGE_OUTPUT} alpha --encryption "key-file=/dgraph-enc/enc-key;" - --my=alpha2:7080 --zero=zero1:5080,zero2:5080,zero3:5080 --expose_trace --profile_mode block - --block_rate 10 --logtostderr -v=2 --security "whitelist=0.0.0.0/0;" --acl - "secret-file=/dgraph-acl/hmac-secret; access-ttl=20s;" + /gobin/dgraph ${COVERAGE_OUTPUT} alpha --cache "size-mb=1024;" --encryption + "key-file=/dgraph-enc/enc-key;" --my=alpha2:7080 --zero=zero1:5080,zero2:5080,zero3:5080 + --expose_trace --profile_mode block --block_rate 10 --logtostderr -v=2 --security + "whitelist=0.0.0.0/0;" --acl "secret-file=/dgraph-acl/hmac-secret; access-ttl=20s;" alpha3: image: dgraph/dgraph:local working_dir: /data/alpha3 depends_on: - alpha2 + deploy: + resources: + limits: + memory: 2048M volumes: - type: bind source: ${LINUX_GOBIN:-$GOPATH/bin} @@ -142,16 +167,20 @@ services: cluster: test service: alpha command: - /gobin/dgraph ${COVERAGE_OUTPUT} alpha --encryption "key-file=/dgraph-enc/enc-key;" - --my=alpha3:7080 --zero=zero1:5080,zero2:5080,zero3:5080 --expose_trace --profile_mode block - --block_rate 10 --logtostderr -v=2 --security "whitelist=0.0.0.0/0;" --acl - "secret-file=/dgraph-acl/hmac-secret; access-ttl=20s;" + /gobin/dgraph ${COVERAGE_OUTPUT} alpha --cache "size-mb=1024;" --encryption + "key-file=/dgraph-enc/enc-key;" --my=alpha3:7080 --zero=zero1:5080,zero2:5080,zero3:5080 + --expose_trace --profile_mode block --block_rate 10 --logtostderr -v=2 --security + "whitelist=0.0.0.0/0;" --acl "secret-file=/dgraph-acl/hmac-secret; access-ttl=20s;" alpha4: image: dgraph/dgraph:local working_dir: /data/alpha4 depends_on: - alpha3 + deploy: + resources: + limits: + memory: 2048M volumes: - type: bind source: ${LINUX_GOBIN:-$GOPATH/bin} @@ -172,16 +201,20 @@ services: cluster: test service: alpha command: - /gobin/dgraph ${COVERAGE_OUTPUT} alpha --encryption "key-file=/dgraph-enc/enc-key;" - --my=alpha4:7080 --zero=zero1:5080,zero2:5080,zero3:5080 --expose_trace --profile_mode block - --block_rate 10 --logtostderr -v=2 --security "whitelist=0.0.0.0/0;" --acl - "secret-file=/dgraph-acl/hmac-secret; access-ttl=20s;" + /gobin/dgraph ${COVERAGE_OUTPUT} alpha --cache "size-mb=1024;" --encryption + "key-file=/dgraph-enc/enc-key;" --my=alpha4:7080 --zero=zero1:5080,zero2:5080,zero3:5080 + --expose_trace --profile_mode block --block_rate 10 --logtostderr -v=2 --security + "whitelist=0.0.0.0/0;" --acl "secret-file=/dgraph-acl/hmac-secret; access-ttl=20s;" alpha5: image: dgraph/dgraph:local working_dir: /data/alpha5 depends_on: - alpha4 + deploy: + resources: + limits: + memory: 2048M volumes: - type: bind source: ${LINUX_GOBIN:-$GOPATH/bin} @@ -202,16 +235,20 @@ services: cluster: test service: alpha command: - /gobin/dgraph ${COVERAGE_OUTPUT} alpha --encryption "key-file=/dgraph-enc/enc-key;" - --my=alpha5:7080 --zero=zero1:5080,zero2:5080,zero3:5080 --expose_trace --profile_mode block - --block_rate 10 --logtostderr -v=2 --security "whitelist=0.0.0.0/0;" --acl - "secret-file=/dgraph-acl/hmac-secret; access-ttl=20s;" + /gobin/dgraph ${COVERAGE_OUTPUT} alpha --cache "size-mb=1024;" --encryption + "key-file=/dgraph-enc/enc-key;" --my=alpha5:7080 --zero=zero1:5080,zero2:5080,zero3:5080 + --expose_trace --profile_mode block --block_rate 10 --logtostderr -v=2 --security + "whitelist=0.0.0.0/0;" --acl "secret-file=/dgraph-acl/hmac-secret; access-ttl=20s;" alpha6: image: dgraph/dgraph:local working_dir: /data/alpha6 depends_on: - alpha5 + deploy: + resources: + limits: + memory: 2048M volumes: - type: bind source: ${LINUX_GOBIN:-$GOPATH/bin} @@ -232,10 +269,10 @@ services: cluster: test service: alpha command: - /gobin/dgraph ${COVERAGE_OUTPUT} alpha --encryption "key-file=/dgraph-enc/enc-key;" - --my=alpha6:7080 --zero=zero1:5080,zero2:5080,zero3:5080 --expose_trace --profile_mode block - --block_rate 10 --logtostderr -v=2 --security "whitelist=0.0.0.0/0;" --acl - "secret-file=/dgraph-acl/hmac-secret; access-ttl=20s;" + /gobin/dgraph ${COVERAGE_OUTPUT} alpha --cache "size-mb=1024;" --encryption + "key-file=/dgraph-enc/enc-key;" --my=alpha6:7080 --zero=zero1:5080,zero2:5080,zero3:5080 + --expose_trace --profile_mode block --block_rate 10 --logtostderr -v=2 --security + "whitelist=0.0.0.0/0;" --acl "secret-file=/dgraph-acl/hmac-secret; access-ttl=20s;" minio: image: minio/minio:latest @@ -246,4 +283,8 @@ services: - 9001 labels: cluster: test + deploy: + resources: + limits: + memory: 512M command: minio server /data/minio --address :9001 From b8b5ec9ce383c278e56b415516feb41ad85b9359 Mon Sep 17 00:00:00 2001 From: Michael Welles Date: Wed, 25 Feb 2026 01:19:10 -0500 Subject: [PATCH 15/18] fix(lint): resolve shellcheck SC2312 in check-cross-compiler.sh Capture get_os() output in a variable before using it in conditionals, preventing the return value from being masked by [[ ]]. Reuse the variable in the later case statement. --- t/scripts/check-cross-compiler.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/t/scripts/check-cross-compiler.sh b/t/scripts/check-cross-compiler.sh index d59947ef397..d050d51b4d6 100755 --- a/t/scripts/check-cross-compiler.sh +++ b/t/scripts/check-cross-compiler.sh @@ -57,7 +57,9 @@ install_cross_compiler_macos() { main() { # Cross-compiler is only needed on non-Linux systems - if [[ "$(get_os)" == "Linux" ]]; then + local os + os="$(get_os)" + if [[ ${os} == "Linux" ]]; then exit 0 fi @@ -85,7 +87,7 @@ main() { echo "" err "Please install manually:" - case "$(get_os)" in + case "${os}" in Darwin) local formula formula="$(get_brew_formula)" From cd2029a5b0f8b6873c64f70667a955ff9bbb6fd1 Mon Sep 17 00:00:00 2001 From: Michael Welles Date: Wed, 25 Feb 2026 13:01:36 -0500 Subject: [PATCH 16/18] refactor(test): split suites into integration/systest-heavy and add true unit mode Restructure test suites to separate lightweight from resource-intensive tests: - Add `integration` suite as the new default (replaces old `unit,systest,core`), excluding ldbc, load, and systest-heavy packages - Add `systest-baseline` and `systest-heavy` sub-suites; `systest` runs both - Add `heavyPackages` list for resource-intensive tests (minio, encryption, tracing, online-restore) that can OOM on macOS Docker Desktop - Make `unit` suite truly unit-only: no Docker cluster, no `--tags=integration`, skips custom-cluster packages entirely - Add `make test-integration` and `make test-integration-heavy` targets - Rename `make test-full` to `make test-all`; remove `test-suite`, `test-ldbc`, `test-load` targets (use `make test SUITE=...` instead) - Update CONTRIBUTING.md, TESTING.md, and Makefile help text to match --- CONTRIBUTING.md | 12 ++++--- Makefile | 42 ++++++++++------------ TESTING.md | 77 +++++++++++++++++++++------------------- t/t.go | 94 +++++++++++++++++++++++++++++++++++++++---------- 4 files changed, 142 insertions(+), 83 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index f11cb5f8ddb..e38d3c739f7 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -148,16 +148,18 @@ The simplest way to run tests is via Make: # First-time setup: install tool dependencies make setup -# Run default tests (~30 min): unit, systest, core suites + integration2 +# Run default tests (~30 min): integration suite + integration2 make test # Run every test in the repo -make test-full +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 diff --git a/Makefile b/Makefile index 37116cc1eea..b023cebf99a 100644 --- a/Makefile +++ b/Makefile @@ -93,7 +93,7 @@ setup: ## Install all test dependencies automatically $(MAKE) deps AUTO_INSTALL=true .PHONY: test -test: dgraph-installed local-image ## Run tests (default: unit,systest,core + integration2) +test: dgraph-installed local-image ## Run tests (default: integration + integration2) ifdef TAGS @echo "Running tests with tags: $(TAGS)" go test -v --tags="$(TAGS)" \ @@ -115,8 +115,8 @@ 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 suites: unit, systest, core" - $(MAKE) -C t test args="--suite=unit,systest,core $(if $(PKG),--pkg=\"$(PKG)\") $(if $(TEST),--test=\"$(TEST)\") $(if $(TIMEOUT),--timeout=$(TIMEOUT))" + @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)") \ @@ -124,15 +124,16 @@ else endif endif -.PHONY: test-suite -test-suite: ## Run t/ runner suite (default: all). Ex: make test-suite SUITE=unit - @SUITE=$(or $(SUITE),all) $(MAKE) test - .PHONY: test-unit -test-unit: ## Unit tests (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)) @@ -149,10 +150,15 @@ test-upgrade: ## Upgrade tests (i.e. 'make test TAGS=upgrade') @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)) @@ -163,19 +169,9 @@ 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') - $(if $(filter command line,$(origin SUITE)),$(error SUITE= cannot be passed to test-ldbc; use 'make test SUITE=...' instead)) - @SUITE=ldbc $(MAKE) test - -.PHONY: test-load -test-load: ## Heavy load tests (i.e. 'make test SUITE=load') - $(if $(filter command line,$(origin SUITE)),$(error SUITE= cannot be passed to test-load; use 'make test SUITE=...' instead)) - @SUITE=load $(MAKE) test - -.PHONY: test-full -test-full: ## Every test: all suites + integration2 + upgrade + fuzz - $(MAKE) test-suite +.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 @@ -247,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 (default: unit,systest,core + integration2)" + @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)" diff --git a/TESTING.md b/TESTING.md index e3e9c155830..a25a2d6d12f 100644 --- a/TESTING.md +++ b/TESTING.md @@ -307,24 +307,24 @@ If both pass, you're ready to run all test types! The simplest way to run tests: ```bash -# Run default tests (~30 min): unit, systest, core suites + integration2 +# Run default tests (~30 min): integration suite + integration2 make test # Run every test in the repo (all suites + all tag-based tests + fuzz) -make test-full +make test-all # Common shortcuts (run 'make help' for full list) -make test-suite # All t/ runner suites (default), or: make test-suite SUITE=unit -make test-unit # Unit tests (i.e. 'make test SUITE=unit') -make test-core # Core tests (i.e. 'make test SUITE=core') -make test-systest # System integration tests (i.e. 'make test SUITE=systest') -make test-vector # Vector search tests (i.e. 'make test SUITE=vector') -make test-ldbc # LDBC benchmark tests (i.e. 'make test SUITE=ldbc') -make test-load # Heavy load tests (i.e. 'make test SUITE=load') -make test-integration2 # Integration2 tests via dgraphtest (i.e. 'make test TAGS=integration2') -make test-upgrade # Upgrade tests (i.e. 'make test TAGS=upgrade') -make test-fuzz # Fuzz tests (i.e. 'make test FUZZ=1') -make test-benchmark # Go benchmarks (i.e. 'go test -bench') +make test-unit # True unit tests only — no Docker, no build tags +make test-integration # Integration tests via t/ runner with Docker (SUITE=integration) +make test-integration-heavy # All heavy tests: systest-heavy + ldbc + load +make test-core # Core tests (i.e. 'make test SUITE=core') +make test-systest # All systest packages: systest-baseline + systest-heavy +make test-vector # Vector search tests (i.e. 'make test SUITE=vector') +make test-integration2 # Integration2 tests via dgraphtest (i.e. 'make test TAGS=integration2') +make test-upgrade # Upgrade tests (i.e. 'make test TAGS=upgrade') +make test-fuzz # Fuzz tests (i.e. 'make test FUZZ=1') +make test-all # Every test: all t/ suites + integration2 + upgrade + fuzz +make test-benchmark # Go benchmarks (i.e. 'go test -bench') ``` Run `make help` to see all available targets, variables, and dynamically discovered SUITE/TAGS @@ -336,7 +336,7 @@ For more control, pass variables to `make test`: | Variable | Purpose | Example | | ---------- | ---------------------------------- | ------------------------------- | -| `SUITE` | Select t/ runner suite | `make test SUITE=systest` | +| `SUITE` | Select t/ runner suite | `make test SUITE=integration` | | `TAGS` | Go build tags - bypasses t/ runner | `make test TAGS=integration2` | | `PKG` | Limit to specific package | `make test PKG=systest/export` | | `TEST` | Run specific test function | `make test TEST=TestGQLSchema` | @@ -345,7 +345,7 @@ For more control, pass variables to `make test`: | `FUZZTIME` | Fuzz duration per package | `make test FUZZ=1 FUZZTIME=60s` | **Precedence:** `TAGS` > `FUZZ` > `SUITE` > default (first match wins). When no variable is set, -`make test` runs suites `unit,systest,core` plus `integration2`. +`make test` runs `integration` suite (via t/ runner) plus `integration2`. ### Examples @@ -542,15 +542,18 @@ Docker Compose and runs tests tagged with `integration`. A suite is a named group of test packages that can be run together with the `--suite` flag. -| Suite | Purpose | Packages/Tests Included | -| --------- | ------------------------------------- | --------------------------------------------------------------------------------------------- | -| `unit` | Default suite for regular development | All packages except ldbc and load (includes query, mutation, schema, GraphQL, ACL, worker) | -| `core` | Core Dgraph functionality | Query, mutation, schema, GraphQL e2e, ACL, TLS, worker (excludes systest, ldbc, vector, load) | -| `systest` | Real workflows and system-level tests | Backup/restore, export, multi-tenancy, online-restore, audit, CDC, group-delete | -| `vector` | Vector search functionality | Vector index, similarity search, HNSW, vector backup/restore (`systest/vector/`) | -| `ldbc` | Benchmark queries | LDBC benchmark suite (`systest/ldbc/`) | -| `load` | Heavy data loading scenarios | 21million, 1million, bulk_live, bgindex, bulkloader | -| `all` | Everything | Runs all test suites | +| Suite | Purpose | Packages/Tests Included | +| ------------------ | -------------------------------------------------- | ------------------------------------------------------------------------------------- | +| `unit` | True unit tests only | All packages except ldbc/load — no Docker, no `--tags=integration` | +| `integration` | Default suite — all integration tests except heavy | Everything except ldbc, load, and systest-heavy (replaces old `unit`) | +| `core` | Core Dgraph functionality | Query, mutation, schema, GraphQL e2e, ACL, TLS, worker | +| `systest` | All system integration tests | Both systest-baseline + systest-heavy (backward compatible) | +| `systest-baseline` | Lean systest for daily dev | backup/filesystem, export, multi-tenancy, audit, CDC, group-delete, plugin, ... | +| `systest-heavy` | Resource-intensive systests | backup/minio\*, backup/encryption, backup/advanced-scenarios, tracing, online-restore | +| `vector` | Vector search functionality | Vector index, similarity search, HNSW | +| `ldbc` | Benchmark queries | LDBC benchmark suite | +| `load` | Heavy data loading scenarios | 21million, 1million, bulk_live, bgindex, bulkloader | +| `all` | Everything in t/ runner | All packages | ### Docker Compose Discovery @@ -585,16 +588,16 @@ cd t && go build . ### Key Flags -| Flag | Description | -| ------------- | ------------------------------------------------------------------- | -| `--suite=X` | Select test suite(s): all, ldbc, load, unit, systest, vector, core | -| `--pkg=X` | Run specific package | -| `--test=X` | Run specific test function | -| `--timeout=X` | Per-package timeout (e.g. 60m, 2h). Default: 30m (180m with --race) | -| `-j=N` | Concurrency (default: 1) | -| `--keep` | Keep cluster running after tests | -| `-r` | Remove all test containers | -| `--skip-slow` | Skip slow packages | +| Flag | Description | +| ------------- | ---------------------------------------------------------------------------------------------------------------- | +| `--suite=X` | Select test suite(s): all, ldbc, load, unit, integration, systest, systest-baseline, systest-heavy, vector, core | +| `--pkg=X` | Run specific package | +| `--test=X` | Run specific test function | +| `--timeout=X` | Per-package timeout (e.g. 60m, 2h). Default: 30m (180m with --race) | +| `-j=N` | Concurrency (default: 1) | +| `--keep` | Keep cluster running after tests | +| `-r` | Remove all test containers | +| `--skip-slow` | Skip slow packages | --- @@ -1294,8 +1297,8 @@ The following items from the original wishlist have been implemented: - **✅ Unified test interface:** A single `make test` entry point that accepts arguments to run any test type (unit, integration, integration2, upgrade, fuzz) with environment variables for control. - The default (`make test` with no args) runs `unit,systest,core` suites plus `integration2` for a - fast feedback loop (~30 min). Use `make test-full` to run all tests. + The default (`make test` with no args) runs `integration` suite plus `integration2` for a fast + feedback loop (~30 min). Use `make test-all` to run every test. - **✅ Example commands that "just work":** The following now work as expected: @@ -1303,7 +1306,7 @@ The following items from the original wishlist have been implemented: make test SUITE=systest make test FUZZ=1 PKG=dql make test TAGS=upgrade PKG=acl - make test-suite SUITE=systest PKG=systest/plugin + make test SUITE=systest PKG=systest/plugin ``` ### Remaining Ideas diff --git a/t/t.go b/t/t.go index 5f73e015fa1..59ed9f3a687 100644 --- a/t/t.go +++ b/t/t.go @@ -86,9 +86,13 @@ var ( "Don't bring up a cluster, instead use an existing cluster with this prefix.") skipSlow = pflag.BoolP("skip-slow", "s", false, "If true, don't run tests on slow packages.") - suite = pflag.String("suite", "unit", "This flag is used to specify which "+ - "test suites to run. Possible values are all, ldbc, load, unit, systest, vector, core. Multiple suites can be "+ - "selected like --suite=ldbc,load") + suite = pflag.String("suite", "integration", "This flag is used to specify which "+ + "test suites to run. Possible values are all, ldbc, load, unit, integration, systest, "+ + "systest-baseline, systest-heavy, vector, core. Multiple suites can be "+ + "selected like --suite=ldbc,load. "+ + "unit = true unit tests only (no Docker, no integration tag). "+ + "integration = everything except ldbc, load, and systest-heavy (with Docker). "+ + "systest = systest-baseline + systest-heavy.") tmp = pflag.String("tmp", "", "Temporary directory used to download data.") downloadResources = pflag.BoolP("download", "d", true, "Flag to specify whether to download resources or not") @@ -435,7 +439,10 @@ func gotestsumBin() string { func runTestsFor(ctx context.Context, pkg, prefix string, xmlFile string) error { args := []string{gotestsumBin(), "--junitfile", xmlFile, "--format", "standard-verbose", "--max-fails", "1", "--", - "-v", "-failfast", "-tags=integration"} + "-v", "-failfast"} + if !isUnitOnly() { + args = append(args, "-tags=integration") + } switch { case *testTimeout != "": args = append(args, "-timeout", *testTimeout) @@ -546,7 +553,7 @@ func runTests(taskCh chan task, closer *z.Closer) error { var started, stopped bool start := func() error { - if len(*useExisting) > 0 || started { + if isUnitOnly() || len(*useExisting) > 0 || started { return nil } err := startCluster(defaultCompose, prefix) @@ -559,7 +566,7 @@ func runTests(taskCh chan task, closer *z.Closer) error { } stop := func() { - if *keepCluster || stopped { + if isUnitOnly() || *keepCluster || stopped { return } wg.Add(1) @@ -678,14 +685,21 @@ func runTests(taskCh chan task, closer *z.Closer) error { // If we only need to run custom cluster tests, then skip this one. continue } - if err := resumeDefault(); err != nil { - return err + if !isUnitOnly() { + if err := resumeDefault(); err != nil { + return err + } } if err = runTestsFor(ctx, task.pkg.ID, prefix, xmlFile); err != nil { // fmt.Printf("ERROR for package: %s. Err: %v\n", task.pkg.ID, err) return err } } else { + if isUnitOnly() { + // Skip custom-cluster packages entirely in unit mode — + // they only contain integration tests. + continue + } // Pause the default cluster to free memory for the custom cluster. pauseDefault() // we are not using err variable here because we dont want to @@ -861,7 +875,13 @@ func getPackages() []task { } return out } - cfg := &packages.Config{BuildFlags: []string{"-tags=integration"}} + // When running unit-only, don't add --tags=integration so that only true + // unit tests (without //go:build integration) are discovered and compiled. + var buildFlags []string + if !isUnitOnly() { + buildFlags = []string{"-tags=integration"} + } + cfg := &packages.Config{BuildFlags: buildFlags} pkgs, err := packages.Load(cfg, *baseDir+"/...") x.Check(err) @@ -981,6 +1001,22 @@ var loadPackages = []string{ "/dgraph/cmd/bulk/systest", } +// heavyPackages lists resource-intensive systest packages separated into +// the systest-heavy suite. These spin up large Docker clusters (20-112 +// services) and can cause OOM on macOS Docker Desktop. +// Use --suite=systest-heavy to run them, or --suite=systest for both. +var heavyPackages = []string{ + "/systest/backup/minio", + "/systest/backup/minio-large", + "/systest/backup/nfs-backup", + "/systest/backup/advanced-scenarios/", + "/systest/backup/encryption", + "/systest/backup/multi-tenancy", + "/systest/tracing/jaeger1", + "/systest/tracing/jaeger2", + "/systest/online-restore", +} + func testSuiteContains(suite string) bool { for _, str := range testsuite { if suite == str { @@ -999,6 +1035,13 @@ func testSuiteContainsAny(suites ...string) bool { return false } +// isUnitOnly returns true when the suite is exactly "unit" with nothing else. +// In unit-only mode, the runner skips Docker clusters and --tags=integration, +// running only tests that don't require the integration build tag. +func isUnitOnly() bool { + return len(testsuite) == 1 && testsuite[0] == "unit" +} + func isValidPackageForSuite(pkg string) bool { valid := false if testSuiteContains("all") { @@ -1010,22 +1053,28 @@ func isValidPackageForSuite(pkg string) bool { if testSuiteContains("load") { valid = valid || isLoadPackage(pkg) } + // "unit" = true unit tests (no --tags=integration, same package scope as integration) if testSuiteContains("unit") { - valid = valid || (!isLoadPackage(pkg) && !isLDBCPackage(pkg)) + valid = valid || (!isLoadPackage(pkg) && !isLDBCPackage(pkg) && !isHeavyPackage(pkg)) + } + // "integration" replaces old "unit" — everything except ldbc, load, and systest-heavy + if testSuiteContains("integration") { + valid = valid || (!isLoadPackage(pkg) && !isLDBCPackage(pkg) && !isHeavyPackage(pkg)) } if testSuiteContains("vector") { valid = valid || isVectorPackage(pkg) } - if testSuiteContains("systest") { - valid = valid || isSystestPackage(pkg) + // "systest" = both systest-baseline and systest-heavy (backward compatible) + if testSuiteContainsAny("systest", "systest-baseline") { + valid = valid || (isSystestPackage(pkg) && !isHeavyPackage(pkg)) + } + if testSuiteContainsAny("systest", "systest-heavy") { + valid = valid || isHeavyPackage(pkg) } if testSuiteContains("core") { valid = valid || isCorePackage(pkg) } - if valid { - return valid - } - return false + return valid } func isLoadPackage(pkg string) bool { @@ -1063,6 +1112,15 @@ func isVectorPackage(pkg string) bool { return strings.HasSuffix(pkg, "/vector") } +func isHeavyPackage(pkg string) bool { + for _, p := range heavyPackages { + if strings.HasSuffix(pkg, p) || strings.Contains(pkg, p) { + return true + } + } + return false +} + var datafiles = map[string]string{ "1million-noindex.schema": "https://raw.githubusercontent.com/dgraph-io/dgraph-benchmarks/refs/heads/main/data/1million-noindex.schema", "1million.schema": "https://raw.githubusercontent.com/dgraph-io/dgraph-benchmarks/refs/heads/main/data/1million.schema", @@ -1370,7 +1428,7 @@ func run() error { func validateAllowed(testSuite []string) { - allowed := []string{"all", "ldbc", "load", "unit", "systest", "vector", "core"} + allowed := []string{"all", "ldbc", "load", "unit", "integration", "systest", "systest-baseline", "systest-heavy", "vector", "core"} for _, str := range testSuite { onlyAllowed := false for _, allowedStr := range allowed { @@ -1379,7 +1437,7 @@ func validateAllowed(testSuite []string) { } } if !onlyAllowed { - log.Fatalf("Allowed options for suite are only all, load, ldbc or unit; passed in %+v", testSuite) + log.Fatalf("Allowed options for suite are: %s; passed in %+v", strings.Join(allowed, ", "), testSuite) } } } From c81aad99d3cf165acb57b09251f836d62a55a9fa Mon Sep 17 00:00:00 2001 From: Michael Welles Date: Wed, 25 Feb 2026 13:21:46 -0500 Subject: [PATCH 17/18] fix(test): add retry logic to import client for transient Raft errors MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The TestImportApis/SingleGroupShutOneAlpha integration2 test was flaking because initiateSnapshotStream would fail immediately when the Dgraph server returned "overloaded with pending proposals" during Raft membership changes. Add exponential backoff retry (1s→10s cap, 60s max) for transient "overloaded" errors while preserving fast failure for non-retryable errors like connectivity loss. --- dgraph/cmd/dgraphimport/import_client.go | 48 +++++++++++++++++++++--- 1 file changed, 42 insertions(+), 6 deletions(-) diff --git a/dgraph/cmd/dgraphimport/import_client.go b/dgraph/cmd/dgraphimport/import_client.go index 1297566378e..73e40b568d4 100644 --- a/dgraph/cmd/dgraphimport/import_client.go +++ b/dgraph/cmd/dgraphimport/import_client.go @@ -13,6 +13,8 @@ import ( "math" "os" "path/filepath" + "strings" + "time" "github.com/dgraph-io/badger/v4" "github.com/dgraph-io/dgo/v250" @@ -55,19 +57,53 @@ func Import(ctx context.Context, connectionString string, bulkOutDir string) err return streamSnapshot(ctx, dg, bulkOutDir, resp.Groups) } +// isRetryableError returns true for transient errors that may resolve after a brief wait, +// such as Raft proposal backlogs during membership changes. +func isRetryableError(err error) bool { + if err == nil { + return false + } + msg := err.Error() + // Only retry errors that indicate the server is alive but temporarily busy. + // Do NOT retry connectivity errors ("unable to connect to the leader", + // "connection refused") as those may indicate a permanent quorum loss and + // would cause negative test cases to wait unnecessarily. + return strings.Contains(msg, "overloaded") +} + // initiateSnapshotStream initiates a snapshot stream session with the Dgraph server. +// It retries on transient errors (e.g. "overloaded with pending proposals") with +// exponential backoff up to 60 seconds total. func initiateSnapshotStream(ctx context.Context, dc api.DgraphClient) (*api.UpdateExtSnapshotStreamingStateResponse, error) { glog.Info("[import] Initiating external snapshot stream") req := &api.UpdateExtSnapshotStreamingStateRequest{ Start: true, } - resp, err := dc.UpdateExtSnapshotStreamingState(ctx, req) - if err != nil { - glog.Errorf("[import] failed to initiate external snapshot stream: %v", err) - return nil, fmt.Errorf("failed to initiate external snapshot stream: %v", err) + + const maxRetryDuration = 60 * time.Second + deadline := time.Now().Add(maxRetryDuration) + retryDelay := time.Second + + for { + resp, err := dc.UpdateExtSnapshotStreamingState(ctx, req) + if err == nil { + glog.Info("[import] External snapshot stream initiated successfully") + return resp, nil + } + + if !isRetryableError(err) || time.Now().After(deadline) { + glog.Errorf("[import] failed to initiate external snapshot stream: %v", err) + return nil, fmt.Errorf("failed to initiate external snapshot stream: %v", err) + } + + glog.Warningf("[import] transient error initiating snapshot stream, retrying in %v: %v", retryDelay, err) + select { + case <-ctx.Done(): + return nil, ctx.Err() + case <-time.After(retryDelay): + } + retryDelay = min(retryDelay*2, 10*time.Second) } - glog.Info("[import] External snapshot stream initiated successfully") - return resp, nil } // streamSnapshot takes a p directory and a set of group IDs and streams the data from the From 62728c97b5548f376c2a7f3ed1b7884079cae674 Mon Sep 17 00:00:00 2001 From: Michael Welles Date: Wed, 25 Feb 2026 13:43:03 -0500 Subject: [PATCH 18/18] revert: remove Docker memory limits and cache flags from compose files Remove deploy memory limits and --cache "size-mb=1024" flags from dgraph/docker-compose.yml and systest/online-restore/docker-compose.yml. These just shift OOM kills from the OS to Docker without actually solving the underlying resource problem, and they add noise to the compose files. --- dgraph/docker-compose.yml | 89 ++++++----------------- systest/online-restore/docker-compose.yml | 52 +++---------- 2 files changed, 36 insertions(+), 105 deletions(-) diff --git a/dgraph/docker-compose.yml b/dgraph/docker-compose.yml index 4e16185b4cf..8bf64de8798 100644 --- a/dgraph/docker-compose.yml +++ b/dgraph/docker-compose.yml @@ -9,10 +9,6 @@ services: labels: cluster: test service: zero - deploy: - resources: - limits: - memory: 512M volumes: - type: bind source: ${LINUX_GOBIN:-$GOPATH/bin} @@ -34,10 +30,6 @@ services: labels: cluster: test service: zero - deploy: - resources: - limits: - memory: 512M volumes: - type: bind source: ${LINUX_GOBIN:-$GOPATH/bin} @@ -58,10 +50,6 @@ services: labels: cluster: test service: zero - deploy: - resources: - limits: - memory: 512M volumes: - type: bind source: ${LINUX_GOBIN:-$GOPATH/bin} @@ -74,10 +62,6 @@ services: alpha1: image: dgraph/dgraph:local working_dir: /data/alpha1 - deploy: - resources: - limits: - memory: 2048M volumes: - type: bind source: ${LINUX_GOBIN:-$GOPATH/bin} @@ -98,21 +82,16 @@ services: cluster: test service: alpha command: - /gobin/dgraph ${COVERAGE_OUTPUT} alpha --cache "size-mb=1024;" --telemetry "reports=false;" - --encryption "key-file=/dgraph-enc/enc-key;" --my=alpha1:7080 - --zero=zero1:5080,zero2:5080,zero3:5080 --expose_trace --profile_mode block --block_rate 10 - --logtostderr -v=2 --security "whitelist=0.0.0.0/0;" --acl - "secret-file=/dgraph-acl/hmac-secret; access-ttl=20s;" + /gobin/dgraph ${COVERAGE_OUTPUT} alpha --telemetry "reports=false;" --encryption + "key-file=/dgraph-enc/enc-key;" --my=alpha1:7080 --zero=zero1:5080,zero2:5080,zero3:5080 + --expose_trace --profile_mode block --block_rate 10 --logtostderr -v=2 --security + "whitelist=0.0.0.0/0;" --acl "secret-file=/dgraph-acl/hmac-secret; access-ttl=20s;" alpha2: image: dgraph/dgraph:local working_dir: /data/alpha2 depends_on: - alpha1 - deploy: - resources: - limits: - memory: 2048M volumes: - type: bind source: ${LINUX_GOBIN:-$GOPATH/bin} @@ -133,20 +112,16 @@ services: cluster: test service: alpha command: - /gobin/dgraph ${COVERAGE_OUTPUT} alpha --cache "size-mb=1024;" --encryption - "key-file=/dgraph-enc/enc-key;" --my=alpha2:7080 --zero=zero1:5080,zero2:5080,zero3:5080 - --expose_trace --profile_mode block --block_rate 10 --logtostderr -v=2 --security - "whitelist=0.0.0.0/0;" --acl "secret-file=/dgraph-acl/hmac-secret; access-ttl=20s;" + /gobin/dgraph ${COVERAGE_OUTPUT} alpha --encryption "key-file=/dgraph-enc/enc-key;" + --my=alpha2:7080 --zero=zero1:5080,zero2:5080,zero3:5080 --expose_trace --profile_mode block + --block_rate 10 --logtostderr -v=2 --security "whitelist=0.0.0.0/0;" --acl + "secret-file=/dgraph-acl/hmac-secret; access-ttl=20s;" alpha3: image: dgraph/dgraph:local working_dir: /data/alpha3 depends_on: - alpha2 - deploy: - resources: - limits: - memory: 2048M volumes: - type: bind source: ${LINUX_GOBIN:-$GOPATH/bin} @@ -167,20 +142,16 @@ services: cluster: test service: alpha command: - /gobin/dgraph ${COVERAGE_OUTPUT} alpha --cache "size-mb=1024;" --encryption - "key-file=/dgraph-enc/enc-key;" --my=alpha3:7080 --zero=zero1:5080,zero2:5080,zero3:5080 - --expose_trace --profile_mode block --block_rate 10 --logtostderr -v=2 --security - "whitelist=0.0.0.0/0;" --acl "secret-file=/dgraph-acl/hmac-secret; access-ttl=20s;" + /gobin/dgraph ${COVERAGE_OUTPUT} alpha --encryption "key-file=/dgraph-enc/enc-key;" + --my=alpha3:7080 --zero=zero1:5080,zero2:5080,zero3:5080 --expose_trace --profile_mode block + --block_rate 10 --logtostderr -v=2 --security "whitelist=0.0.0.0/0;" --acl + "secret-file=/dgraph-acl/hmac-secret; access-ttl=20s;" alpha4: image: dgraph/dgraph:local working_dir: /data/alpha4 depends_on: - alpha3 - deploy: - resources: - limits: - memory: 2048M volumes: - type: bind source: ${LINUX_GOBIN:-$GOPATH/bin} @@ -201,20 +172,16 @@ services: cluster: test service: alpha command: - /gobin/dgraph ${COVERAGE_OUTPUT} alpha --cache "size-mb=1024;" --encryption - "key-file=/dgraph-enc/enc-key;" --my=alpha4:7080 --zero=zero1:5080,zero2:5080,zero3:5080 - --expose_trace --profile_mode block --block_rate 10 --logtostderr -v=2 --security - "whitelist=0.0.0.0/0;" --acl "secret-file=/dgraph-acl/hmac-secret; access-ttl=20s;" + /gobin/dgraph ${COVERAGE_OUTPUT} alpha --encryption "key-file=/dgraph-enc/enc-key;" + --my=alpha4:7080 --zero=zero1:5080,zero2:5080,zero3:5080 --expose_trace --profile_mode block + --block_rate 10 --logtostderr -v=2 --security "whitelist=0.0.0.0/0;" --acl + "secret-file=/dgraph-acl/hmac-secret; access-ttl=20s;" alpha5: image: dgraph/dgraph:local working_dir: /data/alpha5 depends_on: - alpha4 - deploy: - resources: - limits: - memory: 2048M volumes: - type: bind source: ${LINUX_GOBIN:-$GOPATH/bin} @@ -235,20 +202,16 @@ services: cluster: test service: alpha command: - /gobin/dgraph ${COVERAGE_OUTPUT} alpha --cache "size-mb=1024;" --encryption - "key-file=/dgraph-enc/enc-key;" --my=alpha5:7080 --zero=zero1:5080,zero2:5080,zero3:5080 - --expose_trace --profile_mode block --block_rate 10 --logtostderr -v=2 --security - "whitelist=0.0.0.0/0;" --acl "secret-file=/dgraph-acl/hmac-secret; access-ttl=20s;" + /gobin/dgraph ${COVERAGE_OUTPUT} alpha --encryption "key-file=/dgraph-enc/enc-key;" + --my=alpha5:7080 --zero=zero1:5080,zero2:5080,zero3:5080 --expose_trace --profile_mode block + --block_rate 10 --logtostderr -v=2 --security "whitelist=0.0.0.0/0;" --acl + "secret-file=/dgraph-acl/hmac-secret; access-ttl=20s;" alpha6: image: dgraph/dgraph:local working_dir: /data/alpha6 depends_on: - alpha5 - deploy: - resources: - limits: - memory: 2048M volumes: - type: bind source: ${LINUX_GOBIN:-$GOPATH/bin} @@ -269,10 +232,10 @@ services: cluster: test service: alpha command: - /gobin/dgraph ${COVERAGE_OUTPUT} alpha --cache "size-mb=1024;" --encryption - "key-file=/dgraph-enc/enc-key;" --my=alpha6:7080 --zero=zero1:5080,zero2:5080,zero3:5080 - --expose_trace --profile_mode block --block_rate 10 --logtostderr -v=2 --security - "whitelist=0.0.0.0/0;" --acl "secret-file=/dgraph-acl/hmac-secret; access-ttl=20s;" + /gobin/dgraph ${COVERAGE_OUTPUT} alpha --encryption "key-file=/dgraph-enc/enc-key;" + --my=alpha6:7080 --zero=zero1:5080,zero2:5080,zero3:5080 --expose_trace --profile_mode block + --block_rate 10 --logtostderr -v=2 --security "whitelist=0.0.0.0/0;" --acl + "secret-file=/dgraph-acl/hmac-secret; access-ttl=20s;" minio: image: minio/minio:latest @@ -283,8 +246,4 @@ services: - 9001 labels: cluster: test - deploy: - resources: - limits: - memory: 512M command: minio server /data/minio --address :9001 diff --git a/systest/online-restore/docker-compose.yml b/systest/online-restore/docker-compose.yml index 2218d41bf95..51a69f056ed 100644 --- a/systest/online-restore/docker-compose.yml +++ b/systest/online-restore/docker-compose.yml @@ -8,10 +8,6 @@ services: ports: - 8080 - 9080 - deploy: - resources: - limits: - memory: 4096M volumes: - type: bind source: ${LINUX_GOBIN:-$GOPATH/bin} @@ -35,8 +31,8 @@ services: read_only: true command: /gobin/dgraph ${COVERAGE_OUTPUT} alpha --my=alpha1:7080 --zero=zero1:5080 --logtostderr -v=2 - --cache "size-mb=1024;" --raft "idx=1;" --encryption "key-file=/data/keys/enc_key;" --security - "whitelist=0.0.0.0/0;" --tls "ca-cert=/dgraph-tls/ca.crt; server-cert=/dgraph-tls/node.crt; + --raft "idx=1;" --encryption "key-file=/data/keys/enc_key;" --security "whitelist=0.0.0.0/0;" + --tls "ca-cert=/dgraph-tls/ca.crt; server-cert=/dgraph-tls/node.crt; server-key=/dgraph-tls/node.key; internal-port=true; client-cert=/dgraph-tls/client.alpha1.crt; client-key=/dgraph-tls/client.alpha1.key;" alpha2: @@ -49,10 +45,6 @@ services: ports: - 8080 - 9080 - deploy: - resources: - limits: - memory: 4096M volumes: - type: bind source: ${LINUX_GOBIN:-$GOPATH/bin} @@ -76,8 +68,8 @@ services: read_only: true command: /gobin/dgraph ${COVERAGE_OUTPUT} alpha --my=alpha2:7080 --zero=zero1:5080 --logtostderr -v=2 - --cache "size-mb=1024;" --raft "idx=2;" --encryption "key-file=/data/keys/enc_key;" --security - "whitelist=0.0.0.0/0;" --tls "ca-cert=/dgraph-tls/ca.crt; server-cert=/dgraph-tls/node.crt; + --raft "idx=2;" --encryption "key-file=/data/keys/enc_key;" --security "whitelist=0.0.0.0/0;" + --tls "ca-cert=/dgraph-tls/ca.crt; server-cert=/dgraph-tls/node.crt; server-key=/dgraph-tls/node.key; internal-port=true; client-cert=/dgraph-tls/client.alpha2.crt; client-key=/dgraph-tls/client.alpha2.key;" alpha3: @@ -90,10 +82,6 @@ services: ports: - 8080 - 9080 - deploy: - resources: - limits: - memory: 4096M volumes: - type: bind source: ${LINUX_GOBIN:-$GOPATH/bin} @@ -117,8 +105,8 @@ services: read_only: true command: /gobin/dgraph ${COVERAGE_OUTPUT} alpha --my=alpha3:7080 --zero=zero1:5080 --logtostderr -v=2 - --cache "size-mb=1024;" --raft "idx=3;" --encryption "key-file=/data/keys/enc_key;" --security - "whitelist=0.0.0.0/0;" --tls "ca-cert=/dgraph-tls/ca.crt; server-cert=/dgraph-tls/node.crt; + --raft "idx=3;" --encryption "key-file=/data/keys/enc_key;" --security "whitelist=0.0.0.0/0;" + --tls "ca-cert=/dgraph-tls/ca.crt; server-cert=/dgraph-tls/node.crt; server-key=/dgraph-tls/node.key; internal-port=true; client-cert=/dgraph-tls/client.alpha3.crt; client-key=/dgraph-tls/client.alpha3.key;" alpha4: @@ -131,10 +119,6 @@ services: ports: - 8080 - 9080 - deploy: - resources: - limits: - memory: 4096M volumes: - type: bind source: ${LINUX_GOBIN:-$GOPATH/bin} @@ -158,8 +142,8 @@ services: read_only: true command: /gobin/dgraph ${COVERAGE_OUTPUT} alpha --my=alpha4:7080 --zero=zero1:5080 --logtostderr -v=2 - --cache "size-mb=1024;" --raft "idx=4;" --encryption "key-file=/data/keys/enc_key;" --security - "whitelist=0.0.0.0/0;" --tls "ca-cert=/dgraph-tls/ca.crt; server-cert=/dgraph-tls/node.crt; + --raft "idx=4;" --encryption "key-file=/data/keys/enc_key;" --security "whitelist=0.0.0.0/0;" + --tls "ca-cert=/dgraph-tls/ca.crt; server-cert=/dgraph-tls/node.crt; server-key=/dgraph-tls/node.key; internal-port=true; client-cert=/dgraph-tls/client.alpha4.crt; client-key=/dgraph-tls/client.alpha4.key;" alpha5: @@ -172,10 +156,6 @@ services: ports: - 8080 - 9080 - deploy: - resources: - limits: - memory: 4096M volumes: - type: bind source: ${LINUX_GOBIN:-$GOPATH/bin} @@ -199,8 +179,8 @@ services: read_only: true command: /gobin/dgraph ${COVERAGE_OUTPUT} alpha --my=alpha5:7080 --zero=zero1:5080 --logtostderr -v=2 - --cache "size-mb=1024;" --raft "idx=5;" --encryption "key-file=/data/keys/enc_key;" --security - "whitelist=0.0.0.0/0;" --tls "ca-cert=/dgraph-tls/ca.crt; server-cert=/dgraph-tls/node.crt; + --raft "idx=5;" --encryption "key-file=/data/keys/enc_key;" --security "whitelist=0.0.0.0/0;" + --tls "ca-cert=/dgraph-tls/ca.crt; server-cert=/dgraph-tls/node.crt; server-key=/dgraph-tls/node.key; internal-port=true; client-cert=/dgraph-tls/client.alpha5.crt; client-key=/dgraph-tls/client.alpha5.key;" alpha6: @@ -213,10 +193,6 @@ services: ports: - 8080 - 9080 - deploy: - resources: - limits: - memory: 4096M volumes: - type: bind source: ${LINUX_GOBIN:-$GOPATH/bin} @@ -240,8 +216,8 @@ services: read_only: true command: /gobin/dgraph ${COVERAGE_OUTPUT} alpha --my=alpha6:7080 --zero=zero1:5080 --logtostderr -v=2 - --cache "size-mb=1024;" --raft "idx=6;" --encryption "key-file=/data/keys/enc_key;" --security - "whitelist=0.0.0.0/0;" --tls "ca-cert=/dgraph-tls/ca.crt; server-cert=/dgraph-tls/node.crt; + --raft "idx=6;" --encryption "key-file=/data/keys/enc_key;" --security "whitelist=0.0.0.0/0;" + --tls "ca-cert=/dgraph-tls/ca.crt; server-cert=/dgraph-tls/node.crt; server-key=/dgraph-tls/node.key; internal-port=true; client-cert=/dgraph-tls/client.alpha6.crt; client-key=/dgraph-tls/client.alpha6.key;" zero1: @@ -252,10 +228,6 @@ services: ports: - 5080 - 6080 - deploy: - resources: - limits: - memory: 1024M volumes: - type: bind source: ${LINUX_GOBIN:-$GOPATH/bin}