Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
beat
beat.cmdline
Commits
5dece5bf
Commit
5dece5bf
authored
Apr 19, 2017
by
Philip ABBET
Browse files
[tests] Add tests for 'beat algorithms execute ...'
parent
af22b1ba
Changes
8
Hide whitespace changes
Inline
Side-by-side
beat/cmdline/test/instructions/0123456789AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA.0.9.data
0 → 100644
View file @
5dece5bf
File added
beat/cmdline/test/instructions/0123456789AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA.0.9.data.checksum
0 → 100644
View file @
5dece5bf
8e8289bebad55107a3080301315d8b635917b98f69ff46179478774ae156b320
\ No newline at end of file
beat/cmdline/test/instructions/0123456789AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA.0.9.index
0 → 100644
View file @
5dece5bf
0 0
1 1
2 2
3 3
4 4
5 5
6 6
7 7
8 8
9 9
beat/cmdline/test/instructions/0123456789AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA.0.9.index.checksum
0 → 100644
View file @
5dece5bf
2379df860edf08b1a8f070d95c3cd8720d5a8f9e540f1d34cfe8df262bc6b773
\ No newline at end of file
beat/cmdline/test/instructions/algo_using_cached_files.json
0 → 100644
View file @
5dece5bf
{
"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"
}
}
beat/cmdline/test/instructions/algo_using_database.json
0 → 100644
View file @
5dece5bf
{
"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"
}
}
beat/cmdline/test/instructions/analyzer.json
0 → 100644
View file @
5dece5bf
{
"algorithm"
:
"user/integers_analysis/1"
,
"channel"
:
"main"
,
"inputs"
:
{
"input"
:
{
"hash"
:
"abcdef0123456789AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
,
"channel"
:
"main"
}
},
"parameters"
:
{
},
"environment"
:
{
"name"
:
"environment"
,
"version"
:
"1"
}
}
beat/cmdline/test/test_algorithms.py
100644 → 100755
View file @
5dece5bf
...
...
@@ -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
)
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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