Skip to content

update arangodb matrix #334

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Apr 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ workflows:
python_version: ["3.8", "3.9", "3.10", "3.11"] # "3.12"
arangodb_config: ["single", "cluster"]
arangodb_license: ["community", "enterprise"]
arangodb_version: ["3.10.10", "3.11.4", "latest"]
arangodb_version: ["3.11", "latest"]

jobs:
lint:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ database natively supporting documents, graphs and search.

## Requirements

- ArangoDB version 3.9+
- ArangoDB version 3.11+
- Python version 3.8+

## Installation
Expand Down
2 changes: 1 addition & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Welcome to the documentation for **python-arango**, a Python driver for ArangoDB
Requirements
=============

- ArangoDB version 3.9+
- ArangoDB version 3.11+
- Python version 3.8+

Installation
Expand Down
6 changes: 2 additions & 4 deletions tests/test_analyzer.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from packaging import version

from arango.exceptions import (
AnalyzerCreateError,
AnalyzerDeleteError,
Expand All @@ -9,7 +7,7 @@
from tests.helpers import assert_raises, generate_analyzer_name


def test_analyzer_management(db, bad_db, cluster, enterprise, db_version):
def test_analyzer_management(db, bad_db, cluster, enterprise):
analyzer_name = generate_analyzer_name()
full_analyzer_name = db.name + "::" + analyzer_name
bad_analyzer_name = generate_analyzer_name()
Expand Down Expand Up @@ -60,7 +58,7 @@ def test_analyzer_management(db, bad_db, cluster, enterprise, db_version):
assert db.delete_analyzer(analyzer_name, ignore_missing=True) is False

# Test create geo_s2 analyzer (EE only)
if enterprise and db_version >= version.parse("3.10.5"):
if enterprise:
analyzer_name = generate_analyzer_name()
result = db.create_analyzer(analyzer_name, "geo_s2", {})
assert result["type"] == "geo_s2"
Expand Down
5 changes: 2 additions & 3 deletions tests/test_aql.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,7 @@ def test_aql_query_management(db_version, db, bad_db, col, docs):
assert "state" in query
assert "bind_vars" in query
assert "runtime" in query
if db_version >= version.parse("3.11"):
assert "peak_memory_usage" in query
assert "peak_memory_usage" in query
assert len(queries) == 2

# Test list queries with bad database
Expand Down Expand Up @@ -247,7 +246,7 @@ def test_aql_query_management(db_version, db, bad_db, col, docs):


def test_aql_query_force_one_shard_attribute_value(db, db_version, enterprise, cluster):
if db_version < version.parse("3.10") or not enterprise or not cluster:
if not enterprise or not cluster:
return

name = generate_col_name()
Expand Down
6 changes: 1 addition & 5 deletions tests/test_cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import warnings

import pytest
from packaging import version

from arango.errno import DATABASE_NOT_FOUND, FORBIDDEN
from arango.exceptions import (
Expand Down Expand Up @@ -185,13 +184,10 @@ def test_cluster_server_count(db, bad_db, cluster):
assert err.value.error_code in {FORBIDDEN, DATABASE_NOT_FOUND}


def test_cluster_rebalance(sys_db, bad_db, cluster, db_version):
def test_cluster_rebalance(sys_db, bad_db, cluster):
if not cluster:
pytest.skip("Only tested in a cluster setup")

if db_version < version.parse("3.10.0"):
pytest.skip("Only tested on ArangoDB 3.10+")

# Test imbalance retrieval
imbalance = sys_db.cluster.calculate_imbalance()
assert "leader" in imbalance
Expand Down
11 changes: 2 additions & 9 deletions tests/test_collection.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import pytest
from packaging import version

from arango.client import ArangoClient
from arango.collection import StandardCollection
Expand Down Expand Up @@ -316,21 +315,15 @@ def special_db_names(sys_db):
pass


def test_collection_utf8(db, db_version, special_collection_names):
if db_version < version.parse("3.11.0"):
pytest.skip("UTF8 collection names require ArangoDB 3.11+")

def test_collection_utf8(db, special_collection_names):
for name in special_collection_names:
create_and_delete_collection(db, name)


# Not sure if this belongs in here or in `test_database.py`...
def test_database_and_collection_utf8(
sys_db, db_version, special_collection_names, special_db_names
sys_db, special_collection_names, special_db_names
):
if db_version < version.parse("3.11.0"):
pytest.skip("UTF8 collection names require ArangoDB 3.11+")

client = ArangoClient(hosts="http://127.0.0.1:8529")
for db_name in special_db_names:
username = generate_username()
Expand Down
42 changes: 16 additions & 26 deletions tests/test_cursor.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import pytest
from packaging import version

from arango.exceptions import (
CursorCloseError,
Expand Down Expand Up @@ -263,7 +262,7 @@ def test_cursor_manual_fetch_and_pop(db, col, docs):
assert err.value.message == "current batch is empty"


def test_cursor_retry_disabled(db, col, docs, db_version):
def test_cursor_retry_disabled(db, col, docs):
cursor = db.aql.execute(
f"FOR d IN {col.name} SORT d._key RETURN d",
count=True,
Expand All @@ -282,8 +281,7 @@ def test_cursor_retry_disabled(db, col, docs, db_version):
# The next batch ID should have no effect
cursor._next_batch_id = "2"
result = cursor.fetch()
if db_version >= version.parse("3.11.1"):
assert result["next_batch_id"] == "4"
assert result["next_batch_id"] == "4"
doc = cursor.pop()
assert clean_doc(doc) == docs[2]

Expand All @@ -308,28 +306,25 @@ def test_cursor_retry(db, col, docs, db_version):

result = cursor.fetch()
assert result["id"] == cursor.id
if db_version >= version.parse("3.11.0"):
assert result["next_batch_id"] == "3"
assert result["next_batch_id"] == "3"
doc = cursor.pop()
assert clean_doc(doc) == docs[1]
assert cursor.empty()

# Decrease the next batch ID as if the previous fetch failed
if db_version >= version.parse("3.11.0"):
cursor._next_batch_id = "2"
result = cursor.fetch()
assert result["id"] == cursor.id
assert result["next_batch_id"] == "3"
doc = cursor.pop()
assert clean_doc(doc) == docs[1]
assert cursor.empty()
cursor._next_batch_id = "2"
result = cursor.fetch()
assert result["id"] == cursor.id
assert result["next_batch_id"] == "3"
doc = cursor.pop()
assert clean_doc(doc) == docs[1]
assert cursor.empty()

# Fetch the next batches normally
for batch in range(2, 5):
result = cursor.fetch()
assert result["id"] == cursor.id
if db_version >= version.parse("3.11.0"):
assert result["next_batch_id"] == str(batch + 2)
assert result["next_batch_id"] == str(batch + 2)
doc = cursor.pop()
assert clean_doc(doc) == docs[batch]

Expand All @@ -340,17 +335,12 @@ def test_cursor_retry(db, col, docs, db_version):
doc = cursor.pop()
assert clean_doc(doc) == docs[-1]

if db_version >= version.parse("3.11.0"):
# We should be able to fetch the last batch again
cursor.fetch()
doc = cursor.pop()
assert clean_doc(doc) == docs[-1]
# We should be able to fetch the last batch again
cursor.fetch()
doc = cursor.pop()
assert clean_doc(doc) == docs[-1]

if db_version >= version.parse("3.11.0"):
assert cursor.close()
else:
with pytest.raises(CursorCloseError):
cursor.close()
assert cursor.close()


def test_cursor_no_count(db, col):
Expand Down
6 changes: 1 addition & 5 deletions tests/test_database.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from datetime import datetime

import pytest
from packaging import version

from arango.aql import AQL
from arango.backup import Backup
Expand Down Expand Up @@ -416,10 +415,7 @@ def special_db_names(sys_db):
pass


def test_database_utf8(sys_db, db_version, special_db_names):
if db_version < version.parse("3.11.0"):
pytest.skip("UTF8 collection names require ArangoDB 3.11+")

def test_database_utf8(sys_db, special_db_names):
for name in special_db_names:
assert sys_db.create_database(name)
assert sys_db.has_database(name)
Expand Down
7 changes: 2 additions & 5 deletions tests/test_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,10 +220,7 @@ def test_add_ttl_index(icol):
icol.delete_index(result["id"])


def test_add_inverted_index(icol, enterprise, db_version):
if db_version < version.parse("3.10.0"):
pytest.skip("Inverted indexes are not supported before 3.10.0")

def test_add_inverted_index(icol, enterprise):
parameters = dict(
fields=[{"name": "attr1", "cache": True}],
name="c0_cached",
Expand All @@ -234,7 +231,7 @@ def test_add_inverted_index(icol, enterprise, db_version):
)
expected_keys = ["primary_sort", "analyzer", "include_all_fields", "search_field"]

if enterprise and db_version >= version.parse("3.10.2"):
if enterprise:
parameters["cache"] = True
parameters["primaryKeyCache"] = True
expected_keys.extend(["cache", "primaryKeyCache"])
Expand Down
15 changes: 3 additions & 12 deletions tests/test_pregel.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,7 @@
import pytest
from packaging import version

from arango.exceptions import (
PregelJobCreateError,
PregelJobDeleteError,
PregelJobGetError,
)
from arango.exceptions import PregelJobCreateError, PregelJobDeleteError
from tests.helpers import assert_raises, generate_string


Expand Down Expand Up @@ -58,13 +54,8 @@ def test_pregel_management(db, db_version, graph, cluster):
# Test delete existing pregel job
assert db.pregel.delete_job(job_id) is True
time.sleep(0.2)
if db_version < version.parse("3.11.0"):
with assert_raises(PregelJobGetError) as err:
db.pregel.job(job_id)
assert err.value.error_code in {4, 10, 1600}
else:
job = db.pregel.job(job_id)
assert job["state"] == "canceled"
job = db.pregel.job(job_id)
assert job["state"] == "canceled"

# Test delete missing pregel job
with assert_raises(PregelJobDeleteError) as err:
Expand Down
10 changes: 3 additions & 7 deletions tests/test_view.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from packaging import version

from arango.exceptions import (
ViewCreateError,
ViewDeleteError,
Expand Down Expand Up @@ -180,7 +178,7 @@ def test_arangosearch_view_management(db, bad_db, cluster):
assert db.delete_view(view_name, ignore_missing=False) is True


def test_arangosearch_view_properties(db, col, enterprise, db_version):
def test_arangosearch_view_properties(db, col, enterprise):
view_name = generate_view_name()
params = {"consolidationIntervalMsec": 50000}

Expand All @@ -199,10 +197,8 @@ def test_arangosearch_view_properties(db, col, enterprise, db_version):
}
)

if db_version >= version.parse("3.9.6"):
params.update({"primarySortCache": True, "primaryKeyCache": True})
if db_version >= version.parse("3.10.3"):
params.update({"storedValues": ["attr1", "attr2"]})
params.update({"primarySortCache": True, "primaryKeyCache": True})
params.update({"storedValues": ["attr1", "attr2"]})

result = db.create_arangosearch_view(view_name, properties=params)
assert "id" in result
Expand Down
Loading