Skip to content

Commit 0121765

Browse files
fix tests
1 parent 70a703f commit 0121765

File tree

4 files changed

+15
-11
lines changed

4 files changed

+15
-11
lines changed

systest/vector/backup_test.go

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,15 @@ func (vsuite *VectorTestSuite) TestVectorIncrBackupRestore() {
4141
require.NoError(t, hc.LoginIntoNamespace(dgraphapi.DefaultUser,
4242
dgraphapi.DefaultPassword, x.RootNamespace))
4343

44-
require.NoError(t, gc.SetupSchema(vsuite.schema))
44+
require.NoError(t, gc.SetupSchema(vsuite.schemaVecDimesion10))
4545

46-
numVectors := 500
47-
pred := "project_description_v"
46+
numVectors := 1000
4847
allVectors := make([][][]float32, 0, 5)
4948
allRdfs := make([]string, 0, 5)
5049
for i := 1; i <= 5; i++ {
5150
var rdfs string
5251
var vectors [][]float32
53-
rdfs, vectors = dgraphapi.GenerateRandomVectors(numVectors*(i-1), numVectors*i, 1, pred)
52+
rdfs, vectors = dgraphapi.GenerateRandomVectors(numVectors*(i-1), numVectors*i, 10, pred)
5453
allVectors = append(allVectors, vectors)
5554
allRdfs = append(allRdfs, rdfs)
5655
mu := &api.Mutation{SetNquads: []byte(rdfs), CommitNow: true}
@@ -162,9 +161,9 @@ func (vsuite *VectorTestSuite) TestVectorBackupRestoreDropIndex() {
162161
// add vector predicate + index
163162
require.NoError(t, gc.SetupSchema(vsuite.schema))
164163
// add data to the vector predicate
165-
numVectors := 3
164+
numVectors := 1000
166165
pred := "project_description_v"
167-
rdfs, vectors := dgraphapi.GenerateRandomVectors(0, numVectors, 1, pred)
166+
rdfs, vectors := dgraphapi.GenerateRandomVectors(0, numVectors, 100, pred)
168167
mu := &api.Mutation{SetNquads: []byte(rdfs), CommitNow: true}
169168
_, err = gc.Mutate(mu)
170169
require.NoError(t, err)
@@ -176,7 +175,7 @@ func (vsuite *VectorTestSuite) TestVectorBackupRestoreDropIndex() {
176175
require.NoError(t, gc.SetupSchema(testSchemaWithoutIndex))
177176

178177
// add more data to the vector predicate
179-
rdfs, vectors2 := dgraphapi.GenerateRandomVectors(3, numVectors+3, 1, pred)
178+
rdfs, vectors2 := dgraphapi.GenerateRandomVectors(numVectors, numVectors+3, 100, pred)
180179
mu = &api.Mutation{SetNquads: []byte(rdfs), CommitNow: true}
181180
_, err = gc.Mutate(mu)
182181
require.NoError(t, err)
@@ -214,7 +213,7 @@ func (vsuite *VectorTestSuite) TestVectorBackupRestoreDropIndex() {
214213
}`
215214
resp, err := gc.Query(query)
216215
require.NoError(t, err)
217-
require.JSONEq(t, `{"vectors":[{"count":4}]}`, string(resp.GetJson()))
216+
require.JSONEq(t, `{"vectors":[{"count":1001}]}`, string(resp.GetJson()))
218217

219218
require.NoError(t, err)
220219
allVec := append(vectors, vectors2...)

systest/vector/load_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ func (vsuite *VectorTestSuite) TestLiveLoadAndExportRDFFormat() {
3535
defer func() { c.Cleanup(t.Failed()) }()
3636
require.NoError(t, c.Start())
3737

38-
testExportAndLiveLoad(t, c, "rdf", vsuite.schema)
38+
testExportAndLiveLoad(t, c, "rdf", vsuite.schemaVecDimesion10)
3939
}
4040

4141
func testExportAndLiveLoad(t *testing.T, c *dgraphtest.LocalCluster, exportFormat string, schema string) {
@@ -54,7 +54,7 @@ func testExportAndLiveLoad(t *testing.T, c *dgraphtest.LocalCluster, exportForma
5454

5555
numVectors := 1000
5656
pred := "project_description_v"
57-
rdfs, vectors := dgraphapi.GenerateRandomVectors(0, numVectors, 100, pred)
57+
rdfs, vectors := dgraphapi.GenerateRandomVectors(0, numVectors, 10, pred)
5858

5959
mu := &api.Mutation{SetNquads: []byte(rdfs), CommitNow: true}
6060
_, err = gc.Mutate(mu)

systest/vector/vector_test.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import (
2727
const (
2828
testSchemaWithoutIndex = `project_description_v: float32vector .`
2929
pred = "project_description_v"
30+
schemaVecDimension10 = `project_description_v: float32vector @index(partionedhnsw(numClusters: "1000", partitionStratOpt: "kmeans", vectorDimension: "10", metric: "euclidean")) .`
3031
)
3132

3233
var schemas = map[string]string{
@@ -619,6 +620,7 @@ func (vsuite *VectorTestSuite) TestPartitionedHNSWIndex() {
619620
type VectorTestSuite struct {
620621
suite.Suite
621622
schema string
623+
schemaVecDimesion10 string
622624
isForPartitionedIndex bool
623625
}
624626

@@ -627,7 +629,10 @@ func TestVectorSuite(t *testing.T) {
627629
var ssuite VectorTestSuite
628630
ssuite.schema = schema
629631
if strings.Contains(schema, "partionedhnsw") {
632+
ssuite.schemaVecDimesion10 = schemaVecDimension10
630633
ssuite.isForPartitionedIndex = true
634+
} else {
635+
ssuite.schemaVecDimesion10 = schema
631636
}
632637
suite.Run(t, &ssuite)
633638
if t.Failed() {

t/t.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ func sanitizeFilename(pkg string) string {
343343

344344
func runTestsFor(ctx context.Context, pkg, prefix string, xmlFile string) error {
345345
args := []string{"gotestsum", "--junitfile", xmlFile, "--format", "standard-verbose", "--max-fails", "1", "--",
346-
"-v", "-failfast", "-tags=integration"}
346+
"-v", "-tags=integration"}
347347
if *race {
348348
args = append(args, "-timeout", "180m")
349349
// Todo: There are few race errors in tests itself. Enable this once that is fixed.

0 commit comments

Comments
 (0)