Commit 99ba22df authored by David Trudgian's avatar David Trudgian
Browse files

Rework testing, clair and non-clair dependent

parent 29196b69
......@@ -6,19 +6,15 @@ services:
python:
- "2.7"
- "3.4"
before_install:
- docker pull arminc/clair-db:2017-08-21
- docker run -d --name db arminc/clair-db:2017-08-21
- docker pull arminc/clair-local-scan:v2.0.0
- docker run -p 6060:6060 --link db:postgres -d --name clair arminc/clair-local-scan:v2.0.0
- docker ps
- "3.5"
- "3.6"
install:
- pip install flake8 pytest pytest-cov pytest-flake8 python-coveralls
- python setup.py install
script:
- docker build -t clair_singularity .
- docker run -v $TRAVIS_BUILD_DIR:/app --privileged --name clair-singularity --link clair:clair clair_singularity pytest tests/ --cov clair_singularity --cov-report term-missing
- coveralls
- build_scripts/travis_tests.sh
after_success:
- coveralls -b $TRAVIS_BUILD_DIR
#!/bin/bash
pytest tests/ -v -m "not needs_clair" --cov clair_singularity --cov-report term-missing
#!/bin/bash
echo "Running tests that don't need Clair"
pytest tests/ -v -m "not needs_clair" --cov clair_singularity --cov-report term-missing
echo "Running setup.py install"
python setup.py install
if [[ $PYTHON_VERSION == "3.5"* ]]; then
echo "Python 3.5 - running docker tests with Clair"
docker pull arminc/clair-db:2017-08-21
docker run -d --name db arminc/clair-db:2017-08-21
docker pull arminc/clair-local-scan:v2.0.0
docker run -p 6060:6060 --link db:postgres -d --name clair arminc/clair-local-scan:v2.0.0
docker ps
docker build -t clair_singularity .
docker run -v $TRAVIS_BUILD_DIR:/app --privileged --name clair-singularity --link clair:clair clair_singularity pytest tests/ -v --cov clair_singularity --cov-report term-missing
if [ $? -eq 0 ]; then
coveralls -b $TRAVIS_BUILD_DIR
fi
fi
......@@ -4,6 +4,7 @@ from clair_singularity.clair import check_clair, post_layer, get_report
API_URL = 'http://clair:6060/v1/'
@pytest.mark.needs_clair
def test_check_clair():
# We can talk to the API
assert check_clair(API_URL,False)
......@@ -20,6 +20,7 @@ def test_help(runner):
assert 'Usage:' in result.output
@pytest.mark.needs_clair
def test_full_json(runner, testimage):
result = runner.invoke(cli,
['--quiet', '--json-output', '--bind-ip', MY_IP, '--bind-port', '8081', '--clair-uri',
......@@ -38,6 +39,7 @@ def test_full_json(runner, testimage):
assert features_with_vuln == 14
@pytest.mark.needs_clair
def test_full_text(runner, testimage):
result = runner.invoke(cli, ['--quiet', '--bind-ip', MY_IP, '--bind-port', '8082', '--clair-uri',
'http://clair:6060', testimage])
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment