Skip to content

Commit e2efd9f

Browse files
Disable V8-dependent API tests for V2 since future arangods will ship… (#722)
* Disable V8-dependent API tests for V2 since future arangods will ship without V8 * changes in config for arangodbImage and test cahges in V1 * BTS-2253: Update tests related to V8 enabled/disabled * BTS-2253:Addressed cursor comments * BTS-2253:Modified version from v1 tests and addressed cursor comments * BTS-2253:Modifed skipAboveVersion to skipIfVersionGTE * BTS-2253:Modifed resource_class for ARM in cinfig file * BTS-2253:Addressed copilot comments * BTS-2253:Bug fix * bug fix * BTS-2253: Added note in changelog file and removed resouce_class for x86 in config file * BTS-2253: Done modifications in the Test_ApplierStart test case * BTS-2253: Add VersionWithOptions in V1 and disable V1 tests for v8 version compatibility
1 parent f7010b4 commit e2efd9f

18 files changed

+159
-65
lines changed

client_server_info.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ type ClientServerInfo interface {
3636
// ServerID Gets the ID of this server in the cluster.
3737
// An error is returned when calling this to a server that is not part of a cluster.
3838
ServerID(ctx context.Context) (string, error)
39+
40+
// VersionWithOptions returns version information from the connected database server.
41+
VersionWithOptions(ctx context.Context, details bool) (VersionInfo, error)
3942
}
4043

4144
// ServerRole is the role of an arangod server

client_server_info_impl.go

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,3 +157,31 @@ func (c *client) echo(ctx context.Context) error {
157157
}
158158
return nil
159159
}
160+
161+
func (c *client) VersionWithOptions(ctx context.Context, details bool) (VersionInfo, error) {
162+
path := "_api/version"
163+
if details {
164+
path = "_api/version?details=true"
165+
}
166+
167+
req, err := c.conn.NewRequest("GET", path)
168+
if err != nil {
169+
return VersionInfo{}, WithStack(err)
170+
}
171+
172+
applyContextSettings(ctx, req)
173+
174+
resp, err := c.conn.Do(ctx, req)
175+
if err != nil {
176+
return VersionInfo{}, WithStack(err)
177+
}
178+
if err := resp.CheckStatus(200); err != nil {
179+
return VersionInfo{}, WithStack(err)
180+
}
181+
182+
var data VersionInfo
183+
if err := resp.ParseBody("", &data); err != nil {
184+
return VersionInfo{}, WithStack(err)
185+
}
186+
return data, nil
187+
}

test/asyncjob_test.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,9 @@ func TestAsyncJobListPending(t *testing.T) {
101101
EnsureVersion(t, ctx, c).CheckVersion(MinimumVersion("3.11.1"))
102102
skipResilientSingle(t)
103103

104+
// for disabling v8 tests
105+
requireV8Enabled(c, ctx, t)
106+
104107
db := ensureDatabase(ctx, c, databaseName("db", "async"), nil, t)
105108
defer func() {
106109
err := db.Remove(ctx)
@@ -254,6 +257,9 @@ func TestAsyncJobDelete(t *testing.T) {
254257
})
255258

256259
t.Run("delete pending job", func(t *testing.T) {
260+
// for disabling v8 tests
261+
requireV8Enabled(c, ctx, t)
262+
257263
idTransaction := runLongRequest(t, ctxAsync, db, 10, col.Name())
258264
require.NotEmpty(t, idTransaction)
259265

@@ -275,6 +281,9 @@ func TestAsyncJobDelete(t *testing.T) {
275281
})
276282

277283
t.Run("delete expired jobs", func(t *testing.T) {
284+
// for disabling v8 tests
285+
requireV8Enabled(c, ctx, t)
286+
278287
idTransaction := runLongRequest(t, ctxAsync, db, 10, col.Name())
279288
require.NotEmpty(t, idTransaction)
280289

test/client_test.go

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -670,3 +670,25 @@ func checkDBAccess(ctx context.Context, conn driver.Connection, dbName, username
670670

671671
return nil
672672
}
673+
674+
// requireV8Enabled skips the test if V8 is disabled in the ArangoDB server.
675+
// V8 is required for features like tasks, UDFs, Foxx, JS transactions, and simple queries.
676+
// This function checks the v8-version field in the version details.
677+
// If v8-version is "none", V8 is disabled and the test will be skipped.
678+
func requireV8Enabled(c driver.Client, ctx context.Context, t testing.TB) {
679+
versionInfo, err := c.VersionWithOptions(ctx, true)
680+
if err != nil {
681+
t.Fatalf("Failed to get version info with details: %s", err)
682+
}
683+
684+
// Check if v8-version exists in Details and if it's "none"
685+
// Only access versionInfo.Details after confirming there's no error
686+
if versionInfo.Details != nil {
687+
if v8Version, ok := versionInfo.Details["v8-version"]; ok {
688+
if v8VersionStr, ok := v8Version.(string); ok && v8VersionStr == "none" {
689+
t.Skip("Skipping test: V8 is disabled in this ArangoDB server (v8-version: none). " +
690+
"This test requires V8 enabled.")
691+
}
692+
}
693+
}
694+
}

test/database_transaction_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,10 @@ import (
3333

3434
func TestDatabaseTransaction(t *testing.T) {
3535
c := createClient(t, nil)
36+
// Ensure minimum version 3.2 for JavaScript transaction support
3637
skipBelowVersion(c, "3.2", t)
38+
// Skip versions above 4.0 where V8 may be disabled (V8 is required for JS transactions)
39+
requireV8Enabled(c, context.Background(), t)
3740
db := ensureDatabase(nil, c, "transaction_test", nil, t)
3841
defer func() {
3942
err := db.Remove(nil)

v2/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
- Add endpoint to fetch deployment id
55
- Add ARM Support for V2 testcases
66
- Set TESTV2PARALLEL from 1 to 4
7+
- Disabled V8 related testcases in V1 and V2
78

89
## [2.1.6](https://github.com/arangodb/go-driver/tree/v2.1.6) (2025-11-06)
910
- Add missing endpoints from replication

v2/arangodb/client_admin.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ type ClientAdmin interface {
6060
// options of the queried arangod instance.
6161
GetStartupConfigurationDescription(ctx context.Context) (map[string]interface{}, error)
6262

63-
// ReloadRoutingTable reloads the routing information from the _routing system collection.
63+
// ReloadRoutingTable reloads the routing information from the _routing system
64+
// collection, causing Foxx services to rebuild their routing table.
6465
ReloadRoutingTable(ctx context.Context, dbName string) error
6566

6667
// ExecuteAdminScript executes JavaScript code on the server.

v2/tests/admin_cluster_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,9 +369,10 @@ func Test_ClusterResignLeadership(t *testing.T) {
369369
}
370370

371371
func Test_ClusterStatistics(t *testing.T) {
372+
requireClusterMode(t)
373+
372374
Wrap(t, func(t *testing.T, client arangodb.Client) {
373375
withContextT(t, defaultTestTimeout, func(ctx context.Context, tb testing.TB) {
374-
requireClusterMode(t)
375376
skipBelowVersion(client, ctx, "3.7", t)
376377
// Detect DB-Server ID
377378
serverRole, err := client.ServerRole(ctx)

v2/tests/admin_test.go

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ func Test_GetServerStatus(t *testing.T) {
143143

144144
func Test_GetDeploymentSupportInfo(t *testing.T) {
145145
Wrap(t, func(t *testing.T, client arangodb.Client) {
146-
withContextT(t, time.Minute, func(ctx context.Context, t testing.TB) {
146+
withContextT(t, defaultTestTimeout, func(ctx context.Context, t testing.TB) {
147147

148148
serverRole, err := client.ServerRole(ctx)
149149
require.NoError(t, err)
@@ -209,7 +209,8 @@ func Test_GetStartupConfiguration(t *testing.T) {
209209
func Test_ReloadRoutingTable(t *testing.T) {
210210
Wrap(t, func(t *testing.T, client arangodb.Client) {
211211
WithDatabase(t, client, nil, func(db arangodb.Database) {
212-
withContextT(t, time.Minute, func(ctx context.Context, t testing.TB) {
212+
withContextT(t, defaultTestTimeout, func(ctx context.Context, t testing.TB) {
213+
requireV8Enabled(client, ctx, t)
213214
err := client.ReloadRoutingTable(ctx, db.Name())
214215
require.NoError(t, err)
215216
})
@@ -221,6 +222,7 @@ func Test_ExecuteAdminScript(t *testing.T) {
221222
Wrap(t, func(t *testing.T, client arangodb.Client) {
222223
WithDatabase(t, client, nil, func(db arangodb.Database) {
223224
withContextT(t, defaultTestTimeout, func(ctx context.Context, tb testing.TB) {
225+
requireV8Enabled(client, ctx, t)
224226
tests := []struct {
225227
name string
226228
script string
@@ -275,7 +277,7 @@ func Test_CompactDatabases(t *testing.T) {
275277
// that may conflict with other tests and server role checks can be inconsistent in parallel execution.
276278

277279
Wrap(t, func(t *testing.T, client arangodb.Client) {
278-
withContextT(t, time.Minute, func(ctx context.Context, t testing.TB) {
280+
withContextT(t, defaultTestTimeout, func(ctx context.Context, t testing.TB) {
279281
if !isNoAuth() {
280282
t.Skip("Skipping: superuser tests run only in no-auth mode (TEST_AUTH=none)")
281283
}
@@ -376,7 +378,7 @@ func validateTLSResponse(t testing.TB, tlsResp arangodb.TLSDataResponse, operati
376378
// Test_ReloadTLSData tests TLS certificate reload functionality, skipping if superuser rights unavailable.
377379
func Test_ReloadTLSData(t *testing.T) {
378380
Wrap(t, func(t *testing.T, client arangodb.Client) {
379-
withContextT(t, time.Minute, func(ctx context.Context, t testing.TB) {
381+
withContextT(t, defaultTestTimeout, func(ctx context.Context, t testing.TB) {
380382
if !isNoAuth() {
381383
t.Skip("Skipping: superuser tests run only in no-auth mode (TEST_AUTH=none)")
382384
}
@@ -397,7 +399,7 @@ func Test_ReloadTLSData(t *testing.T) {
397399
// The test is skipped if superuser rights are missing or the feature is disabled/not configured.
398400
func Test_RotateEncryptionAtRestKey(t *testing.T) {
399401
Wrap(t, func(t *testing.T, client arangodb.Client) {
400-
withContextT(t, time.Minute, func(ctx context.Context, t testing.TB) {
402+
withContextT(t, defaultTestTimeout, func(ctx context.Context, t testing.TB) {
401403
if !isNoAuth() {
402404
t.Skip("Skipping: superuser tests run only in no-auth mode (TEST_AUTH=none)")
403405
}
@@ -464,7 +466,7 @@ func Test_GetJWTSecrets(t *testing.T) {
464466
// Test_ReloadJWTSecrets validates JWT secrets reload functionality, skipping if not available.
465467
func Test_ReloadJWTSecrets(t *testing.T) {
466468
Wrap(t, func(t *testing.T, client arangodb.Client) {
467-
withContextT(t, time.Minute, func(ctx context.Context, t testing.TB) {
469+
withContextT(t, defaultTestTimeout, func(ctx context.Context, t testing.TB) {
468470
resp, err := client.ReloadJWTSecrets(ctx)
469471
if err != nil {
470472
if handleJWTSecretsError(t, err, "ReloadJWTSecrets", []int{http.StatusForbidden, http.StatusBadRequest}) {
@@ -528,7 +530,7 @@ func validateJWTSecretsResponse(t testing.TB, resp arangodb.JWTSecretsResult, op
528530
}
529531
func Test_HandleAdminVersion(t *testing.T) {
530532
Wrap(t, func(t *testing.T, client arangodb.Client) {
531-
withContextT(t, time.Minute, func(ctx context.Context, tb testing.TB) {
533+
withContextT(t, defaultTestTimeout, func(ctx context.Context, tb testing.TB) {
532534
t.Run("With Options", func(t *testing.T) {
533535
resp, err := client.HandleAdminVersion(context.Background(), &arangodb.GetVersionOptions{
534536
Details: utils.NewType(true),
@@ -554,7 +556,7 @@ func Test_HandleAdminVersion(t *testing.T) {
554556
func Test_GetDeploymentId(t *testing.T) {
555557
Wrap(t, func(t *testing.T, client arangodb.Client) {
556558
t.Run("Success case", func(t *testing.T) {
557-
withContextT(t, time.Minute, func(ctx context.Context, t testing.TB) {
559+
withContextT(t, defaultTestTimeout, func(ctx context.Context, t testing.TB) {
558560
version := skipBelowVersion(client, ctx, "3.12.6", t)
559561
t.Logf("Current Version %s", version.Version)
560562

@@ -568,7 +570,7 @@ func Test_GetDeploymentId(t *testing.T) {
568570
})
569571

570572
t.Run("Multiple calls consistency", func(t *testing.T) {
571-
withContextT(t, time.Minute, func(ctx context.Context, t testing.TB) {
573+
withContextT(t, defaultTestTimeout, func(ctx context.Context, t testing.TB) {
572574
version := skipBelowVersion(client, ctx, "3.12.6", t)
573575
t.Logf("Current Version %s", version.Version)
574576

v2/tests/asyncjob_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,8 @@ func TestAsyncJobListPending(t *testing.T) {
111111
skipBelowVersion(client, ctx, "3.11.1", t)
112112
skipResilientSingleMode(t)
113113

114+
requireV8Enabled(client, ctx, t)
115+
114116
ctxAsync := connection.WithAsync(context.Background())
115117

116118
idTransaction := runLongRequest(t, ctxAsync, db, 2, col.Name())
@@ -254,6 +256,7 @@ func TestAsyncJobDelete(t *testing.T) {
254256
})
255257

256258
t.Run("delete pending job", func(t *testing.T) {
259+
requireV8Enabled(client, ctx, t)
257260
idTransaction := runLongRequest(t, ctxAsync, db, 10, col.Name())
258261
require.NotEmpty(t, idTransaction)
259262

@@ -275,6 +278,7 @@ func TestAsyncJobDelete(t *testing.T) {
275278
})
276279

277280
t.Run("delete expired jobs", func(t *testing.T) {
281+
requireV8Enabled(client, ctx, t)
278282
idTransaction := runLongRequest(t, ctxAsync, db, 10, col.Name())
279283
require.NotEmpty(t, idTransaction)
280284

0 commit comments

Comments
 (0)