Skip to content

Commit 96fc4f4

Browse files
chore(upgrade): run tests from v23.1.0 -> main (#9097)
Co-authored-by: shivaji-dgraph <[email protected]>
1 parent fffeecd commit 96fc4f4

File tree

4 files changed

+97
-66
lines changed

4 files changed

+97
-66
lines changed

dgraphtest/config.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,8 @@ func AllUpgradeCombos(v20 bool) []UpgradeCombo {
7474
// In mainCombos list, we keep latest version to current HEAD as well as
7575
// older versions of dgraph to ensure that a change does not cause failures.
7676
mainCombos := []UpgradeCombo{
77-
{"v23.0.1", localVersion, BackupRestore},
78-
{"v23.0.1", localVersion, InPlace},
79-
{"v21.03.0", "4fc9cfd", BackupRestore},
77+
{"v23.1.0", localVersion, BackupRestore},
78+
{"v23.1.0", localVersion, InPlace},
8079
}
8180

8281
if v20 {

query/common_test.go

Lines changed: 32 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,14 @@ type Speaker {
264264
language
265265
}
266266
267+
type User {
268+
name
269+
password
270+
gender
271+
friend
272+
alive
273+
}
274+
267275
name : string @index(term, exact, trigram) @count @lang .
268276
name_lang : string @lang .
269277
lang_type : string @index(exact) .
@@ -337,7 +345,6 @@ tweet-c : string @index(fulltext) .
337345
tweet-d : string @index(trigram) .
338346
name2 : string @index(term) .
339347
age2 : int @index(int) .
340-
vectorNonIndex : float32vector .
341348
`
342349

343350
func populateCluster(dc dgraphtest.Cluster) {
@@ -348,32 +355,30 @@ func populateCluster(dc dgraphtest.Cluster) {
348355
// all the UIDs we are using during the tests.
349356
x.Panic(dc.AssignUids(client.Dgraph, 65536))
350357

351-
higher, err := dgraphtest.IsHigherVersion(dc.GetVersion(), "160a0faa5fc6233fdc5a4caa4a7a3d1591f460d0")
352-
x.Panic(err)
353-
var ts string
354-
if higher {
355-
ts = testSchema + `type User {
356-
name
357-
password
358-
gender
359-
friend
360-
alive
361-
user_profile
362-
}
363-
user_profile : float32vector @index(hnsw(metric:"euclidian")) .`
364-
} else {
365-
ts = testSchema + `type User {
366-
name
367-
password
368-
gender
369-
friend
370-
alive
371-
}`
372-
}
373-
setSchema(ts)
374-
err = addTriplesToCluster(`
375-
<1> <vectorNonIndex> "[1.0, 1.0, 2.0, 2.0]" .
376-
<2> <vectorNonIndex> "[2.0, 1.0, 2.0, 2.0]" .
358+
// higher, err := dgraphtest.IsHigherVersion(dc.GetVersion(), "160a0faa5fc6233fdc5a4caa4a7a3d1591f460d0")
359+
// x.Panic(err)
360+
// var ts string
361+
// if higher {
362+
// ts = testSchema + `type User {
363+
// name
364+
// password
365+
// gender
366+
// friend
367+
// alive
368+
// user_profile
369+
// }
370+
// user_profile : float32vector @index(hnsw(metric:"euclidian")) .`
371+
// } else {
372+
// ts = testSchema + `type User {
373+
// name
374+
// password
375+
// gender
376+
// friend
377+
// alive
378+
// }`
379+
// }
380+
setSchema(testSchema)
381+
err := addTriplesToCluster(`
377382
<1> <name> "Michonne" .
378383
<2> <name> "King Lear" .
379384
<3> <name> "Margaret" .

query/query0_test.go

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -31,42 +31,6 @@ import (
3131
"github.com/dgraph-io/dgraph/dql"
3232
)
3333

34-
func TestGetVector(t *testing.T) {
35-
query := `
36-
{
37-
me(func: has(vectorNonIndex)) {
38-
a as vectorNonIndex
39-
}
40-
aggregation() {
41-
avg(val(a))
42-
sum(val(a))
43-
}
44-
}
45-
`
46-
js := processQueryNoErr(t, query)
47-
k := `{
48-
"data": {
49-
"me": [
50-
{
51-
"vectorNonIndex": [1,1,2,2]
52-
},
53-
{
54-
"vectorNonIndex": [2,1,2,2]
55-
}
56-
],
57-
"aggregation": [
58-
{
59-
"avg(val(a))": [1.5,1,2,2]
60-
},
61-
{
62-
"sum(val(a))": [3,2,4,4]
63-
}
64-
]
65-
}
66-
}`
67-
require.JSONEq(t, k, js)
68-
}
69-
7034
func TestGetUID(t *testing.T) {
7135
query := `
7236
{

query/vector/vector_test.go

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -727,3 +727,66 @@ func TestVectorTwoTxnWithoutCommit(t *testing.T) {
727727
require.Contains(t, resp, vectors[i])
728728
}
729729
}
730+
731+
func TestGetVector(t *testing.T) {
732+
setSchema("vectorNonIndex : float32vector .")
733+
734+
rdfs := `
735+
<1> <vectorNonIndex> "[1.0, 1.0, 2.0, 2.0]" .
736+
<2> <vectorNonIndex> "[2.0, 1.0, 2.0, 2.0]" .`
737+
require.NoError(t, addTriplesToCluster(rdfs))
738+
739+
query := `
740+
{
741+
me(func: has(vectorNonIndex)) {
742+
a as vectorNonIndex
743+
}
744+
aggregation() {
745+
avg(val(a))
746+
sum(val(a))
747+
}
748+
}
749+
`
750+
js := processQueryNoErr(t, query)
751+
k := `{
752+
"data": {
753+
"me": [
754+
{
755+
"vectorNonIndex": [
756+
1,
757+
1,
758+
2,
759+
2
760+
]
761+
},
762+
{
763+
"vectorNonIndex": [
764+
2,
765+
1,
766+
2,
767+
2
768+
]
769+
}
770+
],
771+
"aggregation": [
772+
{
773+
"avg(val(a))": [
774+
1.5,
775+
1,
776+
2,
777+
2
778+
]
779+
},
780+
{
781+
"sum(val(a))": [
782+
3,
783+
2,
784+
4,
785+
4
786+
]
787+
}
788+
]
789+
}
790+
}`
791+
require.JSONEq(t, k, js)
792+
}

0 commit comments

Comments
 (0)