Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.toolbox
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
5
Merge Requests
5
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
slapos.toolbox
Commits
f31b2615
Commit
f31b2615
authored
Jun 19, 2019
by
Bryton Lacquement
🚪
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wip
parent
d3978d69
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
14 deletions
+27
-14
slapos/promise/plugin/check_file_state.py
slapos/promise/plugin/check_file_state.py
+2
-4
slapos/test/promise/plugin/test_check_file_state.py
slapos/test/promise/plugin/test_check_file_state.py
+25
-10
No files found.
slapos/promise/plugin/check_file_state.py
View file @
f31b2615
from
zope
import
interface
as
zope_interface
from
zope
.interface
import
implementer
from
slapos.grid.promise
import
interface
from
slapos.grid.promise.generic
import
GenericPromise
@
implementer
(
interface
.
IPromise
)
class
RunPromise
(
GenericPromise
):
zope_interface
.
implements
(
interface
.
IPromise
)
def
__init__
(
self
,
config
):
GenericPromise
.
__init__
(
self
,
config
)
# SR can set custom periodicity
...
...
slapos/test/promise/plugin/test_check_file_state.py
View file @
f31b2615
...
...
@@ -32,6 +32,7 @@ import tempfile
import
os
import
unittest
import
shutil
import
six
class
TestCheckFileState
(
TestPromisePluginMixin
):
...
...
@@ -67,11 +68,18 @@ extra_config_dict = {
self
.
launcher
.
run
()
result
=
self
.
getPromiseResult
(
self
.
promise_name
)
self
.
assertEqual
(
result
[
'result'
][
'failed'
],
True
)
self
.
assertEqual
(
result
[
'result'
][
'message'
],
"ERROR IOError(21, 'Is a directory') "
"during opening and reading file %r"
%
(
filename
,)
)
if
six
.
PY3
:
self
.
assertEqual
(
result
[
'result'
][
'message'
],
"ERROR IsADirectoryError(21, 'Is a directory') "
"during opening and reading file %r"
%
(
filename
,)
)
else
:
self
.
assertEqual
(
result
[
'result'
][
'message'
],
"ERROR IOError(21, 'Is a directory') "
"during opening and reading file %r"
%
(
filename
,)
)
def
test_check_file_not_exists
(
self
):
filename
=
os
.
path
.
join
(
self
.
tempdir
,
'test.file'
)
...
...
@@ -86,11 +94,18 @@ extra_config_dict = {
self
.
launcher
.
run
()
result
=
self
.
getPromiseResult
(
self
.
promise_name
)
self
.
assertEqual
(
result
[
'result'
][
'failed'
],
True
)
self
.
assertEqual
(
result
[
'result'
][
'message'
],
"ERROR IOError(2, 'No such file or directory') "
"during opening and reading file %r"
%
(
filename
,)
)
if
six
.
PY3
:
self
.
assertEqual
(
result
[
'result'
][
'message'
],
"ERROR FileNotFoundError(2, 'No such file or directory') "
"during opening and reading file %r"
%
(
filename
,)
)
else
:
self
.
assertEqual
(
result
[
'result'
][
'message'
],
"ERROR IOError(2, 'No such file or directory') "
"during opening and reading file %r"
%
(
filename
,)
)
def
test_check_file_empty
(
self
):
filename
=
os
.
path
.
join
(
self
.
tempdir
,
'test.file'
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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