From 1276d546db07f229571abf35100cc84545897486 Mon Sep 17 00:00:00 2001 From: Wilfried Goesgens Date: Thu, 17 Jul 2025 12:06:13 +0200 Subject: [PATCH 1/9] stretch timeouts --- v2/tests/admin_cluster_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/v2/tests/admin_cluster_test.go b/v2/tests/admin_cluster_test.go index 03a1e93f..04daddbf 100644 --- a/v2/tests/admin_cluster_test.go +++ b/v2/tests/admin_cluster_test.go @@ -241,7 +241,7 @@ func Test_ClusterMoveShards(t *testing.T) { t.Run("Check if shards are moved", func(t *testing.T) { start := time.Now() - maxTestTime := 2 * time.Minute + maxTestTime := 5 * time.Minute lastShardsNotOnTargetServerID := movedShards for { @@ -319,7 +319,7 @@ func Test_ClusterResignLeadership(t *testing.T) { t.Run("Check if targetServerID is no longer leader", func(t *testing.T) { start := time.Now() - maxTestTime := time.Minute + maxTestTime := 5 * time.Minute lastLeaderForShardsNum := 0 for { From 8ea7d1fccfd60771fe69b9e88edc101e3489da0f Mon Sep 17 00:00:00 2001 From: Wilfried Goesgens Date: Thu, 17 Jul 2025 15:35:46 +0200 Subject: [PATCH 2/9] increase timeout, comment out replication 2 test code. --- v2/tests/database_transactions_test.go | 88 +++++++++++++------------- v2/tests/utils_retry_test.go | 2 +- 2 files changed, 45 insertions(+), 45 deletions(-) diff --git a/v2/tests/database_transactions_test.go b/v2/tests/database_transactions_test.go index c6048628..7d62c95f 100644 --- a/v2/tests/database_transactions_test.go +++ b/v2/tests/database_transactions_test.go @@ -22,7 +22,7 @@ package tests import ( "context" - "strings" +// "strings" "testing" "time" @@ -33,27 +33,27 @@ import ( "github.com/arangodb/go-driver/v2/arangodb/shared" ) -func Test_DatabaseCreateReplicationV2(t *testing.T) { - Wrap(t, func(t *testing.T, client arangodb.Client) { - databaseReplication2Required(t, client, context.Background()) - - opts := arangodb.CreateDatabaseOptions{ - Users: nil, - Options: arangodb.CreateDatabaseDefaultOptions{ - ReplicationVersion: arangodb.DatabaseReplicationVersionTwo, - }, - } - WithDatabase(t, client, &opts, func(db arangodb.Database) { - t.Run("Transaction", func(t *testing.T) { - withContextT(t, defaultTestTimeout, func(ctx context.Context, t testing.TB) { - info, err := db.Info(ctx) - require.NoErrorf(t, err, "failed to get database info") - require.Equal(t, arangodb.DatabaseReplicationVersionTwo, info.ReplicationVersion) - }) - }) - }) - }) -} +//func Test_DatabaseCreateReplicationV2(t *testing.T) { +// Wrap(t, func(t *testing.T, client arangodb.Client) { +// databaseReplication2Required(t, client, context.Background()) +// +// opts := arangodb.CreateDatabaseOptions{ +// Users: nil, +// Options: arangodb.CreateDatabaseDefaultOptions{ +// ReplicationVersion: arangodb.DatabaseReplicationVersionTwo, +// }, +// } +// WithDatabase(t, client, &opts, func(db arangodb.Database) { +// t.Run("Transaction", func(t *testing.T) { +// withContextT(t, defaultTestTimeout, func(ctx context.Context, t testing.TB) { +// info, err := db.Info(ctx) +// require.NoErrorf(t, err, "failed to get database info") +// require.Equal(t, arangodb.DatabaseReplicationVersionTwo, info.ReplicationVersion) +// }) +// }) +// }) +// }) +//} func Test_DatabaseTransactions_DataIsolation(t *testing.T) { Wrap(t, func(t *testing.T, client arangodb.Client) { @@ -306,25 +306,25 @@ func abortTransaction(t testing.TB, transaction arangodb.Transaction) { }) } -func databaseReplication2Required(t *testing.T, c arangodb.Client, ctx context.Context) { - skipBelowVersion(c, context.Background(), "3.12.0", t) - requireClusterMode(t) - - dbName := "replication2" + GenerateUUID("test-db") - opts := arangodb.CreateDatabaseOptions{Options: arangodb.CreateDatabaseDefaultOptions{ - ReplicationVersion: arangodb.DatabaseReplicationVersionTwo, - }} - - db, err := c.CreateDatabase(ctx, dbName, &opts) - if err == nil { - require.NoErrorf(t, db.Remove(ctx), "failed to remove testing replication2 database") - return - } - - if strings.Contains(err.Error(), "Replication version 2 is disabled in this binary") { - t.Skipf("ArangoDB is not launched with the option --database.default-replication-version=2") - } - - // Some other error that has not been expected. - require.NoError(t, err) -} +//func databaseReplication2Required(t *testing.T, c arangodb.Client, ctx context.Context) { +// skipBelowVersion(c, context.Background(), "3.12.0", t) +// requireClusterMode(t) +// +// dbName := "replication2" + GenerateUUID("test-db") +// opts := arangodb.CreateDatabaseOptions{Options: arangodb.CreateDatabaseDefaultOptions{ +// ReplicationVersion: arangodb.DatabaseReplicationVersionTwo, +// }} +// +// db, err := c.CreateDatabase(ctx, dbName, &opts) +// if err == nil { +// require.NoErrorf(t, db.Remove(ctx), "failed to remove testing replication2 database") +// return +// } +// +// if strings.Contains(err.Error(), "Replication version 2 is disabled in this binary") { +// t.Skipf("ArangoDB is not launched with the option --database.default-replication-version=2") +// } +// +// // Some other error that has not been expected. +// require.NoError(t, err) +//} diff --git a/v2/tests/utils_retry_test.go b/v2/tests/utils_retry_test.go index 8a0d3fd7..4a531dc8 100644 --- a/v2/tests/utils_retry_test.go +++ b/v2/tests/utils_retry_test.go @@ -31,7 +31,7 @@ import ( // defaultTestTimeout is the default timeout for context use in tests // less than 2 minutes is causing problems on CI -const defaultTestTimeout = 15 * time.Minute +const defaultTestTimeout = 20 * time.Minute type Timeout func() error From d51d18654f25ec680d4febf8f314c72fed7e669e Mon Sep 17 00:00:00 2001 From: Wilfried Goesgens Date: Thu, 6 Nov 2025 10:05:08 +0100 Subject: [PATCH 3/9] randomize task id to avoid duplicates --- v2/tests/tasks_test.go | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/v2/tests/tasks_test.go b/v2/tests/tasks_test.go index 0fbb0b7b..fcb96e2e 100644 --- a/v2/tests/tasks_test.go +++ b/v2/tests/tasks_test.go @@ -24,11 +24,26 @@ import ( "context" "testing" + "math/rand" + "time" + "github.com/arangodb/go-driver/v2/arangodb" "github.com/arangodb/go-driver/v2/utils" "github.com/stretchr/testify/require" ) - +const charset = "abcdefghijklmnopqrstuvwxyz" + + "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" + +var seededRand *rand.Rand = rand.New( + rand.NewSource(time.Now().UnixNano())) + +func StringWithCharset(length int, charset string) string { + b := make([]byte, length) + for i := range b { + b[i] = charset[seededRand.Intn(len(charset))] + } + return string(b) +} type TaskParams struct { Foo string `json:"foo"` Bar string `json:"bar"` @@ -138,7 +153,7 @@ func Test_TaskCreationWithId(t *testing.T) { Wrap(t, func(t *testing.T, client arangodb.Client) { withContextT(t, defaultTestTimeout, func(ctx context.Context, tb testing.TB) { dbName := "_system" - taskID := "test-task-id" + taskID := "test-task-id" + StringWithCharset(16, charset) options := &arangodb.TaskOptions{ ID: &taskID, // Optional if CreateTaskWithID sets it, but safe to keep Name: utils.NewType("TestTaskWithID"), From 9534b3252d02a620098ee6d13783f79223689a3d Mon Sep 17 00:00:00 2001 From: Wilfried Goesgens Date: Thu, 6 Nov 2025 11:57:50 +0100 Subject: [PATCH 4/9] increase timeouts, make queries slow, only hit our queries to kill --- v2/tests/admin_cluster_test.go | 2 +- v2/tests/database_query_test.go | 29 +++++++++++++++++++---------- 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/v2/tests/admin_cluster_test.go b/v2/tests/admin_cluster_test.go index f78de27c..dd355840 100644 --- a/v2/tests/admin_cluster_test.go +++ b/v2/tests/admin_cluster_test.go @@ -444,7 +444,7 @@ func waitForDBServerClusterMaintenance(ctx context.Context, client arangodb.Clie func Test_DBServerMaintenance(t *testing.T) { Wrap(t, func(t *testing.T, client arangodb.Client) { - withContextT(t, defaultTestTimeout, func(ctx context.Context, tb testing.TB) { + withContextT(t, defaultTestTimeout * 3, func(ctx context.Context, tb testing.TB) { requireClusterMode(t) skipBelowVersion(client, ctx, "3.10", t) diff --git a/v2/tests/database_query_test.go b/v2/tests/database_query_test.go index 4463b56d..01a4c426 100644 --- a/v2/tests/database_query_test.go +++ b/v2/tests/database_query_test.go @@ -31,6 +31,7 @@ import ( "github.com/arangodb/go-driver/v2/arangodb" "github.com/arangodb/go-driver/v2/utils" + "github.com/arangodb/go-driver/v2/arangodb/shared" ) // Test_ExplainQuery tries to explain several AQL queries. @@ -326,7 +327,7 @@ func Test_ListOfRunningAQLQueries(t *testing.T) { FOR x IN 1..100 RETURN x * i ) - RETURN {i: i, sum: SUM(computation)} + RETURN {i: i, sum: SUM(computation), sleep: SLEEP(1)} `, &arangodb.QueryOptions{ BindVars: bindVars, }) @@ -485,16 +486,16 @@ func Test_KillAQLQuery(t *testing.T) { // Use a streaming query that processes results slowly bindVars := map[string]interface{}{ - "max": 10000000, + "maxKill": 10000000, } cursor, err := db.Query(ctx, ` - FOR i IN 1..@max + FOR i IN 1..@maxKill LET computation = ( FOR x IN 1..100 RETURN x * i ) - RETURN {i: i, sum: SUM(computation)} + RETURN {i: i, sum: SUM(computation), j: SLEEP(2)} `, &arangodb.QueryOptions{ BindVars: bindVars, }) @@ -552,12 +553,20 @@ func Test_KillAQLQuery(t *testing.T) { // Log query details for i, query := range queries { bindVarsJSON, _ := utils.ToJSONString(*query.BindVars) - t.Logf("Query %d: ID=%s, State=%s, BindVars=%s", - i, *query.Id, *query.State, bindVarsJSON) - // Kill the query - err := db.KillAQLQuery(ctx, *query.Id, utils.NewType(false)) - require.NoError(t, err, "Failed to kill query %s", *query.Id) - t.Logf("Killed query %s", *query.Id) + if strings.Contains(bindVarsJSON, "maxKill") { + t.Logf("Query %d: ID=%s, State=%s, BindVars=%s", + i, *query.Id, *query.State, bindVarsJSON) + // Kill the query + err := db.KillAQLQuery(ctx, *query.Id, utils.NewType(false)) + if ok, arangoErr := shared.IsArangoError(err); ok { + if arangoErr.ErrorNum == shared.ErrQueryNotFound { + t.Logf("query gone %s", *query.Id) + continue + } + } + require.NoError(t, err, "Failed to kill query %s", *query.Id) + t.Logf("Killed query %s", *query.Id) + } } break } From 5bdcab327bd5600e2342a235c28a27c83a382e29 Mon Sep 17 00:00:00 2001 From: Wilfried Goesgens Date: Thu, 6 Nov 2025 13:15:50 +0100 Subject: [PATCH 5/9] fix loop mechanism --- v2/tests/database_query_test.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/v2/tests/database_query_test.go b/v2/tests/database_query_test.go index 01a4c426..563d668d 100644 --- a/v2/tests/database_query_test.go +++ b/v2/tests/database_query_test.go @@ -506,6 +506,7 @@ func Test_KillAQLQuery(t *testing.T) { } return } + t.Logf("Query launched: %v", cursor) // Process results slowly to keep query active longer if cursor != nil { @@ -548,7 +549,6 @@ func Test_KillAQLQuery(t *testing.T) { t.Logf("Attempt %d: Found %d queries", attempt+1, len(queries)) if len(queries) > 0 { - foundRunningQuery = true t.Logf("SUCCESS: Found %d running queries on attempt %d\n", len(queries), attempt+1) // Log query details for i, query := range queries { @@ -565,10 +565,14 @@ func Test_KillAQLQuery(t *testing.T) { } } require.NoError(t, err, "Failed to kill query %s", *query.Id) + foundRunningQuery = true t.Logf("Killed query %s", *query.Id) + break + } else { + t.Logf("Query skipped %d: ID=%s, State=%s, BindVars=%s", + i, *query.Id, *query.State, bindVarsJSON) } } - break } time.Sleep(300 * time.Millisecond) From 152b66154b87b4aac9e9dc83a91fc4f005f5db24 Mon Sep 17 00:00:00 2001 From: Wilfried Goesgens Date: Thu, 6 Nov 2025 13:35:03 +0100 Subject: [PATCH 6/9] make name uniq --- v2/tests/database_query_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/v2/tests/database_query_test.go b/v2/tests/database_query_test.go index 563d668d..11771d53 100644 --- a/v2/tests/database_query_test.go +++ b/v2/tests/database_query_test.go @@ -1284,7 +1284,7 @@ func Test_UserDefinedFunctions(t *testing.T) { require.NoError(t, err) // Define UDF details - namespace := "myfunctions::temperature" + namespace := "myfunctions::temperature::" + StringWithCharset(16, charset) functionName := namespace + "::celsiustofahrenheit" code := "function (celsius) { return celsius * 9 / 5 + 32; }" From a7fbbe4a1aad89a0d259a1a839931c6c500d4f87 Mon Sep 17 00:00:00 2001 From: Wilfried Goesgens Date: Thu, 6 Nov 2025 15:05:17 +0100 Subject: [PATCH 7/9] disable parallel, make bindvar uniq --- v2/tests/admin_cluster_test.go | 2 ++ v2/tests/database_query_test.go | 7 ++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/v2/tests/admin_cluster_test.go b/v2/tests/admin_cluster_test.go index dd355840..5d263ba6 100644 --- a/v2/tests/admin_cluster_test.go +++ b/v2/tests/admin_cluster_test.go @@ -501,6 +501,8 @@ func Test_DBServerMaintenance(t *testing.T) { err = waitForDBServerClusterMaintenance(ctx, client, nil, dbServerId, 10*time.Second) require.NoError(t, err, "maintenance mode not disabled in time") }) + }, WrapOptions{ + Parallel: utils.NewType(false), }) } diff --git a/v2/tests/database_query_test.go b/v2/tests/database_query_test.go index 11771d53..31e7cadc 100644 --- a/v2/tests/database_query_test.go +++ b/v2/tests/database_query_test.go @@ -458,6 +458,7 @@ func Test_ListOfSlowAQLQueries(t *testing.T) { func Test_KillAQLQuery(t *testing.T) { Wrap(t, func(t *testing.T, client arangodb.Client) { + bvString := "maxKill" + StringWithCharset(16, charset) ctx := context.Background() // Get the database db, err := client.GetDatabase(ctx, "_system", nil) @@ -486,11 +487,11 @@ func Test_KillAQLQuery(t *testing.T) { // Use a streaming query that processes results slowly bindVars := map[string]interface{}{ - "maxKill": 10000000, + bvString : 10000000, } cursor, err := db.Query(ctx, ` - FOR i IN 1..@maxKill + FOR i IN 1..@` + bvString + ` LET computation = ( FOR x IN 1..100 RETURN x * i @@ -553,7 +554,7 @@ func Test_KillAQLQuery(t *testing.T) { // Log query details for i, query := range queries { bindVarsJSON, _ := utils.ToJSONString(*query.BindVars) - if strings.Contains(bindVarsJSON, "maxKill") { + if strings.Contains(bindVarsJSON, bvString) { t.Logf("Query %d: ID=%s, State=%s, BindVars=%s", i, *query.Id, *query.State, bindVarsJSON) // Kill the query From 9cb97b27e8f2199d57e5fbab8aaa59c34dd38c5b Mon Sep 17 00:00:00 2001 From: Wilfried Goesgens Date: Thu, 6 Nov 2025 15:20:34 +0100 Subject: [PATCH 8/9] lint= --- v2/tests/admin_cluster_test.go | 2 +- v2/tests/database_query_test.go | 6 +++--- v2/tests/database_transactions_test.go | 3 +-- v2/tests/tasks_test.go | 12 +++++++----- 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/v2/tests/admin_cluster_test.go b/v2/tests/admin_cluster_test.go index 5d263ba6..b94fa258 100644 --- a/v2/tests/admin_cluster_test.go +++ b/v2/tests/admin_cluster_test.go @@ -444,7 +444,7 @@ func waitForDBServerClusterMaintenance(ctx context.Context, client arangodb.Clie func Test_DBServerMaintenance(t *testing.T) { Wrap(t, func(t *testing.T, client arangodb.Client) { - withContextT(t, defaultTestTimeout * 3, func(ctx context.Context, tb testing.TB) { + withContextT(t, defaultTestTimeout*3, func(ctx context.Context, tb testing.TB) { requireClusterMode(t) skipBelowVersion(client, ctx, "3.10", t) diff --git a/v2/tests/database_query_test.go b/v2/tests/database_query_test.go index 31e7cadc..762a8fd2 100644 --- a/v2/tests/database_query_test.go +++ b/v2/tests/database_query_test.go @@ -30,8 +30,8 @@ import ( "github.com/stretchr/testify/require" "github.com/arangodb/go-driver/v2/arangodb" + "github.com/arangodb/go-driver/v2/arangodb/shared" "github.com/arangodb/go-driver/v2/utils" - "github.com/arangodb/go-driver/v2/arangodb/shared" ) // Test_ExplainQuery tries to explain several AQL queries. @@ -487,11 +487,11 @@ func Test_KillAQLQuery(t *testing.T) { // Use a streaming query that processes results slowly bindVars := map[string]interface{}{ - bvString : 10000000, + bvString: 10000000, } cursor, err := db.Query(ctx, ` - FOR i IN 1..@` + bvString + ` + FOR i IN 1..@`+bvString+` LET computation = ( FOR x IN 1..100 RETURN x * i diff --git a/v2/tests/database_transactions_test.go b/v2/tests/database_transactions_test.go index 0e76ffc6..3c54e65a 100644 --- a/v2/tests/database_transactions_test.go +++ b/v2/tests/database_transactions_test.go @@ -22,7 +22,7 @@ package tests import ( "context" -// "strings" + //"strings" "testing" "time" @@ -306,7 +306,6 @@ func abortTransaction(t testing.TB, transaction arangodb.Transaction) { }) } - //func databaseReplication2Required(t *testing.T, c arangodb.Client, ctx context.Context) { // skipBelowVersion(c, context.Background(), "3.12.0", t) // requireClusterMode(t) diff --git a/v2/tests/tasks_test.go b/v2/tests/tasks_test.go index fcb96e2e..fce10bea 100644 --- a/v2/tests/tasks_test.go +++ b/v2/tests/tasks_test.go @@ -31,6 +31,7 @@ import ( "github.com/arangodb/go-driver/v2/utils" "github.com/stretchr/testify/require" ) + const charset = "abcdefghijklmnopqrstuvwxyz" + "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" @@ -38,12 +39,13 @@ var seededRand *rand.Rand = rand.New( rand.NewSource(time.Now().UnixNano())) func StringWithCharset(length int, charset string) string { - b := make([]byte, length) - for i := range b { - b[i] = charset[seededRand.Intn(len(charset))] - } - return string(b) + b := make([]byte, length) + for i := range b { + b[i] = charset[seededRand.Intn(len(charset))] + } + return string(b) } + type TaskParams struct { Foo string `json:"foo"` Bar string `json:"bar"` From 8bc157cdf64db642c01a1fbc6c29174026ab03df Mon Sep 17 00:00:00 2001 From: Wilfried Goesgens Date: Fri, 7 Nov 2025 08:08:15 +0100 Subject: [PATCH 9/9] skip instead of commenting out --- v2/tests/database_transactions_test.go | 90 +++++++++++++------------- 1 file changed, 46 insertions(+), 44 deletions(-) diff --git a/v2/tests/database_transactions_test.go b/v2/tests/database_transactions_test.go index 3c54e65a..81219253 100644 --- a/v2/tests/database_transactions_test.go +++ b/v2/tests/database_transactions_test.go @@ -22,7 +22,7 @@ package tests import ( "context" - //"strings" + "strings" "testing" "time" @@ -33,27 +33,28 @@ import ( "github.com/arangodb/go-driver/v2/arangodb/shared" ) -//func Test_DatabaseCreateReplicationV2(t *testing.T) { -// Wrap(t, func(t *testing.T, client arangodb.Client) { -// databaseReplication2Required(t, client, context.Background()) -// -// opts := arangodb.CreateDatabaseOptions{ -// Users: nil, -// Options: arangodb.CreateDatabaseDefaultOptions{ -// ReplicationVersion: arangodb.DatabaseReplicationVersionTwo, -// }, -// } -// WithDatabase(t, client, &opts, func(db arangodb.Database) { -// t.Run("Transaction", func(t *testing.T) { -// withContextT(t, defaultTestTimeout, func(ctx context.Context, t testing.TB) { -// info, err := db.Info(ctx) -// require.NoErrorf(t, err, "failed to get database info") -// require.Equal(t, arangodb.DatabaseReplicationVersionTwo, info.ReplicationVersion) -// }) -// }) -// }) -// }) -//} +func Test_DatabaseCreateReplicationV2(t *testing.T) { + t.Skip("currently disabled") + Wrap(t, func(t *testing.T, client arangodb.Client) { + databaseReplication2Required(t, client, context.Background()) + + opts := arangodb.CreateDatabaseOptions{ + Users: nil, + Options: arangodb.CreateDatabaseDefaultOptions{ + ReplicationVersion: arangodb.DatabaseReplicationVersionTwo, + }, + } + WithDatabase(t, client, &opts, func(db arangodb.Database) { + t.Run("Transaction", func(t *testing.T) { + withContextT(t, defaultTestTimeout, func(ctx context.Context, t testing.TB) { + info, err := db.Info(ctx) + require.NoErrorf(t, err, "failed to get database info") + require.Equal(t, arangodb.DatabaseReplicationVersionTwo, info.ReplicationVersion) + }) + }) + }) + }) +} func Test_DatabaseTransactions_DataIsolation(t *testing.T) { Wrap(t, func(t *testing.T, client arangodb.Client) { @@ -306,28 +307,29 @@ func abortTransaction(t testing.TB, transaction arangodb.Transaction) { }) } -//func databaseReplication2Required(t *testing.T, c arangodb.Client, ctx context.Context) { -// skipBelowVersion(c, context.Background(), "3.12.0", t) -// requireClusterMode(t) -// -// dbName := "replication2" + GenerateUUID("test-db") -// opts := arangodb.CreateDatabaseOptions{Options: arangodb.CreateDatabaseDefaultOptions{ -// ReplicationVersion: arangodb.DatabaseReplicationVersionTwo, -// }} -// -// db, err := c.CreateDatabase(ctx, dbName, &opts) -// if err == nil { -// require.NoErrorf(t, db.Remove(ctx), "failed to remove testing replication2 database") -// return -// } -// -// if strings.Contains(err.Error(), "Replication version 2 is disabled in this binary") { -// t.Skipf("ArangoDB is not launched with the option --database.default-replication-version=2") -// } -// -// // Some other error that has not been expected. -// require.NoError(t, err) -//} +func databaseReplication2Required(t *testing.T, c arangodb.Client, ctx context.Context) { + t.Skip("currently disabled") + skipBelowVersion(c, context.Background(), "3.12.0", t) + requireClusterMode(t) + + dbName := "replication2" + GenerateUUID("test-db") + opts := arangodb.CreateDatabaseOptions{Options: arangodb.CreateDatabaseDefaultOptions{ + ReplicationVersion: arangodb.DatabaseReplicationVersionTwo, + }} + + db, err := c.CreateDatabase(ctx, dbName, &opts) + if err == nil { + require.NoErrorf(t, db.Remove(ctx), "failed to remove testing replication2 database") + return + } + + if strings.Contains(err.Error(), "Replication version 2 is disabled in this binary") { + t.Skipf("ArangoDB is not launched with the option --database.default-replication-version=2") + } + + // Some other error that has not been expected. + require.NoError(t, err) +} func Test_DatabaseKeyGenerators(t *testing.T) { Wrap(t, func(t *testing.T, client arangodb.Client) {