-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
329 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ | |
'pyyaml', | ||
'click', | ||
'glob2', | ||
'monkeypatch', | ||
'jsonpointer', | ||
'jsonpath-rw', | ||
'jq', | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
from packtivity.handlers.publisher_handlers import handlers | ||
from packtivity.typedleafs import TypedLeafs | ||
|
||
from packtivity.handlers.environment_handlers import handlers | ||
from packtivity.syncbackends import finalize_inputs | ||
|
||
import logging | ||
import monkeypatch | ||
|
||
def test_docker_parmounts(tmpdir,basic_localfs_state, docker_env_parmounts): | ||
state = basic_localfs_state | ||
environment = docker_env_parmounts.spec['environment'] | ||
|
||
parameters, state = finalize_inputs(TypedLeafs({'outputfile': '{workdir}/hello.txt'}), state) | ||
env = handlers[environment['environment_type']]['default'](environment,parameters,state) | ||
assert env['par_mounts'][0]['mountcontent'] == '"{}"'.format(parameters['outputfile']) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
from packtivity.handlers.publisher_handlers import handlers | ||
from packtivity.typedleafs import TypedLeafs | ||
|
||
from packtivity.handlers.execution_handlers import run_docker_with_oneliner, docker_execution_cmdline | ||
import logging | ||
import monkeypatch | ||
|
||
def test_docker_cvmfs(tmpdir,basic_localfs_state, docker_env_resources, monkeypatch): | ||
state = basic_localfs_state | ||
environment = docker_env_resources.spec['environment'] | ||
log = logging.getLogger('test') | ||
job = {'command': 'echo hello world'} | ||
container_argv, stdin = run_docker_with_oneliner(environment,job,log) | ||
|
||
assert container_argv == ['sh','-c','echo hello world'] | ||
assert stdin == None | ||
|
||
cmdline = docker_execution_cmdline( | ||
state,environment,log,{'name':'myname'}, | ||
stdin = stdin, | ||
cmd_argv = container_argv | ||
) | ||
assert '-v /cvmfs:/cvmfs' in cmdline | ||
|
||
monkeypatch.setenv('PACKTIVITY_CVMFS_LOCATION','/here/cvmfs') | ||
cmdline = docker_execution_cmdline( | ||
state,environment,log,{'name':'myname'}, | ||
stdin = stdin, | ||
cmd_argv = container_argv | ||
) | ||
assert '-v /here/cvmfs:/cvmfs' in cmdline | ||
|
||
monkeypatch.setenv('PACKTIVITY_CVMFS_SOURCE','voldriver') | ||
cmdline = docker_execution_cmdline( | ||
state,environment,log,{'name':'myname'}, | ||
stdin = stdin, | ||
cmd_argv = container_argv | ||
) | ||
|
||
assert '-v atlas-condb.cern.ch:/cvmfs/atlas-condb.cern.ch:rw' in cmdline | ||
assert '-v sft.cern.ch:/cvmfs/sft.cern.ch:rw' in cmdline | ||
assert '-v atlas.cern.ch:/cvmfs/atlas.cern.ch:rw' in cmdline | ||
assert '--security-opt label:disable' in cmdline | ||
|
||
|
||
def test_docker_auth(tmpdir,basic_localfs_state, docker_env_resources, monkeypatch): | ||
state = basic_localfs_state | ||
environment = docker_env_resources.spec['environment'] | ||
log = logging.getLogger('test') | ||
job = {'command': 'echo hello world'} | ||
container_argv, stdin = run_docker_with_oneliner(environment,job,log) | ||
|
||
assert container_argv == ['sh','-c','echo hello world'] | ||
assert stdin == None | ||
|
||
cmdline = docker_execution_cmdline( | ||
state,environment,log,{'name':'myname'}, | ||
stdin = stdin, | ||
cmd_argv = container_argv | ||
) | ||
assert '-v /home/recast/recast_auth:/recast_auth:rw' in cmdline | ||
|
||
monkeypatch.setenv('PACKTIVITY_AUTH_LOCATION','/here') | ||
cmdline = docker_execution_cmdline( | ||
state,environment,log,{'name':'myname'}, | ||
stdin = stdin, | ||
cmd_argv = container_argv | ||
) | ||
assert '-v /here:/recast_auth:rw' in cmdline |
Oops, something went wrong.