@@ -204,6 +204,44 @@ func TestDatabaseNameUnicode(t *testing.T) {
204
204
require .NoErrorf (t , db .Remove (ctx ), "failed to remove testing database" )
205
205
}
206
206
207
+ // TestCreateDatabaseReplication2 creates a database with replication version two.
208
+ func TestCreateDatabaseReplication2 (t * testing.T ) {
209
+ ctx := context .Background ()
210
+ c := createClientFromEnv (t , true )
211
+ version , _ := c .Version (ctx )
212
+ if version .Version .CompareTo ("3.11.0" ) < 0 {
213
+ t .Skipf ("Version of the ArangoDB should be at least 3.11.0" )
214
+ }
215
+
216
+ name := "create_test1"
217
+ opts := driver.CreateDatabaseOptions {Options : driver.CreateDatabaseDefaultOptions {
218
+ ReplicationVersion : driver .DatabaseReplicationVersionTwo ,
219
+ }}
220
+ if _ , err := c .CreateDatabase (nil , name , & opts ); err != nil {
221
+ t .Fatalf ("Failed to create database '%s': %s" , name , describe (err ))
222
+ }
223
+ // Database must exist now
224
+ if found , err := c .DatabaseExists (nil , name ); err != nil {
225
+ t .Errorf ("DatabaseExists('%s') failed: %s" , name , describe (err ))
226
+ } else if ! found {
227
+ t .Errorf ("DatabaseExists('%s') return false, expected true" , name )
228
+ }
229
+
230
+ // Read database properties
231
+ db , err := c .Database (nil , name )
232
+ if err != nil {
233
+ t .Fatal ("Failed to get database " )
234
+ }
235
+ info , err := db .Info (nil )
236
+ if err != nil {
237
+ t .Fatal ("Failed to get database name" )
238
+ }
239
+
240
+ if info .ReplicationVersion != driver .DatabaseReplicationVersionTwo {
241
+ t .Errorf ("Wrong replication version, expected %s, found %s" , driver .DatabaseReplicationVersionTwo , info .ReplicationVersion )
242
+ }
243
+ }
244
+
207
245
// databaseExtendedNamesRequired skips test if the version is < 3.9.0 or the ArangoDB has not been launched
208
246
// with the option --database.extended-names-databases=true.
209
247
func databaseExtendedNamesRequired (t * testing.T , c driver.Client ) {
0 commit comments