-
-
Notifications
You must be signed in to change notification settings - Fork 228
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
isolate test environment with docker-compose (#296)
- Loading branch information
Showing
22 changed files
with
247 additions
and
303 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
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
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,18 @@ | ||
ARG PYTHON | ||
|
||
FROM python:${PYTHON}-stretch | ||
|
||
RUN apt-get update && apt-get install -y pandoc | ||
|
||
ADD docs/requirements.txt /tmp/requirements-docs.txt | ||
RUN pip install -r /tmp/requirements-docs.txt | ||
|
||
ADD requirements.txt /tmp/ | ||
ADD requirements-dev.txt /tmp/ | ||
RUN pip install -r /tmp/requirements-dev.txt | ||
|
||
ADD . /nornir | ||
|
||
RUN pip install -e /nornir | ||
|
||
WORKDIR "/nornir" |
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,8 +1,68 @@ | ||
ifeq ($(PYTHON), ) | ||
override PYTHON=3.6 | ||
endif | ||
|
||
.PHONY: format | ||
format: | ||
black . | ||
DOCKER_COMPOSE_FILE=docker-compose.yaml | ||
DOCKER_COMPOSE=PYTHON=${PYTHON} docker-compose -f ${DOCKER_COMPOSE_FILE} | ||
|
||
.PHONY: tests | ||
tests: | ||
tox | ||
.PHONY: start_dev_env | ||
start_dev_env: | ||
${DOCKER_COMPOSE} \ | ||
up -d \ | ||
dev1.group_1 dev2.group_1 dev3.group_2 dev4.group_2 dev5.no_group httpbin | ||
|
||
.PHONY: stop_dev_env | ||
stop_dev_env: | ||
${DOCKER_COMPOSE} \ | ||
down | ||
|
||
.PHONY: build_test_container | ||
build_test_container: | ||
${DOCKER_COMPOSE} \ | ||
build nornir | ||
|
||
.PHONY: enter-container | ||
enter-container: | ||
${DOCKER_COMPOSE} \ | ||
run nornir bash | ||
|
||
.PHONY: pytest | ||
pytest: | ||
${DOCKER_COMPOSE} \ | ||
run nornir py.test --cov=nornir --cov-report=term-missing -vs ${ARGS} | ||
|
||
.PHONY: black | ||
black: | ||
${DOCKER_COMPOSE} \ | ||
run nornir black --check . | ||
|
||
.PHONY: sphinx | ||
sphinx: | ||
# TODO REPLACE with: sphinx-build -n -E -q -N -b dummy -d docs/_build/doctrees docs asd | ||
${DOCKER_COMPOSE} \ | ||
run nornir sphinx-build -W -b html -d docs/_build/doctrees docs docs/_build/html | ||
|
||
.PHONY: pylama | ||
pylama: | ||
${DOCKER_COMPOSE} \ | ||
run nornir pylama . | ||
|
||
.PHONY: mypy | ||
mypy: | ||
${DOCKER_COMPOSE} \ | ||
run nornir mypy . | ||
|
||
.PHONY: nbval | ||
nbval: | ||
${DOCKER_COMPOSE} \ | ||
run nornir \ | ||
pytest --nbval \ | ||
docs/plugins \ | ||
docs/howto \ | ||
docs/tutorials/intro/initializing_nornir.ipynb \ | ||
docs/tutorials/intro/inventory.ipynb \ | ||
|
||
PHONY: tests | ||
tests: build_test_container black sphinx pylama mypy nbval | ||
make pytest PYTEST=3.6 | ||
make pytest PYTEST=3.7 |
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,69 @@ | ||
--- | ||
version: '2.1' | ||
|
||
services: | ||
nornir: | ||
build: | ||
context: . | ||
dockerfile: Dockerfile.tests | ||
args: | ||
PYTHON: ${PYTHON} | ||
extra_hosts: | ||
dev1.group_1: 10.21.33.101 | ||
dev2.group_1: 10.21.33.102 | ||
dev3.group_2: 10.21.33.103 | ||
dev4.group_2: 10.21.33.104 | ||
dev5.no_group: 10.21.33.105 | ||
httpbin: 10.21.33.201 | ||
networks: | ||
net1: | ||
ipv4_address: 10.21.33.2 | ||
|
||
dev1.group_1: | ||
hostname: dev1.group_1 | ||
image: dbarroso/stupid_ssh_container | ||
networks: | ||
net1: | ||
ipv4_address: 10.21.33.101 | ||
|
||
dev2.group_1: | ||
hostname: dev2.group_1 | ||
image: dbarroso/stupid_ssh_container | ||
networks: | ||
net1: | ||
ipv4_address: 10.21.33.102 | ||
|
||
dev3.group_2: | ||
hostname: dev3.group_2 | ||
image: dbarroso/stupid_ssh_container | ||
networks: | ||
net1: | ||
ipv4_address: 10.21.33.103 | ||
|
||
dev4.group_2: | ||
hostname: dev4.group_2 | ||
image: dbarroso/stupid_ssh_container | ||
networks: | ||
net1: | ||
ipv4_address: 10.21.33.104 | ||
|
||
dev5.no_group: | ||
hostname: dev5.no_group | ||
image: dbarroso/stupid_ssh_container | ||
networks: | ||
net1: | ||
ipv4_address: 10.21.33.105 | ||
|
||
httpbin: | ||
hostname: httpbin | ||
image: bungoume/httpbin-container | ||
networks: | ||
net1: | ||
ipv4_address: 10.21.33.201 | ||
|
||
networks: | ||
net1: | ||
driver: bridge | ||
ipam: | ||
config: | ||
- subnet: 10.21.33.0/24 |
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
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
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
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 |
---|---|---|
|
@@ -5,7 +5,6 @@ pytest-cov | |
pylama | ||
flake8-import-order | ||
requests-mock | ||
tox | ||
black==18.6b4 | ||
mypy | ||
-r requirements.txt |
Oops, something went wrong.