-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
23b96bb
commit 2650eab
Showing
2 changed files
with
70 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,64 @@ | ||
# Use the latest 2.1 version of CircleCI pipeline process engine. | ||
# See: https://circleci.com/docs/configuration-reference | ||
version: 2.1 | ||
|
||
# Define a job to be invoked later in a workflow. | ||
# See: https://circleci.com/docs/configuration-reference/#jobs | ||
jobs: | ||
say-hello: | ||
# Specify the execution environment. You can specify an image from Docker Hub or use one of our convenience images from CircleCI's Developer Hub. | ||
# See: https://circleci.com/docs/configuration-reference/#executor-job | ||
run-tests: | ||
parameters: | ||
python-version: | ||
type: string | ||
default: "latest" | ||
arangodb-version: | ||
type: string | ||
default: "arangodb:latest" | ||
arangodb-config: | ||
type: string | ||
default: "single.conf" | ||
docker: | ||
- image: cimg/base:stable | ||
# Add steps to the job | ||
# See: https://circleci.com/docs/configuration-reference/#steps | ||
- image: python:<< parameters.python-version >> | ||
name: driver | ||
- image: arangodb/<< parameters.arangodb-version >> | ||
name: db | ||
steps: | ||
- checkout | ||
- remote_setup_docker | ||
- run: | ||
name: "Say hello" | ||
command: "echo Hello, World!" | ||
name: "Copy data to DB container" | ||
command: | | ||
docker cp tests/static db:/tests/static | ||
- run: | ||
name: "Run ArangoDB with custom configuration" | ||
command: | | ||
docker exec db arangodb --configuration=/tests/static/<< parameters.arangodb-config >> | ||
- run: | ||
name: "Wait for DB" | ||
environment: | ||
ARANGO_HOST: "http://db:8529" | ||
command: | | ||
for i in {1..30} | ||
do | ||
python tests/utils/ping.py | ||
if [[ $? -eq 0 ]]; then | ||
echo "DB is up and running" | ||
exit 0 | ||
else | ||
echo "Attempt $i failed, retrying..." | ||
sleep 1 | ||
fi | ||
done | ||
echo "Failed to connect to DB after 30 seconds" | ||
exit 1 | ||
- run: | ||
name: "Install Dependencies" | ||
command: | | ||
pip install -e .[dev] | ||
- run: | ||
name: "Run Tests" | ||
command: | | ||
py.test --host db --complete --cov=arango --cov-report=html | ||
# Orchestrate jobs using workflows | ||
# See: https://circleci.com/docs/configuration-reference/#workflows | ||
workflows: | ||
say-hello-workflow: | ||
test-single-python-3.10-community-3.10: | ||
jobs: | ||
- say-hello | ||
- run-tests: | ||
python-version: "3.10.6" | ||
arangodb-version: "arangodb:3.10.10" | ||
arangodb-config: "single.conf" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import os | ||
|
||
from arango import ArangoClient | ||
|
||
|
||
def main(): | ||
host = os.environ.get("ARANGO_HOST", "http://127.0.0.1:8529") | ||
username = os.environ.get("ARANGO_USERNAME", "root") | ||
password = os.environ.get("ARANGO_PASSWORD", "passwd") | ||
|
||
client = ArangoClient(hosts=host) | ||
client.db("_system", username=username, password=password, verify=True) | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |