@@ -29,6 +29,7 @@ import (
29
29
"time"
30
30
31
31
driver "github.com/arangodb/go-driver"
32
+ "github.com/stretchr/testify/require"
32
33
)
33
34
34
35
// TestDefaultIndexes creates a collection without any custom index.
@@ -579,3 +580,33 @@ func TestTTLIndexesClusterInventory(t *testing.T) {
579
580
}
580
581
581
582
}
583
+
584
+ func TestPersistentIndexCreation (t * testing.T ) {
585
+ c := createClientFromEnv (t , true )
586
+ skipBelowVersion (c , "3.7" , t )
587
+
588
+ db := ensureDatabase (nil , c , "index_test_creation" , nil , t )
589
+ coll := ensureCollection (nil , db , "index_creation_test_col" , nil , t )
590
+
591
+ for i := 0 ; i < 16 ; i ++ {
592
+ _ , err := coll .CreateDocument (context .Background (), map [string ]interface {}{
593
+ "MyIndex" : fmt .Sprintf ("%d" , i ),
594
+ "Index" : i ,
595
+ })
596
+ require .NoError (t , err )
597
+ }
598
+
599
+ for i := 0 ; i < 100 ; i ++ {
600
+ index , _ , err := coll .EnsurePersistentIndex (
601
+ context .Background (),
602
+ []string {"sensitivity" },
603
+ & driver.EnsurePersistentIndexOptions {
604
+ Unique : false ,
605
+ Sparse : false ,
606
+ Name : "idx_sensitivity" ,
607
+ },
608
+ )
609
+ require .NoError (t , err )
610
+ require .NotNil (t , index )
611
+ }
612
+ }
0 commit comments