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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
slapos.core
Commits
59ccce27
Commit
59ccce27
authored
Sep 18, 2012
by
Cédric de Saint Martin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Factor wrapper, add sleep in it
parent
62875167
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
28 deletions
+12
-28
slapos/tests/slapgrid.py
slapos/tests/slapgrid.py
+12
-28
No files found.
slapos/tests/slapgrid.py
View file @
59ccce27
...
@@ -13,6 +13,14 @@ import unittest
...
@@ -13,6 +13,14 @@ import unittest
import
urlparse
import
urlparse
import
xml_marshaller
import
xml_marshaller
WRAPPER_CONTENT
=
"""#!/bin/sh
touch worked &&
mkdir -p etc/run &&
echo "#!/bin/sh" > etc/run/wrapper &&
echo "while :; do echo "Working
\
\
nWorking
\
\
n" ; sleep 0.1; done" >> etc/run/wrapper &&
chmod 755 etc/run/wrapper
"""
class
BasicMixin
:
class
BasicMixin
:
def
assertSortedListEqual
(
self
,
list1
,
list2
,
msg
=
None
):
def
assertSortedListEqual
(
self
,
list1
,
list2
,
msg
=
None
):
self
.
assertListEqual
(
sorted
(
list1
),
sorted
(
list2
),
msg
)
self
.
assertListEqual
(
sorted
(
list1
),
sorted
(
list2
),
msg
)
...
@@ -274,13 +282,7 @@ touch worked""")
...
@@ -274,13 +282,7 @@ touch worked""")
"""[buildout]"""
)
"""[buildout]"""
)
srbindir
=
os
.
path
.
join
(
srdir
,
'bin'
)
srbindir
=
os
.
path
.
join
(
srdir
,
'bin'
)
os
.
mkdir
(
srbindir
)
os
.
mkdir
(
srbindir
)
open
(
os
.
path
.
join
(
srbindir
,
'buildout'
),
'w'
).
write
(
"""#!/bin/sh
open
(
os
.
path
.
join
(
srbindir
,
'buildout'
),
'w'
).
write
(
WRAPPER_CONTENT
)
touch worked &&
mkdir -p etc/run &&
echo "#!/bin/sh" > etc/run/wrapper &&
echo "while :; do echo "Working
\
\
nWorking
\
\
n" ; done" >> etc/run/wrapper &&
chmod 755 etc/run/wrapper
"""
)
os
.
chmod
(
os
.
path
.
join
(
srbindir
,
'buildout'
),
0755
)
os
.
chmod
(
os
.
path
.
join
(
srbindir
,
'buildout'
),
0755
)
self
.
assertTrue
(
self
.
grid
.
processComputerPartitionList
())
self
.
assertTrue
(
self
.
grid
.
processComputerPartitionList
())
self
.
assertSortedListEqual
(
os
.
listdir
(
self
.
instance_root
),
[
'0'
,
'etc'
,
self
.
assertSortedListEqual
(
os
.
listdir
(
self
.
instance_root
),
[
'0'
,
'etc'
,
...
@@ -400,13 +402,7 @@ chmod 755 etc/run/wrapper
...
@@ -400,13 +402,7 @@ chmod 755 etc/run/wrapper
"""[buildout]"""
)
"""[buildout]"""
)
srbindir
=
os
.
path
.
join
(
srdir
,
'bin'
)
srbindir
=
os
.
path
.
join
(
srdir
,
'bin'
)
os
.
mkdir
(
srbindir
)
os
.
mkdir
(
srbindir
)
open
(
os
.
path
.
join
(
srbindir
,
'buildout'
),
'w'
).
write
(
"""#!/bin/sh
open
(
os
.
path
.
join
(
srbindir
,
'buildout'
),
'w'
).
write
(
WRAPPER_CONTENT
)
touch worked &&
mkdir -p etc/run &&
echo "#!/bin/sh" > etc/run/wrapper &&
echo "while :; do echo "Working
\
\
nWorking
\
\
n" ; done" >> etc/run/wrapper &&
chmod 755 etc/run/wrapper
"""
)
os
.
chmod
(
os
.
path
.
join
(
srbindir
,
'buildout'
),
0755
)
os
.
chmod
(
os
.
path
.
join
(
srbindir
,
'buildout'
),
0755
)
self
.
assertTrue
(
self
.
grid
.
processComputerPartitionList
())
self
.
assertTrue
(
self
.
grid
.
processComputerPartitionList
())
self
.
assertSortedListEqual
(
os
.
listdir
(
self
.
instance_root
),
[
'0'
,
'etc'
,
self
.
assertSortedListEqual
(
os
.
listdir
(
self
.
instance_root
),
[
'0'
,
'etc'
,
...
@@ -682,13 +678,7 @@ class TestSlapgridUsageReport(MasterMixin, unittest.TestCase):
...
@@ -682,13 +678,7 @@ class TestSlapgridUsageReport(MasterMixin, unittest.TestCase):
self
.
sequence
=
[]
self
.
sequence
=
[]
self
.
started
=
False
self
.
started
=
False
httplib
.
HTTPConnection
.
_callback
=
_server_response
(
self
,
'started'
)
httplib
.
HTTPConnection
.
_callback
=
_server_response
(
self
,
'started'
)
open
(
os
.
path
.
join
(
srbindir
,
'buildout'
),
'w'
).
write
(
"""#!/bin/sh
open
(
os
.
path
.
join
(
srbindir
,
'buildout'
),
'w'
).
write
(
WRAPPER_CONTENT
)
touch worked &&
mkdir -p etc/run &&
echo "#!/bin/sh" > etc/run/wrapper &&
echo "while :; do echo "Working
\
\
nWorking
\
\
n" ; done" >> etc/run/wrapper &&
chmod 755 etc/run/wrapper
"""
)
os
.
chmod
(
os
.
path
.
join
(
srbindir
,
'buildout'
),
0755
)
os
.
chmod
(
os
.
path
.
join
(
srbindir
,
'buildout'
),
0755
)
self
.
assertTrue
(
self
.
grid
.
processComputerPartitionList
())
self
.
assertTrue
(
self
.
grid
.
processComputerPartitionList
())
self
.
assertSortedListEqual
(
os
.
listdir
(
self
.
instance_root
),
[
'0'
,
'etc'
,
self
.
assertSortedListEqual
(
os
.
listdir
(
self
.
instance_root
),
[
'0'
,
'etc'
,
...
@@ -759,13 +749,7 @@ chmod 755 etc/run/wrapper
...
@@ -759,13 +749,7 @@ chmod 755 etc/run/wrapper
self
.
sequence
=
[]
self
.
sequence
=
[]
self
.
started
=
False
self
.
started
=
False
httplib
.
HTTPConnection
.
_callback
=
_server_response
(
self
,
'started'
)
httplib
.
HTTPConnection
.
_callback
=
_server_response
(
self
,
'started'
)
open
(
os
.
path
.
join
(
srbindir
,
'buildout'
),
'w'
).
write
(
"""#!/bin/sh
open
(
os
.
path
.
join
(
srbindir
,
'buildout'
),
'w'
).
write
(
WRAPPER_CONTENT
)
touch worked &&
mkdir -p etc/run &&
echo "#!/bin/sh" > etc/run/wrapper &&
echo "while :; do echo "Working
\
\
nWorking
\
\
n" ; sleep 0.1; done" >> etc/run/wrapper &&
chmod 755 etc/run/wrapper
"""
)
os
.
chmod
(
os
.
path
.
join
(
srbindir
,
'buildout'
),
0755
)
os
.
chmod
(
os
.
path
.
join
(
srbindir
,
'buildout'
),
0755
)
self
.
assertTrue
(
self
.
grid
.
processComputerPartitionList
())
self
.
assertTrue
(
self
.
grid
.
processComputerPartitionList
())
self
.
assertSortedListEqual
(
os
.
listdir
(
self
.
instance_root
),
[
'0'
,
'etc'
,
self
.
assertSortedListEqual
(
os
.
listdir
(
self
.
instance_root
),
[
'0'
,
'etc'
,
...
...
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