From a8b553dd283a7a228c6896ff801457c1584d98b9 Mon Sep 17 00:00:00 2001 From: Alex Petenchea Date: Sun, 14 Jun 2026 16:56:34 +0800 Subject: [PATCH 01/10] experiment --- .circleci/config.yml | 40 ++++++++++++++++++++++++++++++++-------- starter.sh | 8 +++++++- 2 files changed, 39 insertions(+), 9 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 7453ee9..4bebef5 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -2,9 +2,13 @@ version: 2.1 executors: python-container: + parameters: + python_version: + type: string + default: "3.12" docker: - - image: cimg/python:3.12 - resource_class: arangodb/small-amd64 + - image: cimg/python:<< parameters.python_version >> + resource_class: arangodb/medium-amd64 python-vm: machine: image: ubuntu-2404:current @@ -42,7 +46,6 @@ workflows: jobs: lint: executor: python-container - resource_class: arangodb/small-amd64 steps: - checkout - run: @@ -70,9 +73,31 @@ jobs: type: string arangodb_version: type: string - executor: python-vm + executor: + name: python-container + python_version: << parameters.python_version >> steps: - checkout + - run: + name: Resolve ArangoDB Host + command: | + if [ -z "${ARANGO_HOST:-}" ]; then + if getent hosts host.docker.internal >/dev/null 2>&1; then + ARANGO_HOST=host.docker.internal + elif command -v ip >/dev/null 2>&1; then + ARANGO_HOST="$(ip route show default | awk '{print $3; exit}')" + else + ARANGO_HOST=localhost + fi + fi + + if [ -z "$ARANGO_HOST" ]; then + echo "Could not determine ARANGO_HOST" + exit 1 + fi + + echo "export ARANGO_HOST=$ARANGO_HOST" >> "$BASH_ENV" + echo "Using ARANGO_HOST=$ARANGO_HOST" - run: name: Setup ArangoDB command: | @@ -83,9 +108,8 @@ jobs: - run: name: Setup Python command: | - pyenv --version - pyenv install -f << parameters.python_version >> - pyenv global << parameters.python_version >> + python --version + pip --version - run: name: Install Dependencies command: pip install -e .[dev] @@ -97,7 +121,7 @@ jobs: mkdir test-results mkdir htmlcov - args=("--junitxml=test-results/junit.xml" "--log-cli-level=DEBUG" "--host" "localhost" "--port=8529") + args=("--junitxml=test-results/junit.xml" "--log-cli-level=DEBUG" "--host" "$ARANGO_HOST" "--port=8529") if [ << parameters.arangodb_config >> = "cluster" ]; then args+=("--cluster" "--port=8539" "--port=8549") fi diff --git a/starter.sh b/starter.sh index 6ca977c..1b32e69 100755 --- a/starter.sh +++ b/starter.sh @@ -6,6 +6,10 @@ # Usage: # ./starter.sh [single|cluster] [community|enterprise|enterprise-preview] [version] # ./starter.sh [single|cluster] [image[:tag]] +# +# Environment: +# ARANGO_HOST: host used by this script's readiness check. Defaults to localhost. +# # Example: # ./starter.sh cluster enterprise 3.12.4 # ./starter.sh single enterprise-preview 4.0-nightly @@ -14,6 +18,7 @@ setup="${1:-single}" image="${2:-community}" version="${3:-latest}" +arango_host="${ARANGO_HOST:-localhost}" extra_ports="" if [ "$setup" == "single" ]; then @@ -74,7 +79,8 @@ if [ $? -ne 0 ]; then exit 1 fi -wget --quiet --waitretry=1 --tries=120 -O - http://localhost:8528/version | jq +echo "Waiting for ArangoDB at http://$arango_host:8528/version" +wget --quiet --waitretry=1 --tries=120 -O - "http://$arango_host:8528/version" | jq if [ $? -eq 0 ]; then echo "OK starter ready" exit 0 From f04be05d9f1a9e0f700357b71151765c05d6bec7 Mon Sep 17 00:00:00 2001 From: Alex Petenchea Date: Sun, 14 Jun 2026 17:49:38 +0800 Subject: [PATCH 02/10] enabling remote docker --- .circleci/config.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 4bebef5..1ae42e3 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -78,11 +78,15 @@ jobs: python_version: << parameters.python_version >> steps: - checkout + - setup_remote_docker - run: name: Resolve ArangoDB Host command: | if [ -z "${ARANGO_HOST:-}" ]; then - if getent hosts host.docker.internal >/dev/null 2>&1; then + if [ -n "${DOCKER_HOST:-}" ]; then + ARANGO_HOST="${DOCKER_HOST#tcp://}" + ARANGO_HOST="${ARANGO_HOST%%:*}" + elif getent hosts host.docker.internal >/dev/null 2>&1; then ARANGO_HOST=host.docker.internal elif command -v ip >/dev/null 2>&1; then ARANGO_HOST="$(ip route show default | awk '{print $3; exit}')" @@ -98,6 +102,9 @@ jobs: echo "export ARANGO_HOST=$ARANGO_HOST" >> "$BASH_ENV" echo "Using ARANGO_HOST=$ARANGO_HOST" + - run: + name: Check Docker + command: docker version - run: name: Setup ArangoDB command: | From 1436c61067cdd73e78e9aaa854342de42e0292ad Mon Sep 17 00:00:00 2001 From: Alex Petenchea Date: Sun, 14 Jun 2026 21:22:52 +0800 Subject: [PATCH 03/10] using arangodb container --- .circleci/config.yml | 116 +++++++++++++++++++++++++------------------ 1 file changed, 67 insertions(+), 49 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 1ae42e3..40b023d 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -9,6 +9,16 @@ executors: docker: - image: cimg/python:<< parameters.python_version >> resource_class: arangodb/medium-amd64 + arangodb-container: + parameters: + arangodb_image: + type: string + docker: + - image: << parameters.arangodb_image >> + entrypoint: /bin/sh + command: -c "while true; do sleep 10; done" + user: root + resource_class: arangodb/medium-amd64 python-vm: machine: image: ubuntu-2404:current @@ -19,29 +29,21 @@ workflows: jobs: - lint - test: - name: Python (<< matrix.python_version >>) - ArangoDB (enterprise, << matrix.arangodb_version >> << matrix.arangodb_config >>) + name: ArangoDB (enterprise, 3.12 << matrix.arangodb_config >>) matrix: parameters: - python_version: ["3.13"] arangodb_config: ["single", "cluster"] arangodb_license: ["enterprise"] - arangodb_version: ["3.12"] + arangodb_image: ["arangodb/enterprise:3.12"] + arangodb_conf_version: ["3.12"] - test: - name: Python (<< matrix.python_version >>) - ArangoDB (enterprise-preview, << matrix.arangodb_version >> << matrix.arangodb_config >>) + name: ArangoDB (enterprise-preview, 4.0-nightly << matrix.arangodb_config >>) matrix: parameters: - python_version: ["3.13"] arangodb_config: ["single", "cluster"] arangodb_license: ["enterprise-preview"] - arangodb_version: ["4.0-nightly"] - - test: - name: Python (<< matrix.python_version >>) - ArangoDB (enterprise, 3.12 cluster) - matrix: - parameters: - python_version: ["3.10", "3.11", "3.12"] - arangodb_config: ["cluster"] - arangodb_license: ["enterprise"] - arangodb_version: ["3.12"] + arangodb_image: ["arangodb/enterprise-preview:4.0-nightly"] + arangodb_conf_version: ["4.0"] jobs: lint: @@ -65,70 +67,86 @@ jobs: command: mypy ./arangoasync test: parameters: - python_version: - type: string arangodb_config: type: string arangodb_license: type: string - arangodb_version: + arangodb_image: + type: string + arangodb_conf_version: type: string executor: - name: python-container - python_version: << parameters.python_version >> + name: arangodb-container + arangodb_image: << parameters.arangodb_image >> steps: + - run: + name: Bootstrap CI Tools + command: | + apk add --no-cache \ + bash \ + build-base \ + ca-certificates \ + curl \ + git \ + jq \ + openssh-client \ + openssl-dev \ + py3-pip \ + py3-virtualenv \ + python3 \ + python3-dev \ + wget - checkout - - setup_remote_docker - run: - name: Resolve ArangoDB Host + name: Setup ArangoDB command: | - if [ -z "${ARANGO_HOST:-}" ]; then - if [ -n "${DOCKER_HOST:-}" ]; then - ARANGO_HOST="${DOCKER_HOST#tcp://}" - ARANGO_HOST="${ARANGO_HOST%%:*}" - elif getent hosts host.docker.internal >/dev/null 2>&1; then - ARANGO_HOST=host.docker.internal - elif command -v ip >/dev/null 2>&1; then - ARANGO_HOST="$(ip route show default | awk '{print $3; exit}')" - else - ARANGO_HOST=localhost - fi + mkdir -p /tests + if [ ! -e /tests/static ]; then + ln -s "$PWD/tests/static" /tests/static fi - if [ -z "$ARANGO_HOST" ]; then - echo "Could not determine ARANGO_HOST" + conf_file="/tests/static/<< parameters.arangodb_config >>-<< parameters.arangodb_conf_version >>.conf" + if [ ! -f "$conf_file" ]; then + echo "Missing configuration file: $conf_file" exit 1 fi - echo "export ARANGO_HOST=$ARANGO_HOST" >> "$BASH_ENV" - echo "Using ARANGO_HOST=$ARANGO_HOST" - - run: - name: Check Docker - command: docker version - - run: - name: Setup ArangoDB - command: | - chmod +x starter.sh - ./starter.sh << parameters.arangodb_config >> << parameters.arangodb_license >> << parameters.arangodb_version >> + arangodb --configuration="$conf_file" > arangodb.log 2>&1 & + echo "$!" > arangodb.pid + + echo "Waiting for ArangoDB at http://localhost:8528/version" + wget --quiet --waitretry=1 --tries=120 -O - http://localhost:8528/version | jq - restore_cache: key: pip-and-local-cache - run: name: Setup Python + shell: /bin/bash -eo pipefail command: | + python3 --version + python3 -m virtualenv .venv + source .venv/bin/activate python --version - pip --version + python -m pip --version - run: name: Install Dependencies - command: pip install -e .[dev] - - run: docker ps -a - - run: docker logs arango + shell: /bin/bash -eo pipefail + command: | + source .venv/bin/activate + python -m pip install -e .[dev] + - run: + name: Show ArangoDB Logs + command: tail -n 200 arangodb.log + when: always - run: name: Run pytest + shell: /bin/bash -eo pipefail command: | mkdir test-results mkdir htmlcov - args=("--junitxml=test-results/junit.xml" "--log-cli-level=DEBUG" "--host" "$ARANGO_HOST" "--port=8529") + source .venv/bin/activate + + args=("--junitxml=test-results/junit.xml" "--log-cli-level=DEBUG" "--host" "localhost" "--port=8529") if [ << parameters.arangodb_config >> = "cluster" ]; then args+=("--cluster" "--port=8539" "--port=8549") fi From 4bf03601d1fe01a6e2fa23d08d238118b896d106 Mon Sep 17 00:00:00 2001 From: Alex Petenchea Date: Sun, 14 Jun 2026 21:31:01 +0800 Subject: [PATCH 04/10] fix --- .circleci/config.yml | 37 +++++++++++++++++++++++++++++++------ 1 file changed, 31 insertions(+), 6 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 40b023d..7fa8f7d 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -114,10 +114,39 @@ jobs: arangodb --configuration="$conf_file" > arangodb.log 2>&1 & echo "$!" > arangodb.pid - echo "Waiting for ArangoDB at http://localhost:8528/version" - wget --quiet --waitretry=1 --tries=120 -O - http://localhost:8528/version | jq + ports="8529" + if [ << parameters.arangodb_config >> = "cluster" ]; then + ports="$ports 8539 8549" + fi + + for port in $ports; do + echo "Waiting for ArangoDB at http://localhost:$port/_api/version" + for attempt in $(seq 1 120); do + if curl --fail --silent --show-error \ + --user root:passwd \ + "http://localhost:$port/_api/version" | jq; then + break + fi + + if ! kill -0 "$(cat arangodb.pid)" 2>/dev/null; then + echo "ArangoDB process exited before port $port became ready" + exit 1 + fi + + if [ "$attempt" -eq 120 ]; then + echo "Timed out waiting for ArangoDB on port $port" + exit 1 + fi + + sleep 1 + done + done - restore_cache: key: pip-and-local-cache + - run: + name: Show ArangoDB Logs + command: tail -n 200 arangodb.log + when: always - run: name: Setup Python shell: /bin/bash -eo pipefail @@ -133,10 +162,6 @@ jobs: command: | source .venv/bin/activate python -m pip install -e .[dev] - - run: - name: Show ArangoDB Logs - command: tail -n 200 arangodb.log - when: always - run: name: Run pytest shell: /bin/bash -eo pipefail From ea961c9df5f6586c8cb42901bb2d4871c53706f8 Mon Sep 17 00:00:00 2001 From: Alex Petenchea Date: Sun, 14 Jun 2026 21:40:22 +0800 Subject: [PATCH 05/10] fix --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 7fa8f7d..1d13e82 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -181,7 +181,7 @@ jobs: fi echo "Running pytest with args: ${args[@]}" - pytest --cov=arangoasync --cov-report=html:htmlcov --color=yes --code-highlight=yes "${args[@]}" + pytest tests --cov=arangoasync --cov-report=html:htmlcov --color=yes --code-highlight=yes "${args[@]}" - store_artifacts: path: htmlcov destination: coverage-report From 051a0646465df68c9494881f30ebd29ff03b1567 Mon Sep 17 00:00:00 2001 From: Alex Petenchea Date: Sun, 21 Jun 2026 17:31:12 +0800 Subject: [PATCH 06/10] reverted starter.sh --- starter.sh | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/starter.sh b/starter.sh index 1b32e69..6ca977c 100755 --- a/starter.sh +++ b/starter.sh @@ -6,10 +6,6 @@ # Usage: # ./starter.sh [single|cluster] [community|enterprise|enterprise-preview] [version] # ./starter.sh [single|cluster] [image[:tag]] -# -# Environment: -# ARANGO_HOST: host used by this script's readiness check. Defaults to localhost. -# # Example: # ./starter.sh cluster enterprise 3.12.4 # ./starter.sh single enterprise-preview 4.0-nightly @@ -18,7 +14,6 @@ setup="${1:-single}" image="${2:-community}" version="${3:-latest}" -arango_host="${ARANGO_HOST:-localhost}" extra_ports="" if [ "$setup" == "single" ]; then @@ -79,8 +74,7 @@ if [ $? -ne 0 ]; then exit 1 fi -echo "Waiting for ArangoDB at http://$arango_host:8528/version" -wget --quiet --waitretry=1 --tries=120 -O - "http://$arango_host:8528/version" | jq +wget --quiet --waitretry=1 --tries=120 -O - http://localhost:8528/version | jq if [ $? -eq 0 ]; then echo "OK starter ready" exit 0 From 0f4fa6d26caf86b92fd0e1840db73d8b309521a5 Mon Sep 17 00:00:00 2001 From: Alex Petenchea Date: Sun, 21 Jun 2026 17:42:30 +0800 Subject: [PATCH 07/10] added imports test --- tests/conftest.py | 13 +++++++++++++ tests/test_imports.py | 21 +++++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 tests/test_imports.py diff --git a/tests/conftest.py b/tests/conftest.py index e935a10..6c81ab6 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -31,6 +31,7 @@ class GlobalData: foxx_path: str = None backup_path: str = None db_version: version.Version = version.parse("0.0.0") + skip_arango_setup: bool = False global_data = GlobalData() @@ -82,9 +83,18 @@ def pytest_addoption(parser): default=[], help="Skip specific tests", ) + parser.addoption( + "--skip-arango-setup", + action="store_true", + help="Skip the ArangoDB connection check during pytest configuration", + ) def pytest_configure(config): + if config.getoption("skip_arango_setup"): + global_data.skip_arango_setup = True + return + ports = config.getoption("port") or ["8529"] hosts = [f"http://{config.getoption('host')}:{p}" for p in ports] url = hosts[0] @@ -286,6 +296,9 @@ def db_version(): @pytest_asyncio.fixture(autouse=True) async def teardown(): yield + if global_data.skip_arango_setup: + return + async with ArangoClient(hosts=global_data.url) as client: sys_db = await client.db( global_data.sys_db_name, diff --git a/tests/test_imports.py b/tests/test_imports.py new file mode 100644 index 0000000..413da3f --- /dev/null +++ b/tests/test_imports.py @@ -0,0 +1,21 @@ +import importlib +import pkgutil + +import pytest + +import arangoasync + + +def arangoasync_modules(): + yield arangoasync.__name__ + + for module_info in pkgutil.walk_packages( + arangoasync.__path__, + prefix=f"{arangoasync.__name__}.", + ): + yield module_info.name + + +@pytest.mark.parametrize("module_name", sorted(arangoasync_modules())) +def test_import_module(module_name): + importlib.import_module(module_name) From cbd6d8fe3bccaadc21a10d39cf890b7f4076a742 Mon Sep 17 00:00:00 2001 From: Alex Petenchea Date: Sun, 21 Jun 2026 17:43:51 +0800 Subject: [PATCH 08/10] added imports test to the CI --- .circleci/config.yml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 1d13e82..ba574cd 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -28,6 +28,11 @@ workflows: ci: jobs: - lint + - import-test: + name: Imports (Python << matrix.python_version >>) + matrix: + parameters: + python_version: ["3.10", "3.11", "3.12", "3.13"] - test: name: ArangoDB (enterprise, 3.12 << matrix.arangodb_config >>) matrix: @@ -65,6 +70,23 @@ jobs: - run: name: Run mypy command: mypy ./arangoasync + import-test: + parameters: + python_version: + type: string + executor: + name: python-container + python_version: << parameters.python_version >> + steps: + - checkout + - run: + name: Install Dependencies + command: | + python --version + python -m pip install .[dev] + - run: + name: Run Import Tests + command: pytest --skip-arango-setup --color=yes --code-highlight=yes -k test_imports.py test: parameters: arangodb_config: From db36fff1317008ef4b02b57294a289b051d28adb Mon Sep 17 00:00:00 2001 From: Alex Petenchea Date: Sun, 21 Jun 2026 18:05:38 +0800 Subject: [PATCH 09/10] simplified and added arangodb/ images --- .circleci/config.yml | 37 +++++++++++-------------------------- 1 file changed, 11 insertions(+), 26 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index ba574cd..1f30cfe 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,15 +1,15 @@ version: 2.1 executors: - python-container: + python-container: # used by lint and import-test jobs parameters: python_version: type: string - default: "3.12" + default: "3.14" docker: - image: cimg/python:<< parameters.python_version >> - resource_class: arangodb/medium-amd64 - arangodb-container: + resource_class: arangodb/small-amd64 + arangodb-container: # runs integration tests parameters: arangodb_image: type: string @@ -19,10 +19,6 @@ executors: command: -c "while true; do sleep 10; done" user: root resource_class: arangodb/medium-amd64 - python-vm: - machine: - image: ubuntu-2404:current - resource_class: medium workflows: ci: @@ -32,21 +28,19 @@ workflows: name: Imports (Python << matrix.python_version >>) matrix: parameters: - python_version: ["3.10", "3.11", "3.12", "3.13"] - - test: + python_version: ["3.10", "3.11", "3.12", "3.13", "3.14"] + - integration-test: name: ArangoDB (enterprise, 3.12 << matrix.arangodb_config >>) matrix: parameters: arangodb_config: ["single", "cluster"] - arangodb_license: ["enterprise"] arangodb_image: ["arangodb/enterprise:3.12"] arangodb_conf_version: ["3.12"] - - test: + - integration-test: name: ArangoDB (enterprise-preview, 4.0-nightly << matrix.arangodb_config >>) matrix: parameters: arangodb_config: ["single", "cluster"] - arangodb_license: ["enterprise-preview"] arangodb_image: ["arangodb/enterprise-preview:4.0-nightly"] arangodb_conf_version: ["4.0"] @@ -57,7 +51,7 @@ jobs: - checkout - run: name: Install Dependencies - command: pip install .[dev] + command: python -m pip install .[dev] - run: name: Run black command: black --check --verbose --diff --color --config=pyproject.toml ./arangoasync ./tests/ @@ -86,13 +80,11 @@ jobs: python -m pip install .[dev] - run: name: Run Import Tests - command: pytest --skip-arango-setup --color=yes --code-highlight=yes -k test_imports.py - test: + command: python -m pytest tests/test_imports.py --skip-arango-setup --color=yes --code-highlight=yes + integration-test: parameters: arangodb_config: type: string - arangodb_license: - type: string arangodb_image: type: string arangodb_conf_version: @@ -116,8 +108,7 @@ jobs: py3-pip \ py3-virtualenv \ python3 \ - python3-dev \ - wget + python3-dev - checkout - run: name: Setup ArangoDB @@ -163,8 +154,6 @@ jobs: sleep 1 done done - - restore_cache: - key: pip-and-local-cache - run: name: Show ArangoDB Logs command: tail -n 200 arangodb.log @@ -198,10 +187,6 @@ jobs: args+=("--cluster" "--port=8539" "--port=8549") fi - if [ << parameters.arangodb_license >> != "enterprise" ] && [ << parameters.arangodb_license >> != "enterprise-preview" ]; then - args+=("--skip" "enterprise") - fi - echo "Running pytest with args: ${args[@]}" pytest tests --cov=arangoasync --cov-report=html:htmlcov --color=yes --code-highlight=yes "${args[@]}" - store_artifacts: From e89b616d3680daa504c3ebbaa413a4c89e9073c4 Mon Sep 17 00:00:00 2001 From: Alex Petenchea Date: Sun, 21 Jun 2026 20:45:31 +0800 Subject: [PATCH 10/10] adding arangodb.log to artifacts --- .circleci/config.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 1f30cfe..240fec1 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -156,7 +156,7 @@ jobs: done - run: name: Show ArangoDB Logs - command: tail -n 200 arangodb.log + command: tail -n 1000 arangodb.log when: always - run: name: Setup Python @@ -194,5 +194,7 @@ jobs: destination: coverage-report - store_artifacts: path: test-results + - store_artifacts: + path: arangodb.log - store_test_results: path: test-results