Skip to content

Commit

Permalink
Adds Dockerfile to run test inside a container (#69)
Browse files Browse the repository at this point in the history
Signed-off-by: Vicente Zepeda Mas <vzepedam@redhat.com>
  • Loading branch information
chentex authored Mar 5, 2021
1 parent 9bae288 commit 803e35a
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 8 deletions.
36 changes: 32 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,41 @@

This repo contains script to automate and test deployments on [Red Hat Managed Services](https://www.openshift.com/learn/topics/managed-services)

## Available Environments

# Available Environments
- [Red Hat OpenShift Service on AWS (ROSA)](https://www.openshift.com/products/amazon-openshift)

## [Red Hat OpenShift Service on AWS (ROSA)](https://www.openshift.com/products/amazon-openshift)

Managed OCP4 installed on AWS
## Managed OCP4 installed on AWS

### Available Testers

- [osde2e-wrapper](./osde2e/README.md)
- [rosa-wrapper](./rosa/README.md)

## Running tests

### Local testing

To run tests locally use the folling command:

`tox .`

If you have a dirty virtual environment use the option `-r` in `tox` to recreate the environments.

### Testing in a container

The container must have internet access to build, it is not necessary to install any requirenments in your workstation.

First build the image that will run the tests:

`podman build -f tests/Dockerfile --tag tox-test:latest .`

The tag can be anything you want and can be changed, in thsi case we are using `tox-test:latest`.

To run the tests execute:

`podman run --rm -ti tox-test:latest`

You can execute any sub-environment of `tox` by doing the following:

`podman run --rm -ti tox-test:latest tox -e stage`
2 changes: 0 additions & 2 deletions test-requirements.txt

This file was deleted.

6 changes: 6 additions & 0 deletions tests/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM quay.io/redhat-aqe/tox:latest
RUN useradd -m -U fedora
USER fedora
COPY --chown=fedora:fedora ../. /home/fedora
WORKDIR /home/fedora
CMD ["tox", "."]
2 changes: 2 additions & 0 deletions tests/test-requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
flake8
elasticsearch
4 changes: 2 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ skipsdist=True

[testenv]
setenv = VIRTUAL_ENV={envdir}
deps = -r{toxinidir}/test-requirements.txt
deps = -r{toxinidir}/tests/test-requirements.txt
basepython = python
commands =
flake8 {posargs}
Expand All @@ -21,4 +21,4 @@ show-source = True
ignore = E123,E125,E226,E302,E41,E231,E203,E501,E741,H233,H306,H238,H236,H404,H405,W504
max-line-length = 110
builtins = _
exclude=.venv,.git,.tox,*lib/python*,
exclude=.venv,.git,.tox,*lib/python*,.local

0 comments on commit 803e35a

Please sign in to comment.