Remove tasks for deployment and testing of tasks.

This commit is contained in:
Dorian 2016-10-25 19:17:42 -04:00
parent 5a1ebbce50
commit 51b8a3a63c
6 changed files with 2 additions and 115 deletions

View File

@ -18,7 +18,6 @@ desc("Runs api tests")
task("test-api", {"build"}, function() task("test-api", {"build"}, function()
exec("docker-compose", "up", "-d", "db") exec("docker-compose", "up", "-d", "db")
exec("docker-compose", "run", "api", "inv", "test.style") exec("docker-compose", "run", "api", "inv", "test.style")
exec("docker-compose", "run", "api", "inv", "test.tasks")
exec("docker-compose", "run", "api", "inv", "test.server", "--couchdb-connection=http://admin:password@db:5984/") exec("docker-compose", "run", "api", "inv", "test.server", "--couchdb-connection=http://admin:password@db:5984/")
end) end)

View File

@ -7,11 +7,10 @@ Build tasks for Rookeries.
import invoke as inv import invoke as inv
from . import clean, deploy, db, docs, server, test from . import clean, db, docs, server, test
ns = inv.Collection() ns = inv.Collection()
ns.add_collection(clean) ns.add_collection(clean)
ns.add_collection(deploy)
ns.add_collection(db) ns.add_collection(db)
ns.add_collection(docs) ns.add_collection(docs)
ns.add_collection(server) ns.add_collection(server)

View File

@ -1,63 +0,0 @@
"""
Tasks for deploying Rookeries.
:copyright: Copyright 2013-2015, Dorian Pula <dorian.pula@amber-penguin-software.ca>
:license: AGPL v3+
"""
import arrow
import invoke as inv
import pathlib
import rookeries
from . import clean, utils
@inv.ctask(clean.python, clean.assets)
def package(ctx, add_date_suffix=False, package_suffix=''):
"""
Prepares the project for packaging.
:param add_date_suffix: Flag for adding for removing a date suffix to the package.
:param package_suffix: An aditional suffix to add to the file name.
"""
deploy_staging_path = generate_package_name(add_date_suffix, package_suffix)
deployable_package = "{}.tar.bz2".format(deploy_staging_path)
utils.delete_in_path_list([deploy_staging_path, deployable_package])
packaging_dir = pathlib.Path(deploy_staging_path)
if not packaging_dir.exists():
packaging_dir.mkdir()
ctx.run('ln -s ../rookeries {}/rookeries'.format(packaging_dir))
ctx.run('ln -s ../client {}/client'.format(packaging_dir))
ctx.run('ln -s ../requirements.txt {}/requirements.txt'.format(packaging_dir))
ctx.run('ln -s ../package.json {}/package.json'.format(packaging_dir))
ctx.run('tar zcvhf {} {}'.format(deployable_package, packaging_dir), echo=True)
ctx['deployable'] = pathlib.Path(deployable_package)
def generate_package_name(add_date_suffix=False, pkg_suffix=''):
"""
Generate the name of the app package for this deployment.
:param add_date_suffix: Flag for adding for removing a date suffix to the package.
:param pkg_suffix: An aditional suffix to add to the file name.
:return: The name of the app package
"""
package_name = [
rookeries.__name__,
rookeries.__version__
]
if pkg_suffix:
package_name.append(pkg_suffix)
if add_date_suffix:
date_suffix = arrow.now().format('YYYYMMDD-HHmm')
package_name.append(date_suffix)
return '-'.join(package_name)

View File

@ -63,17 +63,6 @@ def server(couchdb_connection='http://admin:password@localhost:5984/', keep_test
raise err raise err
@inv.task
def tasks(verbosity=0):
"""
Test the bundled tasks for working with rookeries.
:param verbosity: The amount of logging from the test. Default is 0 and is the lowest. 3 is the highest.
"""
test_command = _prepare_py_test_command('tests/tasks', check_coverage_on='tasks', verbosity=verbosity)
inv.run(test_command, echo=True, pty=True)
@inv.task @inv.task
def features(server_host='localhost', port=7000, couchdb_connection='http://admin:password@localhost:5984/', def features(server_host='localhost', port=7000, couchdb_connection='http://admin:password@localhost:5984/',
keep_test_db=False, verbosity=0, browser='firefox', remote_browser_url=''): keep_test_db=False, verbosity=0, browser='firefox', remote_browser_url=''):
@ -112,6 +101,6 @@ def features(server_host='localhost', port=7000, couchdb_connection='http://admi
test_server.terminate() test_server.terminate()
@inv.task(clean, server, tasks, style, name='all') @inv.task(clean, server, style, name='all')
def test_all(): def test_all():
print(u'Everything looks good! ☻') print(u'Everything looks good! ☻')

View File

@ -1,37 +0,0 @@
"""
Unit tests for base deployment base functionality.
:copyright: Copyright 2013-2015, Dorian Pula <dorian.pula@amber-penguin-software.ca>
:license: AGPL v3+
"""
import arrow
import mock
import rookeries
from tasks import deploy
def test_generate_package_name_returns_deployable_app_package_name_with_version():
expected_filename = 'rookeries-{0}'.format(rookeries.__version__)
actual_filename = deploy.generate_package_name()
assert expected_filename == actual_filename
def test_generate_package_name_returns_deployable_app_package_name_with_suffix_when_suffix_included():
test_suffix = 'TESTING'
expected_filename = 'rookeries-{0}-{1}'.format(rookeries.__version__, test_suffix)
actual_filename = deploy.generate_package_name(pkg_suffix=test_suffix)
assert expected_filename == actual_filename
@mock.patch('arrow.now', autospec=True)
def test_generate_package_name_returns_deployable_app_package_name_with_date_when_date_suffix_flag_added(
mock_arrow_now):
expected_suffix = '19991231-1200'
test_now = arrow.get(expected_suffix, 'YYYYMMDD-HHmm')
mock_arrow_now.return_value = test_now
expected_filename = 'rookeries-{0}-{1}'.format(rookeries.__version__, expected_suffix)
actual_filename = deploy.generate_package_name(add_date_suffix=True)
assert expected_filename == actual_filename