Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
Pulsar
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
NDIP
Pulsar
Commits
755ac773
Commit
755ac773
authored
7 years ago
by
Nate Coraor
Browse files
Options
Downloads
Patches
Plain Diff
Proper fix for run as user test (staging dir must be group executable)
plus tempdir naming for ease of deciphering tracebacks.
parent
cf5bb71d
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
pulsar/scripts/chown_working_directory.py
+1
-1
1 addition, 1 deletion
pulsar/scripts/chown_working_directory.py
test/test_utils.py
+16
-11
16 additions, 11 deletions
test/test_utils.py
with
17 additions
and
12 deletions
pulsar/scripts/chown_working_directory.py
+
1
−
1
View file @
755ac773
...
...
@@ -29,7 +29,7 @@ def main(argv=None):
else
:
job_directory
=
abspath
(
args
.
job_directory
)
assert
job_directory
command
=
"
chown -R
'
%s
'
'
%s
'"
%
(
user
,
job_directory
)
command
=
"
chown -R
h
'
%s
'
'
%s
'"
%
(
user
,
job_directory
)
system
(
command
)
...
...
This diff is collapsed.
Click to expand it.
test/test_utils.py
+
16
−
11
View file @
755ac773
...
...
@@ -6,7 +6,7 @@ import sys
import
threading
from
contextlib
import
contextmanager
from
stat
import
S_IXOTH
from
stat
import
S_IXGRP
,
S_IXOTH
from
os
import
pardir
,
stat
,
chmod
,
access
,
X_OK
,
pathsep
,
environ
from
os
import
makedirs
,
listdir
from
os.path
import
join
,
dirname
,
isfile
,
split
...
...
@@ -60,12 +60,13 @@ integration_test = timed(INTEGRATION_MAXIMUM_TEST_TIME)
TEST_DIR
=
dirname
(
__file__
)
ROOT_DIR
=
join
(
TEST_DIR
,
pardir
)
TEST_TEMPDIR_PREFIX
=
'
tmp_pulsar_
'
class
TempDirectoryTestCase
(
TestCase
):
def
setUp
(
self
):
self
.
temp_directory
=
mkdtemp
(
)
self
.
temp_directory
=
temp_directory_persist
(
prefix
=
TEST_TEMPDIR_PREFIX
)
def
tearDown
(
self
):
rmtree
(
self
.
temp_directory
)
...
...
@@ -84,7 +85,7 @@ def get_test_tool():
class
TestManager
(
object
):
def
setup_temp_directory
(
self
):
self
.
temp_directory
=
mkdtemp
(
)
self
.
temp_directory
=
temp_directory_persist
(
prefix
=
'
test_manager_
'
)
self
.
__job_directory
=
JobDirectory
(
self
.
temp_directory
,
'
1
'
)
def
cleanup_temp_directory
(
self
):
...
...
@@ -96,19 +97,23 @@ class TestManager(object):
@contextmanager
def
test_job_directory
():
with
temp_directory
()
as
directory
:
with
temp_directory
(
prefix
=
'
job_
'
)
as
directory
:
yield
JobDirectory
(
directory
,
'
1
'
)
@contextmanager
def
temp_directory
():
directory
=
mkdtemp
(
)
def
temp_directory
(
prefix
=
''
):
directory
=
temp_directory_persist
(
prefix
=
prefix
)
try
:
yield
directory
finally
:
rmtree
(
directory
)
def
temp_directory_persist
(
prefix
=
''
):
return
mkdtemp
(
prefix
=
TEST_TEMPDIR_PREFIX
+
prefix
)
@contextmanager
def
test_manager
():
manager
=
TestManager
()
...
...
@@ -202,7 +207,7 @@ class BaseManagerTestCase(TestCase):
def
minimal_app_for_managers
():
"""
Minimimal app description for consumption by managers.
"""
staging_directory
=
mkdtemp
(
)
staging_directory
=
temp_directory_persist
(
prefix
=
'
minimal_app_
'
)
rmtree
(
staging_directory
)
authorizer
=
TestAuthorizer
()
return
Bunch
(
staging_directory
=
staging_directory
,
...
...
@@ -251,7 +256,7 @@ def test_pulsar_server(global_conf={}, app_conf={}, test_conf={}):
class
RestartablePulsarAppProvider
(
object
):
def
__init__
(
self
,
global_conf
=
{},
app_conf
=
{},
test_conf
=
{},
web
=
True
):
self
.
staging_directory
=
mkdtemp
(
)
self
.
staging_directory
=
temp_directory_persist
(
prefix
=
'
staging_
'
)
self
.
global_conf
=
global_conf
self
.
app_conf
=
app_conf
self
.
test_conf
=
test_conf
...
...
@@ -295,12 +300,12 @@ def test_pulsar_app(
):
clean_staging_directory
=
False
if
staging_directory
is
None
:
staging_directory
=
mkdtemp
(
)
staging_directory
=
temp_directory_persist
(
prefix
=
'
staging_
'
)
clean_staging_directory
=
True
# Make staging directory world executable for run as user tests.
mode
=
stat
(
staging_directory
).
st_mode
chmod
(
staging_directory
,
mode
|
S_IXOTH
)
cache_directory
=
mkd
temp
(
)
chmod
(
staging_directory
,
mode
|
S_IXGRP
|
S_IXOTH
)
cache_directory
=
temp
_directory_persist
(
prefix
=
'
cache_
'
)
app_conf
[
"
staging_directory
"
]
=
staging_directory
app_conf
[
"
file_cache_dir
"
]
=
cache_directory
app_conf
[
"
ensure_cleanup
"
]
=
True
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment