Skip to content

Commit 1436c61

Browse files
committed
using arangodb container
1 parent f04be05 commit 1436c61

1 file changed

Lines changed: 67 additions & 49 deletions

File tree

.circleci/config.yml

Lines changed: 67 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,16 @@ executors:
99
docker:
1010
- image: cimg/python:<< parameters.python_version >>
1111
resource_class: arangodb/medium-amd64
12+
arangodb-container:
13+
parameters:
14+
arangodb_image:
15+
type: string
16+
docker:
17+
- image: << parameters.arangodb_image >>
18+
entrypoint: /bin/sh
19+
command: -c "while true; do sleep 10; done"
20+
user: root
21+
resource_class: arangodb/medium-amd64
1222
python-vm:
1323
machine:
1424
image: ubuntu-2404:current
@@ -19,29 +29,21 @@ workflows:
1929
jobs:
2030
- lint
2131
- test:
22-
name: Python (<< matrix.python_version >>) - ArangoDB (enterprise, << matrix.arangodb_version >> << matrix.arangodb_config >>)
32+
name: ArangoDB (enterprise, 3.12 << matrix.arangodb_config >>)
2333
matrix:
2434
parameters:
25-
python_version: ["3.13"]
2635
arangodb_config: ["single", "cluster"]
2736
arangodb_license: ["enterprise"]
28-
arangodb_version: ["3.12"]
37+
arangodb_image: ["arangodb/enterprise:3.12"]
38+
arangodb_conf_version: ["3.12"]
2939
- test:
30-
name: Python (<< matrix.python_version >>) - ArangoDB (enterprise-preview, << matrix.arangodb_version >> << matrix.arangodb_config >>)
40+
name: ArangoDB (enterprise-preview, 4.0-nightly << matrix.arangodb_config >>)
3141
matrix:
3242
parameters:
33-
python_version: ["3.13"]
3443
arangodb_config: ["single", "cluster"]
3544
arangodb_license: ["enterprise-preview"]
36-
arangodb_version: ["4.0-nightly"]
37-
- test:
38-
name: Python (<< matrix.python_version >>) - ArangoDB (enterprise, 3.12 cluster)
39-
matrix:
40-
parameters:
41-
python_version: ["3.10", "3.11", "3.12"]
42-
arangodb_config: ["cluster"]
43-
arangodb_license: ["enterprise"]
44-
arangodb_version: ["3.12"]
45+
arangodb_image: ["arangodb/enterprise-preview:4.0-nightly"]
46+
arangodb_conf_version: ["4.0"]
4547

4648
jobs:
4749
lint:
@@ -65,70 +67,86 @@ jobs:
6567
command: mypy ./arangoasync
6668
test:
6769
parameters:
68-
python_version:
69-
type: string
7070
arangodb_config:
7171
type: string
7272
arangodb_license:
7373
type: string
74-
arangodb_version:
74+
arangodb_image:
75+
type: string
76+
arangodb_conf_version:
7577
type: string
7678
executor:
77-
name: python-container
78-
python_version: << parameters.python_version >>
79+
name: arangodb-container
80+
arangodb_image: << parameters.arangodb_image >>
7981
steps:
82+
- run:
83+
name: Bootstrap CI Tools
84+
command: |
85+
apk add --no-cache \
86+
bash \
87+
build-base \
88+
ca-certificates \
89+
curl \
90+
git \
91+
jq \
92+
openssh-client \
93+
openssl-dev \
94+
py3-pip \
95+
py3-virtualenv \
96+
python3 \
97+
python3-dev \
98+
wget
8099
- checkout
81-
- setup_remote_docker
82100
- run:
83-
name: Resolve ArangoDB Host
101+
name: Setup ArangoDB
84102
command: |
85-
if [ -z "${ARANGO_HOST:-}" ]; then
86-
if [ -n "${DOCKER_HOST:-}" ]; then
87-
ARANGO_HOST="${DOCKER_HOST#tcp://}"
88-
ARANGO_HOST="${ARANGO_HOST%%:*}"
89-
elif getent hosts host.docker.internal >/dev/null 2>&1; then
90-
ARANGO_HOST=host.docker.internal
91-
elif command -v ip >/dev/null 2>&1; then
92-
ARANGO_HOST="$(ip route show default | awk '{print $3; exit}')"
93-
else
94-
ARANGO_HOST=localhost
95-
fi
103+
mkdir -p /tests
104+
if [ ! -e /tests/static ]; then
105+
ln -s "$PWD/tests/static" /tests/static
96106
fi
97107
98-
if [ -z "$ARANGO_HOST" ]; then
99-
echo "Could not determine ARANGO_HOST"
108+
conf_file="/tests/static/<< parameters.arangodb_config >>-<< parameters.arangodb_conf_version >>.conf"
109+
if [ ! -f "$conf_file" ]; then
110+
echo "Missing configuration file: $conf_file"
100111
exit 1
101112
fi
102113
103-
echo "export ARANGO_HOST=$ARANGO_HOST" >> "$BASH_ENV"
104-
echo "Using ARANGO_HOST=$ARANGO_HOST"
105-
- run:
106-
name: Check Docker
107-
command: docker version
108-
- run:
109-
name: Setup ArangoDB
110-
command: |
111-
chmod +x starter.sh
112-
./starter.sh << parameters.arangodb_config >> << parameters.arangodb_license >> << parameters.arangodb_version >>
114+
arangodb --configuration="$conf_file" > arangodb.log 2>&1 &
115+
echo "$!" > arangodb.pid
116+
117+
echo "Waiting for ArangoDB at http://localhost:8528/version"
118+
wget --quiet --waitretry=1 --tries=120 -O - http://localhost:8528/version | jq
113119
- restore_cache:
114120
key: pip-and-local-cache
115121
- run:
116122
name: Setup Python
123+
shell: /bin/bash -eo pipefail
117124
command: |
125+
python3 --version
126+
python3 -m virtualenv .venv
127+
source .venv/bin/activate
118128
python --version
119-
pip --version
129+
python -m pip --version
120130
- run:
121131
name: Install Dependencies
122-
command: pip install -e .[dev]
123-
- run: docker ps -a
124-
- run: docker logs arango
132+
shell: /bin/bash -eo pipefail
133+
command: |
134+
source .venv/bin/activate
135+
python -m pip install -e .[dev]
136+
- run:
137+
name: Show ArangoDB Logs
138+
command: tail -n 200 arangodb.log
139+
when: always
125140
- run:
126141
name: Run pytest
142+
shell: /bin/bash -eo pipefail
127143
command: |
128144
mkdir test-results
129145
mkdir htmlcov
130146
131-
args=("--junitxml=test-results/junit.xml" "--log-cli-level=DEBUG" "--host" "$ARANGO_HOST" "--port=8529")
147+
source .venv/bin/activate
148+
149+
args=("--junitxml=test-results/junit.xml" "--log-cli-level=DEBUG" "--host" "localhost" "--port=8529")
132150
if [ << parameters.arangodb_config >> = "cluster" ]; then
133151
args+=("--cluster" "--port=8539" "--port=8549")
134152
fi

0 commit comments

Comments
 (0)