Skip to content

Commit 505e085

Browse files
committed
adding circleci configuration
1 parent 23b96bb commit 505e085

21 files changed

+435
-193
lines changed

.circleci/config.yml

+154-16
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,164 @@
1-
# Use the latest 2.1 version of CircleCI pipeline process engine.
2-
# See: https://circleci.com/docs/configuration-reference
31
version: 2.1
42

5-
# Define a job to be invoked later in a workflow.
6-
# See: https://circleci.com/docs/configuration-reference/#jobs
3+
parameters:
4+
preview:
5+
type: boolean
6+
default: true
7+
3-10:
8+
type: boolean
9+
default: true
10+
3-11:
11+
type: boolean
12+
default: true
13+
714
jobs:
8-
say-hello:
9-
# Specify the execution environment. You can specify an image from Docker Hub or use one of our convenience images from CircleCI's Developer Hub.
10-
# See: https://circleci.com/docs/configuration-reference/#executor-job
15+
run-tests:
16+
resource_class: small
17+
parameters:
18+
python-version:
19+
type: string
20+
default: "latest"
21+
arangodb-version:
22+
type: string
23+
default: "arangodb:latest"
24+
arangodb-config:
25+
type: string
26+
default: "single.conf"
27+
cluster:
28+
type: boolean
29+
default: false
30+
enterprise:
31+
type: boolean
32+
default: false
1133
docker:
12-
- image: cimg/base:stable
13-
# Add steps to the job
14-
# See: https://circleci.com/docs/configuration-reference/#steps
34+
- image: python:<< parameters.python-version >>
35+
command: ["/bin/sh", "-c", "python -m http.server"]
36+
- image: arangodb/<< parameters.arangodb-version >>
37+
environment:
38+
ARANGODB_CONF: << parameters.arangodb-config >>
39+
PROJECT: /root/project
40+
command:
41+
- "/bin/sh"
42+
- "-c"
43+
- >
44+
while ! wget -q -O /dev/null http://localhost:8000/$PROJECT/tests/static/setup.sh; do sleep 1; done &&
45+
wget -O - http://localhost:8000/$PROJECT/tests/static/setup.sh |
46+
/bin/sh
1547
steps:
1648
- checkout
1749
- run:
18-
name: "Say hello"
19-
command: "echo Hello, World!"
50+
name: "Install Dependencies"
51+
command: |
52+
pip install -e .[dev]
53+
- run:
54+
name: "Wait for ArangoDB starter"
55+
command: |
56+
wget --quiet --waitretry=1 --tries=120 -O - http://localhost:8528/version
57+
if [ $? -eq 0 ]; then
58+
echo "starter ready"
59+
exit 0
60+
else
61+
echo "starter not ready, giving up"
62+
exit 1
63+
fi
64+
- run:
65+
name: "Run pytest"
66+
command: |
67+
mkdir test-results
68+
args=("--log-cli-level=DEBUG" "--host" "localhost" "--junitxml=./test-results/junit.xml")
69+
if [ << parameters.cluster >> = true ]; then
70+
args+=("--cluster" "--port=8529" "--port=8539" "--port=8549")
71+
else
72+
args+=("--port=8529")
73+
fi
74+
if [ << parameters.enterprise >> = true ]; then
75+
args+=("--enterprise")
76+
fi
77+
echo "Running py.test with args: ${args[@]}"
78+
py.test "${args[@]}"
79+
- store_test_results:
80+
path: ./test-results/junit.xml
81+
- store_artifacts:
82+
path: ./test-results
2083

21-
# Orchestrate jobs using workflows
22-
# See: https://circleci.com/docs/configuration-reference/#workflows
2384
workflows:
24-
say-hello-workflow:
85+
python-3.8-community-single-3.10:
86+
when: << pipeline.parameters.3-10 >>
87+
jobs:
88+
- run-tests:
89+
name: python-3.8-community-single-3.10
90+
python-version: "3.8.2"
91+
arangodb-version: "arangodb:3.10.10"
92+
arangodb-config: "single-3.10.conf"
93+
cluster: false
94+
enterprise: false
95+
python-3.8-enterprise-cluster-3.10:
96+
when: << pipeline.parameters.3-10 >>
97+
jobs:
98+
- run-tests:
99+
name: python-3.8-enterprise-cluster-3.10
100+
python-version: "3.8.2"
101+
arangodb-version: "enterprise:3.10.10"
102+
arangodb-config: "cluster-3.10.conf"
103+
cluster: true
104+
enterprise: true
105+
python-3.10-community-single-3.11:
106+
when: << pipeline.parameters.3-11 >>
107+
jobs:
108+
- run-tests:
109+
name: python-3.10-community-single-3.11
110+
python-version: "3.10.6"
111+
arangodb-version: "arangodb:3.11.4"
112+
arangodb-config: "single.conf"
113+
cluster: false
114+
enterprise: false
115+
python-3.10-community-cluster-3.11:
116+
when: << pipeline.parameters.3-11 >>
117+
jobs:
118+
- run-tests:
119+
name: python-3.10-community-cluster-3.11
120+
python-version: "3.10.6"
121+
arangodb-version: "arangodb:3.11.4"
122+
arangodb-config: "cluster.conf"
123+
cluster: true
124+
enterprise: false
125+
python-3.10-enterprise-single-3.11:
126+
when: << pipeline.parameters.3-11 >>
127+
jobs:
128+
- run-tests:
129+
name: python-3.10-enterprise-single-3.11
130+
python-version: "3.10.6"
131+
arangodb-version: "enterprise:3.11.4"
132+
arangodb-config: "single.conf"
133+
cluster: false
134+
enterprise: true
135+
python-3.10-enterprise-cluster-3.11:
136+
when: << pipeline.parameters.3-11 >>
137+
jobs:
138+
- run-tests:
139+
name: python-3.10-enterprise-cluster-3.11
140+
python-version: "3.10.6"
141+
arangodb-version: "enterprise:3.11.4"
142+
arangodb-config: "cluster.conf"
143+
cluster: true
144+
enterprise: true
145+
python-latest-enterprise-single-preview:
146+
when: << pipeline.parameters.preview >>
147+
jobs:
148+
- run-tests:
149+
name: python-latest-enterprise-single-preview
150+
python-version: "latest"
151+
arangodb-version: "enterprise-preview:latest"
152+
arangodb-config: "single.conf"
153+
cluster: false
154+
enterprise: true
155+
python-latest-enterprise-cluster-preview:
156+
when: << pipeline.parameters.preview >>
25157
jobs:
26-
- say-hello
158+
- run-tests:
159+
name: python-latest-enterprise-cluster-preview
160+
python-version: "latest"
161+
arangodb-version: "enterprise-preview:latest"
162+
arangodb-config: "cluster.conf"
163+
cluster: true
164+
enterprise: true

.github/workflows/build.yaml

+4-18
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Build
22

33
on:
44
pull_request:
5-
branches: [main, dev]
5+
branches: [main]
66
workflow_dispatch:
77
inputs:
88
debug_enabled:
@@ -12,13 +12,9 @@ on:
1212
default: false
1313

1414
jobs:
15-
build:
15+
docs:
1616
runs-on: ubuntu-22.04
1717

18-
strategy:
19-
matrix:
20-
python-version: ["3.8", "3.9", "3.10", "3.11"]
21-
2218
steps:
2319
- name: Checkout repository
2420
uses: actions/checkout@v3
@@ -29,15 +25,15 @@ jobs:
2925
- name: Create ArangoDB Docker container
3026
run: >
3127
docker create --name arango -p 8529:8529 -e ARANGO_ROOT_PASSWORD=passwd -v "$(pwd)/tests/static/":/tests/static
32-
arangodb/arangodb:3.10.9 --server.jwt-secret-keyfile=/tests/static/keyfile
28+
arangodb/arangodb:3.11.4 --server.jwt-secret-keyfile=/tests/static/keyfile
3329
3430
- name: Start ArangoDB Docker container
3531
run: docker start arango
3632

3733
- name: Set up Python
3834
uses: actions/setup-python@v4
3935
with:
40-
python-version: ${{ matrix.python-version }}
36+
python-version: '3.10'
4137

4238
- name: Debug with tmate
4339
uses: mxschmitt/action-tmate@v3
@@ -49,18 +45,8 @@ jobs:
4945
- name: Install dependencies
5046
run: pip install .[dev]
5147

52-
- name: Run unit tests
53-
run: py.test --complete --cov=arango --cov-report=xml
54-
5548
- name: Run Sphinx doctest
5649
run: python -m sphinx -b doctest docs docs/_build
5750

5851
- name: Generate Sphinx HTML
5952
run: python -m sphinx -b html -W docs docs/_build
60-
61-
- name: Upload coverage to Codecov
62-
uses: codecov/codecov-action@v3
63-
if: matrix.python-version == '3.10'
64-
with:
65-
fail_ci_if_error: false
66-
token: ${{ secrets.CODECOV_TOKEN }}

.github/workflows/codeql.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: CodeQL
22

33
on:
44
pull_request:
5-
branches: [main, dev]
5+
branches: [main]
66
schedule:
77
- cron: '21 2 * * 3'
88

CONTRIBUTING.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ Run unit tests with coverage:
1313
py.test --cov=arango --cov-report=html # Open htmlcov/index.html in your browser
1414
```
1515

16-
For a more comprehensive test suite, run:
16+
To start and ArangoDB instance locally, run:
1717

1818
```shell
19-
./tester.sh # Requires docker
19+
./starter.sh # Requires docker
2020
```
2121

2222
Build and test documentation:

arango/client.py

+15-5
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515
from arango.exceptions import ServerConnectionError
1616
from arango.http import DEFAULT_REQUEST_TIMEOUT, DefaultHTTPClient, HTTPClient
1717
from arango.resolver import (
18+
FallbackHostResolver,
1819
HostResolver,
20+
PeriodicHostResolver,
1921
RandomHostResolver,
2022
RoundRobinHostResolver,
2123
SingleHostResolver,
@@ -52,9 +54,9 @@ class ArangoClient:
5254
:param hosts: Host URL or list of URLs (coordinators in a cluster).
5355
:type hosts: str | [str]
5456
:param host_resolver: Host resolver. This parameter used for clusters (when
55-
multiple host URLs are provided). Accepted values are "roundrobin" and
56-
"random". Any other value defaults to round robin.
57-
:type host_resolver: str
57+
multiple host URLs are provided). Accepted values are "fallback",
58+
"roundrobin", "random" and "periodic". The default value is "fallback".
59+
:type host_resolver: str | arango.resolver.HostResolver
5860
:param resolver_max_tries: Number of attempts to process an HTTP request
5961
before throwing a ConnectionAbortedError. Must not be lower than the
6062
number of hosts.
@@ -88,7 +90,7 @@ class ArangoClient:
8890
def __init__(
8991
self,
9092
hosts: Union[str, Sequence[str]] = "http://127.0.0.1:8529",
91-
host_resolver: str = "roundrobin",
93+
host_resolver: Union[str, HostResolver] = "fallback",
9294
resolver_max_tries: Optional[int] = None,
9395
http_client: Optional[HTTPClient] = None,
9496
serializer: Callable[..., str] = default_serializer,
@@ -106,10 +108,18 @@ def __init__(
106108

107109
if host_count == 1:
108110
self._host_resolver = SingleHostResolver(1, resolver_max_tries)
111+
elif host_resolver == "fallback":
112+
self._host_resolver = FallbackHostResolver(host_count, resolver_max_tries)
109113
elif host_resolver == "random":
110114
self._host_resolver = RandomHostResolver(host_count, resolver_max_tries)
111-
else:
115+
elif host_resolver == "roundrobin":
112116
self._host_resolver = RoundRobinHostResolver(host_count, resolver_max_tries)
117+
elif host_resolver == "periodic":
118+
self._host_resolver = PeriodicHostResolver(host_count, resolver_max_tries)
119+
else:
120+
if not isinstance(host_resolver, HostResolver):
121+
raise ValueError("Invalid host resolver")
122+
self._host_resolver = host_resolver
113123

114124
# Initializes the http client
115125
self._http = http_client or DefaultHTTPClient(request_timeout=request_timeout)

arango/formatter.py

+6
Original file line numberDiff line numberDiff line change
@@ -1194,6 +1194,12 @@ def format_pregel_job_data(body: Json) -> Json:
11941194
if "useMemoryMaps" in body:
11951195
result["use_memory_maps"] = body["useMemoryMaps"]
11961196

1197+
# Introduced in 3.11
1198+
if "user" in body:
1199+
result["user"] = body["user"]
1200+
if "graphLoaded" in body:
1201+
result["graph_loaded"] = body["graphLoaded"]
1202+
11971203
return verify_format(body, result)
11981204

11991205

0 commit comments

Comments
 (0)