Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.core
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
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Lisa Casino
slapos.core
Commits
8a042e67
Commit
8a042e67
authored
Aug 11, 2011
by
Antoine Catton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding a real way to check if promises are executed
The promises now create a file and the test assert if it exists
parent
bf85c79a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
6 deletions
+24
-6
slapos/tests/slapgrid.py
slapos/tests/slapgrid.py
+24
-6
No files found.
slapos/tests/slapgrid.py
View file @
8a042e67
...
@@ -483,11 +483,14 @@ chmod 755 etc/run/wrapper
...
@@ -483,11 +483,14 @@ chmod 755 etc/run/wrapper
promise_path
=
os
.
path
.
join
(
instance_path
,
'etc'
,
'promise'
)
promise_path
=
os
.
path
.
join
(
instance_path
,
'etc'
,
'promise'
)
os
.
makedirs
(
promise_path
)
os
.
makedirs
(
promise_path
)
fail
=
os
.
path
.
join
(
promise_path
,
'fail'
)
fail
=
os
.
path
.
join
(
promise_path
,
'fail'
)
worked_file
=
os
.
path
.
join
(
instance_path
,
'fail_worked'
)
with
open
(
fail
,
'w'
)
as
f
:
with
open
(
fail
,
'w'
)
as
f
:
f
.
write
(
"""#!/usr/bin/env sh
f
.
write
(
"""#!/usr/bin/env sh
exit 127"""
)
touch "%(worked_file)s"
exit 127"""
%
{
'worked_file'
:
worked_file
})
os
.
chmod
(
fail
,
0777
)
os
.
chmod
(
fail
,
0777
)
self
.
assertTrue
(
self
.
grid
.
processComputerPartitionList
())
self
.
assertTrue
(
self
.
grid
.
processComputerPartitionList
())
self
.
assertTrue
(
os
.
path
.
isfile
(
worked_file
))
self
.
assertTrue
(
self
.
error
)
self
.
assertTrue
(
self
.
error
)
...
@@ -532,11 +535,14 @@ exit 127""")
...
@@ -532,11 +535,14 @@ exit 127""")
promise_path
=
os
.
path
.
join
(
instance_path
,
'etc'
,
'promise'
)
promise_path
=
os
.
path
.
join
(
instance_path
,
'etc'
,
'promise'
)
os
.
makedirs
(
promise_path
)
os
.
makedirs
(
promise_path
)
succeed
=
os
.
path
.
join
(
promise_path
,
'succeed'
)
succeed
=
os
.
path
.
join
(
promise_path
,
'succeed'
)
worked_file
=
os
.
path
.
join
(
instance_path
,
'succeed_worked'
)
with
open
(
succeed
,
'w'
)
as
f
:
with
open
(
succeed
,
'w'
)
as
f
:
f
.
write
(
"""#!/usr/bin/env sh
f
.
write
(
"""#!/usr/bin/env sh
exit 0"""
)
touch "%(worked_file)s"
exit 0"""
%
{
'worked_file'
:
worked_file
})
os
.
chmod
(
succeed
,
0777
)
os
.
chmod
(
succeed
,
0777
)
self
.
assertTrue
(
self
.
grid
.
processComputerPartitionList
())
self
.
assertTrue
(
self
.
grid
.
processComputerPartitionList
())
self
.
assertTrue
(
os
.
path
.
isfile
(
worked_file
))
self
.
assertFalse
(
self
.
error
)
self
.
assertFalse
(
self
.
error
)
...
@@ -586,12 +592,15 @@ exit 0""")
...
@@ -586,12 +592,15 @@ exit 0""")
promise_path
=
os
.
path
.
join
(
instance_path
,
'etc'
,
'promise'
)
promise_path
=
os
.
path
.
join
(
instance_path
,
'etc'
,
'promise'
)
os
.
makedirs
(
promise_path
)
os
.
makedirs
(
promise_path
)
succeed
=
os
.
path
.
join
(
promise_path
,
'stderr_writer'
)
succeed
=
os
.
path
.
join
(
promise_path
,
'stderr_writer'
)
worked_file
=
os
.
path
.
join
(
instance_path
,
'stderr_worked'
)
with
open
(
succeed
,
'w'
)
as
f
:
with
open
(
succeed
,
'w'
)
as
f
:
f
.
write
(
"""#!/usr/bin/env sh
f
.
write
(
"""#!/usr/bin/env sh
touch "%(worked_file)s"
echo -n Error 1>&2
echo -n Error 1>&2
exit 127"""
)
exit 127"""
%
{
'worked_file'
:
worked_file
}
)
os
.
chmod
(
succeed
,
0777
)
os
.
chmod
(
succeed
,
0777
)
self
.
assertTrue
(
self
.
grid
.
processComputerPartitionList
())
self
.
assertTrue
(
self
.
grid
.
processComputerPartitionList
())
self
.
assertTrue
(
os
.
path
.
isfile
(
worked_file
))
self
.
assertTrue
(
self
.
error
)
self
.
assertTrue
(
self
.
error
)
...
@@ -641,12 +650,15 @@ exit 127""")
...
@@ -641,12 +650,15 @@ exit 127""")
promise_path
=
os
.
path
.
join
(
instance_path
,
'etc'
,
'promise'
)
promise_path
=
os
.
path
.
join
(
instance_path
,
'etc'
,
'promise'
)
os
.
makedirs
(
promise_path
)
os
.
makedirs
(
promise_path
)
succeed
=
os
.
path
.
join
(
promise_path
,
'timed_out_promise'
)
succeed
=
os
.
path
.
join
(
promise_path
,
'timed_out_promise'
)
worked_file
=
os
.
path
.
join
(
instance_path
,
'timed_out_worked'
)
with
open
(
succeed
,
'w'
)
as
f
:
with
open
(
succeed
,
'w'
)
as
f
:
f
.
write
(
"""#!/usr/bin/env sh
f
.
write
(
"""#!/usr/bin/env sh
touch "%(worked_file)s"
sleep 5
sleep 5
exit 0"""
)
exit 0"""
%
{
'worked_file'
:
worked_file
}
)
os
.
chmod
(
succeed
,
0777
)
os
.
chmod
(
succeed
,
0777
)
self
.
assertTrue
(
self
.
grid
.
processComputerPartitionList
())
self
.
assertTrue
(
self
.
grid
.
processComputerPartitionList
())
self
.
assertTrue
(
os
.
path
.
isfile
(
worked_file
))
self
.
assertTrue
(
self
.
error
)
self
.
assertTrue
(
self
.
error
)
...
@@ -692,18 +704,24 @@ exit 0""")
...
@@ -692,18 +704,24 @@ exit 0""")
os
.
makedirs
(
promise_path
)
os
.
makedirs
(
promise_path
)
succeed
=
os
.
path
.
join
(
promise_path
,
'succeed'
)
succeed
=
os
.
path
.
join
(
promise_path
,
'succeed'
)
worked_file
=
os
.
path
.
join
(
instance_path
,
'succeed_worked'
)
with
open
(
succeed
,
'w'
)
as
f
:
with
open
(
succeed
,
'w'
)
as
f
:
f
.
write
(
"""#!/usr/bin/env sh
f
.
write
(
"""#!/usr/bin/env sh
exit 0"""
)
touch "%(worked_file)s"
exit 0"""
%
{
'worked_file'
:
worked_file
})
os
.
chmod
(
succeed
,
0777
)
os
.
chmod
(
succeed
,
0777
)
succeed_2
=
os
.
path
.
join
(
promise_path
,
'succeed_2'
)
succeed_2
=
os
.
path
.
join
(
promise_path
,
'succeed_2'
)
worked_file_2
=
os
.
path
.
join
(
instance_path
,
'succeed_2_worked'
)
with
open
(
succeed_2
,
'w'
)
as
f
:
with
open
(
succeed_2
,
'w'
)
as
f
:
f
.
write
(
"""#!/usr/bin/env sh
f
.
write
(
"""#!/usr/bin/env sh
exit 0"""
)
touch "%(worked_file)s"
exit 0"""
%
{
'worked_file'
:
worked_file_2
})
os
.
chmod
(
succeed_2
,
0777
)
os
.
chmod
(
succeed_2
,
0777
)
self
.
assertTrue
(
self
.
grid
.
processComputerPartitionList
())
self
.
assertTrue
(
self
.
grid
.
processComputerPartitionList
())
self
.
assertTrue
(
os
.
path
.
isfile
(
worked_file
))
self
.
assertTrue
(
os
.
path
.
isfile
(
worked_file_2
))
self
.
assertFalse
(
self
.
error
)
self
.
assertFalse
(
self
.
error
)
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