Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Testing with multiple versions of Conda #22

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
106 changes: 106 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
# Created by .ignore support plugin (hsz.mobi)
### Python template
# 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/
*.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/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
.hypothesis/

# Translations
*.mo
*.pot

# Django stuff:
*.log
.static_storage/
.media/
local_settings.py

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# pyenv
.python-version

# celery beat schedule file
celerybeat-schedule

# 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/
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ services:
- docker

install:
- docker build -t test-runner -f Dockerfile.test .
-

script:
- docker run --rm -t -v $PWD:/ansible-conda test-runner
- ./run-tests-in-docker.sh
27 changes: 0 additions & 27 deletions Dockerfile.test

This file was deleted.

8 changes: 8 additions & 0 deletions run-tests-in-docker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env bash
set -euf -o pipefail

docker-compose -f tests/unit/docker/docker-compose.test.yml up \
--build --force-recreate --remove-orphans

docker-compose -f tests/integration/docker/docker-compose.test.yml up \
--build --abort-on-container-exit --exit-code-from ansible-conda-integration-test-runner --force-recreate --remove-orphans
13 changes: 0 additions & 13 deletions run-tests.sh

This file was deleted.

6 changes: 0 additions & 6 deletions tests/integration/defaults/main.yml

This file was deleted.

23 changes: 23 additions & 0 deletions tests/integration/docker/Dockerfile.test.integration
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
ARG DOCKER_REPOSITORY=continuumio/miniconda3
ARG CONDA_VERSION=4.4.10

FROM ${DOCKER_REPOSITORY}:${CONDA_VERSION}

RUN apt-get update \
&& apt-get install -y --no-install-recommends \
openssh-server \
python \
python-pip \
&& rm -rf /var/lib/apt/lists/*

RUN sed -ri "s/^PermitRootLogin\s+.*/PermitRootLogin yes/" /etc/ssh/sshd_config \
&& sed -ri "s/UsePAM yes/#UsePAM yes/g" /etc/ssh/sshd_config

RUN mkdir /var/run/sshd

ARG root_password=root
RUN echo "root:${root_password}" | chpasswd

EXPOSE 22

CMD ["/usr/sbin/sshd", "-D"]
15 changes: 15 additions & 0 deletions tests/integration/docker/Dockerfile.test.runner
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM python:3

ENV ANSIBLE_HOST_KEY_CHECKING=False

RUN apt-get update \
&& apt-get install -y --no-install-recommends \
sshpass \
&& rm -rf /var/lib/apt/lists/*

WORKDIR /ansible-conda
ADD . .
RUN pip --disable-pip-version-check install -r tests/integration/runner-requirements.txt

WORKDIR /ansible-conda/tests/integration
CMD ["ansible-playbook", "-i", "inventory.ini", "test.yml"]
31 changes: 31 additions & 0 deletions tests/integration/docker/docker-compose.test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---

version: "3"

services:
ansible-conda-integration-test-runner:
container_name: ansible-conda-integration-test-runner
build:
context: ../../../
dockerfile: tests/integration/docker/Dockerfile.test.runner
depends_on:
- ansible-conda-integration-conda-py3-4-4-10-test-instance
- ansible-conda-integration-conda-py2-4-4-10-test-instance

ansible-conda-integration-conda-py3-4-4-10-test-instance:
container_name: ansible-conda-integration-conda-py3-4-4-10-test-instance
build:
context: ../../../
dockerfile: tests/integration/docker/Dockerfile.test.integration
args:
DOCKER_REPOSITORY: continuumio/miniconda3
CONDA_VERSION: 4.4.10

ansible-conda-integration-conda-py2-4-4-10-test-instance:
container_name: ansible-conda-integration-conda-py2-4-4-10-test-instance
build:
context: ../../../
dockerfile: tests/integration/docker/Dockerfile.test.integration
args:
DOCKER_REPOSITORY: continuumio/miniconda
CONDA_VERSION: 4.4.10
14 changes: 14 additions & 0 deletions tests/integration/group_vars/conda-testers/vars.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---

supergiant_admin_user_username: admin
# Note: Outside of testing, put this in a vault!
supergiant_admin_user_password: password123

supergiant_configure_systemctl: false
supergiant_docker_build_temp_directory: /shared

supergiant_server_install_location: /usr/bin/supergiant
supergiant_server_config_location: /etc/supergiant/config.json

supergiant_host: localhost
supergiant_port: 8080
3 changes: 3 additions & 0 deletions tests/integration/inventory.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[conda-testers]
ansible-conda-integration-conda-py3-4-4-10-test-instance ansible_user=root ansible_ssh_pass=root
ansible-conda-integration-conda-py2-4-4-10-test-instance ansible_user=root ansible_ssh_pass=root
10 changes: 0 additions & 10 deletions tests/integration/meta/main.yml

This file was deleted.

1 change: 0 additions & 1 deletion tests/integration/requirements.txt

This file was deleted.

5 changes: 0 additions & 5 deletions tests/integration/requirements.yml

This file was deleted.

3 changes: 3 additions & 0 deletions tests/integration/roles/conda-test/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---

conda_tests_conda_executable: "/opt/conda/bin/conda"
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
---

- include: install.yml
- include: tear-down.yml

- block:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,3 @@
that: upgrade_install.changed
that: example_package.installed
that: example_package.version | version_compare(conda_tests_minimum_latest_version, '>=')


2 changes: 2 additions & 0 deletions tests/integration/runner-requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
jmespath
ansible
5 changes: 0 additions & 5 deletions tests/integration/site.yml

This file was deleted.

9 changes: 0 additions & 9 deletions tests/integration/tasks/install.yml

This file was deleted.

5 changes: 5 additions & 0 deletions tests/integration/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---

- hosts: conda-testers
roles:
- name: conda-test
14 changes: 14 additions & 0 deletions tests/unit/docker/Dockerfile.test.unit
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
ARG PYTHON_VERSION=2

FROM python:${PYTHON_VERSION}

RUN pip --disable-pip-version-check install \
ansible

ENV INSTALL_DIRECTORY=/ansible-conda

WORKDIR "${INSTALL_DIRECTORY}"
ADD . .

ENV PYTHONPATH="${INSTALL_DIRECTORY}"
CMD ["python", "-m", "unittest", "discover", "-v", "-s", "tests/unit"]
20 changes: 20 additions & 0 deletions tests/unit/docker/docker-compose.test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---

version: "3"

services:
ansible-conda-unit-conda-py3-4-4-10-test-instance:
container_name: ansible-conda-unit-conda-py2-4-4-10-test-instance
build:
context: ../../../
dockerfile: tests/unit/docker/Dockerfile.test.unit
args:
PYTHON_VERSION: 2

ansible-conda-unit-conda-py2-4-4-10-test-instance:
container_name: ansible-conda-unit-conda-py3-4-4-10-test-instance
build:
context: ../../../
dockerfile: tests/unit/docker/Dockerfile.test.unit
args:
PYTHON_VERSION: 3