Commit 5dece5bf authored by Philip ABBET's avatar Philip ABBET
Browse files

[tests] Add tests for 'beat algorithms execute ...'

parent af22b1ba
8e8289bebad55107a3080301315d8b635917b98f69ff46179478774ae156b320
\ No newline at end of file
2379df860edf08b1a8f070d95c3cd8720d5a8f9e540f1d34cfe8df262bc6b773
\ No newline at end of file
{
"algorithm": "user/integers_echo/1",
"channel": "main",
"inputs": {
"in_data": {
"hash": "abcdef0123456789AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
"channel": "main"
}
},
"outputs": {
"out_data": {
"channel": "main"
}
},
"parameters": {
},
"environment": {
"name": "environment",
"version": "1"
}
}
{
"algorithm": "user/integers_echo/1",
"channel": "main",
"inputs": {
"in_data": {
"database": "integers_db/1",
"protocol": "double",
"set": "double",
"output": "a",
"channel": "main"
}
},
"outputs": {
"out_data": {
"channel": "main"
}
},
"parameters": {
},
"environment": {
"name": "environment",
"version": "1"
}
}
{
"algorithm": "user/integers_analysis/1",
"channel": "main",
"inputs": {
"input": {
"hash": "abcdef0123456789AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
"channel": "main"
}
},
"parameters": {
},
"environment": {
"name": "environment",
"version": "1"
}
}
......@@ -29,6 +29,8 @@
# Basic tests for the command line beat program: algorithms
import nose.tools
import os
import shutil
from . import platform, disconnected, prefix, tmp_prefix, user, token
from ..common import Selector
......@@ -42,12 +44,14 @@ def call(*args, **kwargs):
use_prefix = kwargs.get('prefix', prefix)
use_platform = kwargs.get('platform', platform)
use_cache = kwargs.get('cache', 'cache')
return main((
'--platform=%s' % use_platform,
'--user=%s' % user,
'--token=%s' % token,
'--prefix=%s' % use_prefix,
'--cache=%s' % use_cache,
'--test-mode',
'algorithm',
) + args)
......@@ -174,3 +178,44 @@ def test_push_and_delete():
# now push the new object and then delete it remotely
nose.tools.eq_(call('push', obj, prefix=tmp_prefix), 0)
nose.tools.eq_(call('rm', '--remote', obj, prefix=tmp_prefix), 0)
@slow
@nose.tools.with_setup(teardown=cleanup)
def test_execute_algorithm_using_database():
instructions = os.path.join(os.path.dirname(__file__), 'instructions/algo_using_database.json')
nose.tools.eq_(call('execute', instructions, cache=tmp_prefix), 0)
@slow
@nose.tools.with_setup(teardown=cleanup)
def test_execute_algorithm_using_cached_files():
instructions_dir = os.path.join(os.path.dirname(__file__), 'instructions')
cache_dir = os.path.join(tmp_prefix, 'ab', 'cd', 'ef')
os.makedirs(cache_dir)
shutil.copy(os.path.join(instructions_dir, '0123456789AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA.0.9.data'), cache_dir)
shutil.copy(os.path.join(instructions_dir, '0123456789AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA.0.9.data.checksum'), cache_dir)
shutil.copy(os.path.join(instructions_dir, '0123456789AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA.0.9.index'), cache_dir)
shutil.copy(os.path.join(instructions_dir, '0123456789AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA.0.9.index.checksum'), cache_dir)
instructions = os.path.join(instructions_dir, 'algo_using_cached_files.json')
nose.tools.eq_(call('execute', instructions, cache=tmp_prefix), 0)
@slow
@nose.tools.with_setup(teardown=cleanup)
def test_execute_analyzer():
instructions_dir = os.path.join(os.path.dirname(__file__), 'instructions')
cache_dir = os.path.join(tmp_prefix, 'ab', 'cd', 'ef')
os.makedirs(cache_dir)
shutil.copy(os.path.join(instructions_dir, '0123456789AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA.0.9.data'), cache_dir)
shutil.copy(os.path.join(instructions_dir, '0123456789AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA.0.9.data.checksum'), cache_dir)
shutil.copy(os.path.join(instructions_dir, '0123456789AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA.0.9.index'), cache_dir)
shutil.copy(os.path.join(instructions_dir, '0123456789AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA.0.9.index.checksum'), cache_dir)
instructions = os.path.join(instructions_dir, 'analyzer.json')
nose.tools.eq_(call('execute', instructions, cache=tmp_prefix), 0)
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