Skip to content

Commit

Permalink
single server tests
Browse files Browse the repository at this point in the history
  • Loading branch information
apetenchea committed Oct 6, 2023
1 parent 23b96bb commit 2650eab
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 16 deletions.
70 changes: 54 additions & 16 deletions .circleci/config.yml
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"
16 changes: 16 additions & 0 deletions tests/utils/ping.py
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()

0 comments on commit 2650eab

Please sign in to comment.