Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
BioHPC
clair-singularity
Commits
857c0e0b
Commit
857c0e0b
authored
Aug 24, 2017
by
David Trudgian
Browse files
Test inside docker
parent
4a393379
Changes
3
Hide whitespace changes
Inline
Side-by-side
.travis.yml
View file @
857c0e0b
...
@@ -7,10 +7,6 @@ python:
...
@@ -7,10 +7,6 @@ python:
-
"
2.7"
-
"
2.7"
-
"
3.4"
-
"
3.4"
before_install
:
before_install
:
-
wget -O- http://neuro.debian.net/lists/trusty.us-nh.full | sudo tee /etc/apt/sources.list.d/neurodebian.sources.list
-
sudo apt-key adv --recv-keys --keyserver hkp://pool.sks-keyservers.net:80 0xA5D32F012649A5A9
-
sudo apt-get -qq update
-
sudo apt-get install -y singularity-container
-
docker pull arminc/clair-db:2017-08-21
-
docker pull arminc/clair-db:2017-08-21
-
docker run -d --name db 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 pull arminc/clair-local-scan:v2.0.0
...
@@ -20,7 +16,8 @@ install:
...
@@ -20,7 +16,8 @@ install:
-
pip install flake8 pytest pytest-cov pytest-flake8 python-coveralls
-
pip install flake8 pytest pytest-cov pytest-flake8 python-coveralls
-
python setup.py install
-
python setup.py install
script
:
script
:
-
pytest tests/ --cov clair_singularity --cov-report term-missing
-
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
-
coveralls
...
...
tests/test_clair.py
View file @
857c0e0b
...
@@ -2,7 +2,7 @@ import pytest
...
@@ -2,7 +2,7 @@ import pytest
from
clair_singularity.clair
import
check_clair
,
post_layer
,
get_report
from
clair_singularity.clair
import
check_clair
,
post_layer
,
get_report
API_URL
=
'http://
127.0.0.1
:6060/v1/'
API_URL
=
'http://
clair
:6060/v1/'
def
test_check_clair
():
def
test_check_clair
():
# We can talk to the API
# We can talk to the API
...
...
tests/test_cli.py
View file @
857c0e0b
...
@@ -23,7 +23,7 @@ def test_help(runner):
...
@@ -23,7 +23,7 @@ def test_help(runner):
def
test_full_json
(
runner
,
testimage
):
def
test_full_json
(
runner
,
testimage
):
result
=
runner
.
invoke
(
cli
,
result
=
runner
.
invoke
(
cli
,
[
'--quiet'
,
'--json-output'
,
'--bind-ip'
,
MY_IP
,
'--bind-port'
,
'8081'
,
'--clair-uri'
,
[
'--quiet'
,
'--json-output'
,
'--bind-ip'
,
MY_IP
,
'--bind-port'
,
'8081'
,
'--clair-uri'
,
'http://
127.0.0.1
:6060'
,
testimage
])
'http://
clair
:6060'
,
testimage
])
output
=
json
.
loads
(
result
.
output
)
output
=
json
.
loads
(
result
.
output
)
# Using the shub://396 image and the 2017-08-21 clair db...
# Using the shub://396 image and the 2017-08-21 clair db...
...
@@ -40,7 +40,7 @@ def test_full_json(runner, testimage):
...
@@ -40,7 +40,7 @@ def test_full_json(runner, testimage):
def
test_full_text
(
runner
,
testimage
):
def
test_full_text
(
runner
,
testimage
):
result
=
runner
.
invoke
(
cli
,
[
'--quiet'
,
'--bind-ip'
,
MY_IP
,
'--bind-port'
,
'8082'
,
'--clair-uri'
,
result
=
runner
.
invoke
(
cli
,
[
'--quiet'
,
'--bind-ip'
,
MY_IP
,
'--bind-port'
,
'8082'
,
'--clair-uri'
,
'http://
127.0.0.1
:6060'
,
testimage
])
'http://
clair
:6060'
,
testimage
])
# Check we do have some CVEs we expect reported here
# Check we do have some CVEs we expect reported here
assert
'bash - 4.3-14ubuntu1.1'
in
result
.
output
assert
'bash - 4.3-14ubuntu1.1'
in
result
.
output
assert
'CVE-2016-9401'
in
result
.
output
assert
'CVE-2016-9401'
in
result
.
output
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment