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.core
Commits
be7768d4
Commit
be7768d4
authored
Oct 22, 2018
by
Samuel GAIST
Browse files
[test][docker_execution] Build algorithm as part of the corresponding tests
parent
28d15351
Changes
1
Hide whitespace changes
Inline
Side-by-side
beat/core/test/test_docker_execution.py
View file @
be7768d4
...
...
@@ -42,6 +42,8 @@ from .test_execution import BaseExecutionMixIn
from
.
import
network_name
from
.
import
DOCKER_NETWORK_TEST_ENABLED
BUILDER_IMAGE
=
"docker.idiap.ch/beat/beat.env.client:2.0.0r0"
#----------------------------------------------------------
...
...
@@ -71,6 +73,24 @@ class TestDockerExecution(BaseExecutionMixIn):
return
executor
def
build_algorithm
(
self
,
algorithm
):
test_folder
=
os
.
path
.
abspath
(
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
)))
scripts_folder
=
os
.
path
.
abspath
(
os
.
path
.
join
(
test_folder
,
'../../../'
))
sources_folder
=
os
.
path
.
abspath
(
os
.
path
.
join
(
test_folder
,
algorithm
))
cmd
=
[
'/build.sh'
]
builder_container
=
self
.
host
.
create_container
(
BUILDER_IMAGE
,
cmd
)
builder_container
.
add_volume
(
"%s/scripts/build.sh"
%
scripts_folder
,
"/build.sh"
)
builder_container
.
add_volume
(
sources_folder
,
"/sources"
,
read_only
=
False
)
builder_container
.
uid
=
os
.
getuid
()
builder_container
.
set_workdir
(
"/sources"
)
builder_container
.
set_entrypoint
(
"bash"
)
self
.
host
.
start
(
builder_container
)
status
=
self
.
host
.
wait
(
builder_container
)
self
.
host
.
rm
(
builder_container
)
assert
status
==
0
@
slow
@
skipif
(
not
DOCKER_NETWORK_TEST_ENABLED
,
"Network test disabled"
)
def
test_custom_network
(
self
):
...
...
@@ -108,22 +128,30 @@ class TestDockerExecution(BaseExecutionMixIn):
@
slow
def
test_cxx_double_legacy
(
self
):
datasets_uid
=
os
.
getuid
()
self
.
build_algorithm
(
"prefix/algorithms/user/cxx_integers_echo_legacy"
)
result
=
self
.
execute
(
'user/user/double/1/cxx_double_legacy'
,
[{
'out_data'
:
42
}],
datasets_uid
=
datasets_uid
)
assert
result
is
None
@
slow
def
test_cxx_double_sequential
(
self
):
datasets_uid
=
os
.
getuid
()
self
.
build_algorithm
(
"prefix/algorithms/user/cxx_integers_echo_sequential"
)
assert
self
.
execute
(
'user/user/double/1/cxx_double_sequential'
,
[{
'out_data'
:
42
}],
datasets_uid
=
datasets_uid
)
is
None
@
slow
def
test_cxx_double_autonomous
(
self
):
datasets_uid
=
os
.
getuid
()
self
.
build_algorithm
(
"prefix/algorithms/user/cxx_integers_echo_autonomous"
)
assert
self
.
execute
(
'user/user/double/1/cxx_double_autonomous'
,
[{
'out_data'
:
42
}],
datasets_uid
=
datasets_uid
)
is
None
@
slow
def
test_cxx_analyzer_error
(
self
):
datasets_uid
=
os
.
getuid
()
self
.
build_algorithm
(
"prefix/algorithms/user/cxx_integers_echo_analyzer"
)
result
=
self
.
execute
(
'user/user/double/1/cxx_analyzer_error'
,
[{
'out_data'
:
42
}],
datasets_uid
=
datasets_uid
)
assert
result
[
'status'
]
==
255
...
...
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