Skip to content

Commit 3642ecb

Browse files
Disable V8-dependent API tests for V2 since future arangods will ship without V8
1 parent 8d6c073 commit 3642ecb

File tree

6 files changed

+36
-1
lines changed

6 files changed

+36
-1
lines changed

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

v2/tests/database_query_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1302,6 +1302,7 @@ func Test_UserDefinedFunctions(t *testing.T) {
13021302
Wrap(t, func(t *testing.T, client arangodb.Client) {
13031303
WithDatabase(t, client, nil, func(db arangodb.Database) {
13041304
withContextT(t, defaultTestTimeout, func(ctx context.Context, tb testing.TB) {
1305+
requireV8Enabled(client, ctx, tb)
13051306
// Define UDF details
13061307
namespace := "myfunctions::temperature::" + StringWithCharset(16, charset)
13071308
functionName := namespace + "::celsiustofahrenheit"

v2/tests/database_transactionsjs_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ func Test_DatabaseTransactionsJS(t *testing.T) {
3434
Wrap(t, func(t *testing.T, client arangodb.Client) {
3535
WithDatabase(t, client, nil, func(db arangodb.Database) {
3636
WithCollectionV2(t, db, nil, func(col arangodb.Collection) {
37-
37+
requireV8Enabled(client, context.Background(), t)
3838
t.Run("Transaction ReturnValue", func(t *testing.T) {
3939
withContextT(t, defaultTestTimeout, func(ctx context.Context, t testing.TB) {
4040
txJSOptions := arangodb.TransactionJSOptions{

v2/tests/foxx_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ func Test_FoxxItzpapalotlService(t *testing.T) {
3636
Wrap(t, func(t *testing.T, client arangodb.Client) {
3737
WithDatabase(t, client, nil, func(db arangodb.Database) {
3838
withContextT(t, defaultTestTimeout, func(ctx context.Context, tb testing.TB) {
39+
requireV8Enabled(client, ctx, tb)
3940
if os.Getenv("TEST_CONNECTION") == "vst" {
4041
skipBelowVersion(client, ctx, "3.6", t)
4142
}
@@ -298,6 +299,7 @@ func Test_ListInstalledFoxxServices(t *testing.T) {
298299
Wrap(t, func(t *testing.T, client arangodb.Client) {
299300
WithDatabase(t, client, nil, func(db arangodb.Database) {
300301
withContextT(t, defaultTestTimeout, func(ctx context.Context, tb testing.TB) {
302+
requireV8Enabled(client, ctx, tb)
301303
services, err := client.ListInstalledFoxxServices(ctx, db.Name(), nil)
302304
require.NoError(t, err)
303305
require.NotEmpty(t, services)
@@ -325,6 +327,7 @@ func Test_GetInstalledFoxxService(t *testing.T) {
325327
Wrap(t, func(t *testing.T, client arangodb.Client) {
326328
WithDatabase(t, client, nil, func(db arangodb.Database) {
327329
withContextT(t, defaultTestTimeout, func(ctx context.Context, tb testing.TB) {
330+
requireV8Enabled(client, ctx, tb)
328331
mount := "/_api/foxx"
329332
serviceDetails, err := client.GetInstalledFoxxService(ctx, db.Name(), &mount)
330333
require.NoError(t, err)

v2/tests/tasks_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ func Test_CreateNewTask(t *testing.T) {
5555
Wrap(t, func(t *testing.T, client arangodb.Client) {
5656
WithDatabase(t, client, nil, func(db arangodb.Database) {
5757
withContextT(t, defaultTestTimeout, func(ctx context.Context, tb testing.TB) {
58+
requireV8Enabled(client, ctx, tb)
5859
testCases := map[string]*arangodb.TaskOptions{
5960
"taskWithParams": {
6061
Name: utils.NewType("taskWithParams"),
@@ -128,6 +129,7 @@ func Test_ValidationsForCreateNewTask(t *testing.T) {
128129
Wrap(t, func(t *testing.T, client arangodb.Client) {
129130
WithDatabase(t, client, nil, func(db arangodb.Database) {
130131
withContextT(t, defaultTestTimeout, func(ctx context.Context, tb testing.TB) {
132+
requireV8Enabled(client, ctx, tb)
131133
testCases := map[string]*arangodb.TaskOptions{
132134
"taskWithoutCommand": {
133135
Name: utils.NewType("taskWithoutCommand"),
@@ -160,6 +162,7 @@ func Test_TaskCreationWithId(t *testing.T) {
160162
Wrap(t, func(t *testing.T, client arangodb.Client) {
161163
WithDatabase(t, client, nil, func(db arangodb.Database) {
162164
withContextT(t, defaultTestTimeout, func(ctx context.Context, tb testing.TB) {
165+
requireV8Enabled(client, ctx, tb)
163166
taskID := "test-task-id" + StringWithCharset(16, charset)
164167
options := &arangodb.TaskOptions{
165168
ID: &taskID, // Optional if CreateTaskWithID sets it, but safe to keep

v2/tests/util_test.go

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import (
2929
"github.com/stretchr/testify/require"
3030

3131
"github.com/arangodb/go-driver/v2/arangodb"
32+
"github.com/arangodb/go-driver/v2/utils"
3233
)
3334

3435
func getTestMode() string {
@@ -136,3 +137,26 @@ func skipVersionNotInRange(c arangodb.Client, ctx context.Context, minVersion, m
136137
}
137138
return x
138139
}
140+
141+
// requireV8Enabled skips the test if V8 is disabled in the ArangoDB server.
142+
// V8 is required for features like tasks, UDFs, Foxx, JS transactions, and simple queries.
143+
// This function checks the v8-version field in the version details.
144+
// If v8-version is "none", V8 is disabled and the test will be skipped.
145+
func requireV8Enabled(c arangodb.Client, ctx context.Context, t testing.TB) {
146+
versionInfo, err := c.VersionWithOptions(ctx, &arangodb.GetVersionOptions{
147+
Details: utils.NewType(true),
148+
})
149+
if err != nil {
150+
t.Fatalf("Failed to get version info with details: %s", err)
151+
}
152+
153+
// Check if v8-version exists in Details and if it's "none"
154+
if versionInfo.Details != nil {
155+
if v8Version, ok := versionInfo.Details["v8-version"]; ok {
156+
if v8VersionStr, ok := v8Version.(string); ok && v8VersionStr == "none" {
157+
t.Skip("Skipping test: V8 is disabled in this ArangoDB server (v8-version: none). " +
158+
"This test requires V8 enabled.")
159+
}
160+
}
161+
}
162+
}

0 commit comments

Comments
 (0)