@@ -12,7 +12,6 @@ import (
1212 "fmt"
1313 "slices"
1414 "strings"
15- "testing"
1615 "time"
1716
1817 "github.com/stretchr/testify/require"
@@ -23,7 +22,8 @@ import (
2322 "github.com/hypermodeinc/dgraph/v25/x"
2423)
2524
26- func TestVectorIncrBackupRestore (t * testing.T ) {
25+ func (vsuite * VectorTestSuite ) TestVectorIncrBackupRestore () {
26+ t := vsuite .T ()
2727 conf := dgraphtest .NewClusterConfig ().WithNumAlphas (1 ).WithNumZeros (1 ).WithReplicas (1 ).WithACL (time .Hour )
2828 c , err := dgraphtest .NewLocalCluster (conf )
2929 require .NoError (t , err )
@@ -41,7 +41,7 @@ func TestVectorIncrBackupRestore(t *testing.T) {
4141 require .NoError (t , hc .LoginIntoNamespace (dgraphapi .DefaultUser ,
4242 dgraphapi .DefaultPassword , x .RootNamespace ))
4343
44- require .NoError (t , gc .SetupSchema (testSchema ))
44+ require .NoError (t , gc .SetupSchema (vsuite . schema ))
4545
4646 numVectors := 500
4747 pred := "project_description_v"
@@ -100,7 +100,8 @@ func TestVectorIncrBackupRestore(t *testing.T) {
100100 }
101101}
102102
103- func TestVectorBackupRestore (t * testing.T ) {
103+ func (vsuite * VectorTestSuite ) TestVectorBackupRestore () {
104+ t := vsuite .T ()
104105 conf := dgraphtest .NewClusterConfig ().WithNumAlphas (1 ).WithNumZeros (1 ).WithReplicas (1 ).WithACL (time .Hour )
105106 c , err := dgraphtest .NewLocalCluster (conf )
106107 require .NoError (t , err )
@@ -118,7 +119,7 @@ func TestVectorBackupRestore(t *testing.T) {
118119 require .NoError (t , hc .LoginIntoNamespace (dgraphapi .DefaultUser ,
119120 dgraphapi .DefaultPassword , x .RootNamespace ))
120121
121- require .NoError (t , gc .SetupSchema (testSchema ))
122+ require .NoError (t , gc .SetupSchema (vsuite . schema ))
122123
123124 numVectors := 1000
124125 pred := "project_description_v"
@@ -138,7 +139,8 @@ func TestVectorBackupRestore(t *testing.T) {
138139 testVectorQuery (t , gc , vectors , rdfs , pred , numVectors )
139140}
140141
141- func TestVectorBackupRestoreDropIndex (t * testing.T ) {
142+ func (vsuite * VectorTestSuite ) TestVectorBackupRestoreDropIndex () {
143+ t := vsuite .T ()
142144 // setup cluster
143145 conf := dgraphtest .NewClusterConfig ().WithNumAlphas (1 ).WithNumZeros (1 ).WithReplicas (1 ).WithACL (time .Hour )
144146 c , err := dgraphtest .NewLocalCluster (conf )
@@ -158,7 +160,7 @@ func TestVectorBackupRestoreDropIndex(t *testing.T) {
158160 dgraphapi .DefaultPassword , x .RootNamespace ))
159161
160162 // add vector predicate + index
161- require .NoError (t , gc .SetupSchema (testSchema ))
163+ require .NoError (t , gc .SetupSchema (vsuite . schema ))
162164 // add data to the vector predicate
163165 numVectors := 3
164166 pred := "project_description_v"
@@ -195,7 +197,7 @@ func TestVectorBackupRestoreDropIndex(t *testing.T) {
195197 require .NoError (t , hc .Backup (c , false , dgraphtest .DefaultBackupDir ))
196198
197199 // add index
198- require .NoError (t , gc .SetupSchema (testSchema ))
200+ require .NoError (t , gc .SetupSchema (vsuite . schema ))
199201
200202 t .Log ("taking second incr backup \n " )
201203 require .NoError (t , hc .Backup (c , false , dgraphtest .DefaultBackupDir ))
@@ -227,7 +229,8 @@ func TestVectorBackupRestoreDropIndex(t *testing.T) {
227229 }
228230}
229231
230- func TestVectorBackupRestoreReIndexing (t * testing.T ) {
232+ func (vsuite * VectorTestSuite ) TestVectorBackupRestoreReIndexing () {
233+ t := vsuite .T ()
231234 conf := dgraphtest .NewClusterConfig ().WithNumAlphas (1 ).WithNumZeros (1 ).WithReplicas (1 ).WithACL (time .Hour )
232235 c , err := dgraphtest .NewLocalCluster (conf )
233236 require .NoError (t , err )
@@ -245,7 +248,7 @@ func TestVectorBackupRestoreReIndexing(t *testing.T) {
245248 require .NoError (t , hc .LoginIntoNamespace (dgraphapi .DefaultUser ,
246249 dgraphapi .DefaultPassword , x .RootNamespace ))
247250
248- require .NoError (t , gc .SetupSchema (testSchema ))
251+ require .NoError (t , gc .SetupSchema (vsuite . schema ))
249252
250253 numVectors := 1000
251254 pred := "project_description_v"
@@ -271,7 +274,7 @@ func TestVectorBackupRestoreReIndexing(t *testing.T) {
271274 // drop index
272275 require .NoError (t , gc .SetupSchema (testSchemaWithoutIndex ))
273276 // add index
274- require .NoError (t , gc .SetupSchema (testSchema ))
277+ require .NoError (t , gc .SetupSchema (vsuite . schema ))
275278 }
276279 vectors = append (vectors , vectors2 ... )
277280 rdfs = rdfs + rdfs2
0 commit comments