-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathfabfile.py
More file actions
62 lines (46 loc) · 2 KB
/
fabfile.py
File metadata and controls
62 lines (46 loc) · 2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
from fabric.api import local, settings
from fabric.colors import yellow
import time
def prep_docker():
"""Pull and build the required docker containers."""
local('docker-compose pull')
local('docker-compose build')
def stop_and_clean_docker():
"""Stop all the containers and clean up."""
local('docker-compose stop')
local('docker-compose rm -f')
def build_package():
"""Build the pip packages."""
local('docker-compose run --rm dev python setup.py sdist')
def build_docs():
"""Build the html site and pdf file from the sphinx source."""
local('docker-compose run --rm docs bash make-docs.sh')
def run_unit_tests():
"""Build the dev image and runs the unit tests."""
long_command = 'docker-compose run --rm dev ' \
'nosetests --verbosity=2 -s --with-coverage --cover-package=cinder_data ' \
'--cover-inclusive --cover-erase --cover-branches --cover-html ' \
'--cover-html-dir=coverage-report/ tests/'
local(long_command)
def run_robot_tests():
"""Run the robot test suites in robot/suites/* and put the report in robot/reports directory."""
local('docker-compose up -d db')
time.sleep(5) # Sleeping to allow time for database to come online.
local('docker-compose up -d server')
time.sleep(3) # Sleeping to allow server to migrate the database and import the fixtures.
with settings(warn_only=True):
local('docker-compose run --rm robot bash run-tests.sh')
local('docker-compose stop')
local('docker-compose rm -f')
def run_linter():
"""Run the linter tools against he source."""
local('docker-compose run --rm linter flake8 .')
local('docker-compose run --rm linter rflint -v -r robot/')
def run_ci_targets():
"""Run the same targets that travis-ci will."""
print(yellow('WARNING: This fab target has to be manually kept in with .travis.yml, '
'there is no guarantee that they are actually in sync.'))
run_linter()
run_unit_tests()
build_docs()
run_robot_tests()