Skip to content

Commit

Permalink
Merge pull request #6 from Inveracity/fix-live-tests
Browse files Browse the repository at this point in the history
fixes live tests against a running rethinkdb server
  • Loading branch information
Inveracity authored Jan 27, 2021
2 parents 6e13908 + 4495386 commit d0cbda0
Show file tree
Hide file tree
Showing 11 changed files with 462 additions and 80 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.venv
149 changes: 139 additions & 10 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,12 +1,141 @@
build
*.o
*.pyc
tmp
*.log
*.tmp
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.idea/
dist
*.egg-info
.nox/
.coverage
htmlcov/
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

# rethinkdb binary
server/
2 changes: 2 additions & 0 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,7 @@ python_version = "3"

[scripts]
test = "pytest --cov rethinkdb_mock -vv"
test_live = "pytest --cov rethinkdb_mock -vv -x --run rethink"
last_live = "pytest --cov rethinkdb_mock -vv -x --run rethink --last-failed"
isort = "isort ."
lint = "flake8 ."
130 changes: 65 additions & 65 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,16 @@ pipenv sync --dev
pipenv run test
```

### Run tests against a live server

The docker folder contains a dockerfile that grabs rethinkdb and runs the python tests

Simple running the below command outputs the results

```bash
docker-compose up --build
```

## Code formatting

The `tox.ini` file contains the configuration for code formatting
Expand Down
9 changes: 9 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
version: "3.7"
services:
python:
image: rethinkdb-mock
build:
context: .
dockerfile: docker/test_live.Dockerfile
container_name: integration-test
command: ["pipenv", "run", "test_live"]
26 changes: 26 additions & 0 deletions docker/test_live.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
FROM rethinkdb:2.4.1-buster-slim as rdb

FROM python:3.9-slim-buster

RUN apt update && apt install -y \
libcurl4-openssl-dev \
libprotobuf-dev
# build-essential \
# protobuf-compiler\
# libboost-all-dev \
# libncurses5-dev \
# libjemalloc-dev \
# wget m4

COPY --from=rdb /usr/bin/rethinkdb /usr/bin/rethinkdb

RUN mkdir -p /app
COPY . /app
WORKDIR /app

RUN which rethinkdb

RUN pip install pipenv
RUN pipenv install --dev --system --deploy

CMD ["pipenv", "run", "test_live"]
Loading

0 comments on commit d0cbda0

Please sign in to comment.