Skip to content

Commit 54f6969

Browse files
author
Harshil Goel
authored
Merge branch 'main' into matthewmcneely/update-changelog-for-ngram
2 parents e78fb9a + 5d6928f commit 54f6969

57 files changed

Lines changed: 591 additions & 251 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci-dgraph-core-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ permissions:
2525
jobs:
2626
dgraph-core-tests:
2727
if: github.event.pull_request.draft == false
28-
runs-on: warp-ubuntu-latest-x64-4x
28+
runs-on: warp-ubuntu-latest-x64-16x
2929
timeout-minutes: 60
3030
steps:
3131
- uses: actions/checkout@v5

acl/acl_curl_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ func (asuite *AclTestSuite) TestCurlAuthorization() {
4949
return []string{"-H", fmt.Sprintf("X-Dgraph-AccessToken:%s", jwt),
5050
"--ipv4",
5151
"-H", "Content-Type: application/dql",
52-
"-d", query, testutil.SockAddrHttp + "/query"}
52+
"-d", query, testutil.GetSockAddrHttp() + "/query"}
5353
}
5454
testutil.VerifyCurlCmd(t, queryArgs(hc.AccessJwt), &testutil.CurlFailureConfig{
5555
ShouldFail: false,
@@ -60,7 +60,7 @@ func (asuite *AclTestSuite) TestCurlAuthorization() {
6060
"-H", "Content-Type: application/rdf",
6161
"-d", fmt.Sprintf(`{ set {
6262
_:a <%s> "string" .
63-
}}`, predicateToWrite), testutil.SockAddrHttp + "/mutate"}
63+
}}`, predicateToWrite), testutil.GetSockAddrHttp() + "/mutate"}
6464

6565
}
6666

@@ -71,7 +71,7 @@ func (asuite *AclTestSuite) TestCurlAuthorization() {
7171

7272
alterArgs := func(jwt string) []string {
7373
return []string{"-H", fmt.Sprintf("X-Dgraph-AccessToken:%s", jwt),
74-
"-d", fmt.Sprintf(`%s: int .`, predicateToAlter), testutil.SockAddrHttp + "/alter"}
74+
"-d", fmt.Sprintf(`%s: int .`, predicateToAlter), testutil.GetSockAddrHttp() + "/alter"}
7575
}
7676
testutil.VerifyCurlCmd(t, alterArgs(hc.AccessJwt), &testutil.CurlFailureConfig{
7777
ShouldFail: true,

check_upgrade/check_upgrade_test.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,11 @@ package checkupgrade
1010
import (
1111
"context"
1212
"fmt"
13+
"os"
1314
"os/exec"
1415
"path/filepath"
1516
"regexp"
17+
"runtime"
1618
"testing"
1719
"time"
1820

@@ -26,6 +28,11 @@ import (
2628
)
2729

2830
func TestCheckUpgrade(t *testing.T) {
31+
if runtime.GOOS != "linux" && os.Getenv("DGRAPH_BINARY") == "" {
32+
fmt.Println("Skipping live load-uids tests on non-Linux platforms due to dgraph binary dependency")
33+
fmt.Println("You can set the DGRAPH_BINARY environment variable to path of a native dgraph binary to run these tests")
34+
os.Exit(0)
35+
}
2936
conf := dgraphtest.NewClusterConfig().WithNumAlphas(1).WithNumZeros(1).WithReplicas(1).
3037
WithACL(time.Hour).WithVersion("57aa5c4ac")
3138
c, err := dgraphtest.NewLocalCluster(conf)

dgraph/cmd/dgraphimport/import_test.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ import (
1010
"context"
1111
"encoding/json"
1212
"fmt"
13+
"os"
1314
"path/filepath"
15+
"runtime"
1416
"strconv"
1517
"strings"
1618
"testing"
@@ -301,6 +303,10 @@ func runImportTest(t *testing.T, tt testcase) {
301303

302304
// setupBulkCluster creates and configures a cluster for bulk loading data
303305
func setupBulkCluster(t *testing.T, numAlphas int, encrypted bool) (*dgraphtest.LocalCluster, string) {
306+
if runtime.GOOS != "linux" && os.Getenv("DGRAPH_BINARY") == "" {
307+
fmt.Println("You can set the DGRAPH_BINARY environment variable to path of a native dgraph binary to run these tests")
308+
t.Skip("Skipping test on non-Linux platforms due to dgraph binary dependency")
309+
}
304310
baseDir := t.TempDir()
305311
bulkConf := dgraphtest.NewClusterConfig().
306312
WithNumAlphas(numAlphas).

dgraph/cmd/increment/increment_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ func readBestEffort(t *testing.T, dg *dgo.Dgraph, pred string, M int) {
124124
}
125125

126126
func setup(t *testing.T) *dgo.Dgraph {
127-
dg, err := testutil.DgraphClientWithGroot(testutil.SockAddr)
127+
dg, err := testutil.DgraphClientWithGroot(testutil.GetSockAddr())
128128
if err != nil {
129129
t.Fatalf("Error while getting a dgraph client: %v", err)
130130
}

dgraph/cmd/live/load-json/load_test.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ package live
99

1010
import (
1111
"context"
12+
"fmt"
1213
"os"
1314
"path/filepath"
1415
"runtime"
@@ -22,7 +23,7 @@ import (
2223
"github.com/hypermodeinc/dgraph/v25/x"
2324
)
2425

25-
var alphaService = testutil.SockAddr
26+
var alphaService = testutil.GetSockAddr()
2627

2728
var (
2829
testDataDir string
@@ -161,11 +162,17 @@ func TestLiveLoadJSONMultipleFiles(t *testing.T) {
161162
}
162163

163164
func TestMain(m *testing.M) {
165+
if runtime.GOOS != "linux" && os.Getenv("DGRAPH_BINARY") == "" {
166+
fmt.Println("Skipping live load-json tests on non-Linux platforms due to dgraph binary dependency")
167+
fmt.Println("You can set the DGRAPH_BINARY environment variable to path of a native dgraph binary to run these tests")
168+
os.Exit(0)
169+
}
170+
164171
_, thisFile, _, _ := runtime.Caller(0)
165172
testDataDir = filepath.Dir(thisFile)
166173

167174
var err error
168-
dg, err = testutil.DgraphClientWithGroot(testutil.SockAddr)
175+
dg, err = testutil.DgraphClientWithGroot(testutil.GetSockAddr())
169176
x.Panic(err)
170177

171178
// Try to create any files in a dedicated temp directory that gets cleaned up

dgraph/cmd/live/load-uids/load_test.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ func TestLiveLoadExportedSchema(t *testing.T) {
251251
}
252252
}`,
253253
}
254-
token := testutil.GrootHttpLogin("http://" + testutil.SockAddrHttp + "/admin")
254+
token := testutil.GrootHttpLogin("http://" + testutil.GetSockAddrHttp() + "/admin")
255255
resp := testutil.MakeGQLRequestWithAccessJwt(t, params, token.AccessJwt)
256256
require.Nilf(t, resp.Errors, resp.Errors.Error())
257257

@@ -351,8 +351,14 @@ func TestLiveLoadFileNameMultipleCorrect(t *testing.T) {
351351
}
352352

353353
func TestMain(m *testing.M) {
354+
if runtime.GOOS != "linux" && os.Getenv("DGRAPH_BINARY") == "" {
355+
fmt.Println("Skipping live load-uids tests on non-Linux platforms due to dgraph binary dependency")
356+
fmt.Println("You can set the DGRAPH_BINARY environment variable to path of a native dgraph binary to run these tests")
357+
os.Exit(0)
358+
}
359+
360+
alphaService = testutil.GetSockAddr()
354361
alphaName = testutil.Instance
355-
alphaService = testutil.SockAddr
356362

357363
x.AssertTrue(strings.Count(alphaName, "_") == 2)
358364
left := strings.Index(alphaName, "_")
@@ -365,7 +371,7 @@ func TestMain(m *testing.M) {
365371
fmt.Printf("Using test data dir: %s\n", testDataDir)
366372

367373
var err error
368-
dg, err = testutil.DgraphClientWithGroot(testutil.SockAddr)
374+
dg, err = testutil.DgraphClientWithGroot(testutil.GetSockAddr())
369375
if err != nil {
370376
log.Fatalf("Error while getting a dgraph client: %v", err)
371377
}

dgraph/cmd/version/version_test.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@
66
package version
77

88
import (
9+
"fmt"
910
"os"
1011
"path/filepath"
12+
"runtime"
1113
"testing"
1214

1315
"github.com/stretchr/testify/require"
@@ -16,6 +18,15 @@ import (
1618
)
1719

1820
// Test `dgraph version` with an empty config file.
21+
func TestMain(m *testing.M) {
22+
if runtime.GOOS != "linux" && os.Getenv("DGRAPH_BINARY") == "" {
23+
fmt.Println("Skipping version tests on non-Linux platforms due to dgraph binary dependency")
24+
fmt.Println("You can set the DGRAPH_BINARY environment variable to path of a native dgraph binary to run these tests")
25+
os.Exit(0)
26+
}
27+
m.Run()
28+
}
29+
1930
func TestDgraphVersion(t *testing.T) {
2031
tmpPath := t.TempDir()
2132
configPath := filepath.Join(tmpPath, "config.yml")

dgraph/cmd/zero/zero_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ func TestRemoveNode(t *testing.T) {
4141

4242
func TestIdLeaseOverflow(t *testing.T) {
4343
dialOpts := []grpc.DialOption{grpc.WithTransportCredentials(insecure.NewCredentials())}
44-
con, err := grpc.NewClient(testutil.SockAddrZero, dialOpts...)
44+
con, err := grpc.NewClient(testutil.GetSockAddrZero(), dialOpts...)
4545
require.NoError(t, err)
4646
zc := pb.NewZeroClient(con)
4747

@@ -55,7 +55,7 @@ func TestIdLeaseOverflow(t *testing.T) {
5555

5656
func TestIdBump(t *testing.T) {
5757
dialOpts := []grpc.DialOption{grpc.WithTransportCredentials(insecure.NewCredentials())}
58-
con, err := grpc.NewClient(testutil.SockAddrZero, dialOpts...)
58+
con, err := grpc.NewClient(testutil.GetSockAddrZero(), dialOpts...)
5959
require.NoError(t, err)
6060
zc := pb.NewZeroClient(con)
6161

dgraph/docker-compose.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ services:
1111
service: zero
1212
volumes:
1313
- type: bind
14-
source: $GOPATH/bin
14+
source: ${GOPATH:?GOPATH environment variable is required but not set}/bin
1515
target: /gobin
1616
read_only: true
1717
command:
@@ -32,7 +32,7 @@ services:
3232
service: zero
3333
volumes:
3434
- type: bind
35-
source: $GOPATH/bin
35+
source: ${GOPATH:?GOPATH environment variable is required but not set}/bin
3636
target: /gobin
3737
read_only: true
3838
command:
@@ -52,7 +52,7 @@ services:
5252
service: zero
5353
volumes:
5454
- type: bind
55-
source: $GOPATH/bin
55+
source: ${GOPATH:?GOPATH environment variable is required but not set}/bin
5656
target: /gobin
5757
read_only: true
5858
command:
@@ -64,7 +64,7 @@ services:
6464
working_dir: /data/alpha1
6565
volumes:
6666
- type: bind
67-
source: $GOPATH/bin
67+
source: ${GOPATH:?GOPATH environment variable is required but not set}/bin
6868
target: /gobin
6969
read_only: true
7070
- type: bind
@@ -95,7 +95,7 @@ services:
9595
- alpha1
9696
volumes:
9797
- type: bind
98-
source: $GOPATH/bin
98+
source: ${GOPATH:?GOPATH environment variable is required but not set}/bin
9999
target: /gobin
100100
read_only: true
101101
- type: bind
@@ -126,7 +126,7 @@ services:
126126
- alpha2
127127
volumes:
128128
- type: bind
129-
source: $GOPATH/bin
129+
source: ${GOPATH:?GOPATH environment variable is required but not set}/bin
130130
target: /gobin
131131
read_only: true
132132
- type: bind
@@ -157,7 +157,7 @@ services:
157157
- alpha3
158158
volumes:
159159
- type: bind
160-
source: $GOPATH/bin
160+
source: ${GOPATH:?GOPATH environment variable is required but not set}/bin
161161
target: /gobin
162162
read_only: true
163163
- type: bind
@@ -188,7 +188,7 @@ services:
188188
- alpha4
189189
volumes:
190190
- type: bind
191-
source: $GOPATH/bin
191+
source: ${GOPATH:?GOPATH environment variable is required but not set}/bin
192192
target: /gobin
193193
read_only: true
194194
- type: bind
@@ -219,7 +219,7 @@ services:
219219
- alpha5
220220
volumes:
221221
- type: bind
222-
source: $GOPATH/bin
222+
source: ${GOPATH:?GOPATH environment variable is required but not set}/bin
223223
target: /gobin
224224
read_only: true
225225
- type: bind

0 commit comments

Comments
 (0)