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
Ivan Tyagov
slapos.core
Commits
e3ee5379
Commit
e3ee5379
authored
Oct 08, 2012
by
Cédric de Saint Martin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Be more friendly with supervisor
parent
3801d868
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
27 deletions
+27
-27
slapos/tests/slapgrid.py
slapos/tests/slapgrid.py
+27
-27
No files found.
slapos/tests/slapgrid.py
View file @
e3ee5379
...
@@ -494,13 +494,13 @@ class TestSlapgridCPWithMaster(MasterMixin, unittest.TestCase):
...
@@ -494,13 +494,13 @@ class TestSlapgridCPWithMaster(MasterMixin, unittest.TestCase):
'var'
])
'var'
])
self
.
assertSortedListEqual
(
os
.
listdir
(
partition
.
partition_path
),
self
.
assertSortedListEqual
(
os
.
listdir
(
partition
.
partition_path
),
[
'.0_wrapper.log'
,
'worked'
,
'buildout.cfg'
,
'etc'
])
[
'.0_wrapper.log'
,
'worked'
,
'buildout.cfg'
,
'etc'
])
tries
=
1
0
tries
=
5
0
wrapper_log
=
os
.
path
.
join
(
partition
.
partition_path
,
'.0_wrapper.log'
)
wrapper_log
=
os
.
path
.
join
(
partition
.
partition_path
,
'.0_wrapper.log'
)
while
tries
>
0
:
while
tries
>
0
:
tries
-=
1
tries
-=
1
if
os
.
path
.
getsize
(
wrapper_log
)
>
0
:
if
os
.
path
.
getsize
(
wrapper_log
)
>
0
:
break
break
time
.
sleep
(
0.
2
)
time
.
sleep
(
0.
1
)
self
.
assertTrue
(
'Working'
in
open
(
wrapper_log
,
'r'
).
read
())
self
.
assertTrue
(
'Working'
in
open
(
wrapper_log
,
'r'
).
read
())
self
.
assertSortedListEqual
(
os
.
listdir
(
self
.
software_root
),
self
.
assertSortedListEqual
(
os
.
listdir
(
self
.
software_root
),
[
partition
.
software
.
software_hash
])
[
partition
.
software
.
software_hash
])
...
@@ -539,12 +539,12 @@ chmod 755 etc/run/wrapper
...
@@ -539,12 +539,12 @@ chmod 755 etc/run/wrapper
self
.
assertSortedListEqual
(
os
.
listdir
(
instance
.
partition_path
),
[
'.0_wrapper.log'
,
self
.
assertSortedListEqual
(
os
.
listdir
(
instance
.
partition_path
),
[
'.0_wrapper.log'
,
'worked'
,
'buildout.cfg'
,
'etc'
])
'worked'
,
'buildout.cfg'
,
'etc'
])
wrapper_log
=
os
.
path
.
join
(
instance
.
partition_path
,
'.0_wrapper.log'
)
wrapper_log
=
os
.
path
.
join
(
instance
.
partition_path
,
'.0_wrapper.log'
)
tries
=
1
0
tries
=
5
0
while
tries
>
0
:
while
tries
>
0
:
tries
-=
1
tries
-=
1
if
os
.
path
.
getsize
(
wrapper_log
)
>
0
:
if
os
.
path
.
getsize
(
wrapper_log
)
>
0
:
break
break
time
.
sleep
(
0.
2
)
time
.
sleep
(
0.
1
)
os
.
path
.
getsize
(
wrapper_log
)
os
.
path
.
getsize
(
wrapper_log
)
self
.
assertTrue
(
'Working'
in
open
(
wrapper_log
,
'r'
).
read
())
self
.
assertTrue
(
'Working'
in
open
(
wrapper_log
,
'r'
).
read
())
self
.
assertSortedListEqual
(
os
.
listdir
(
self
.
software_root
),
self
.
assertSortedListEqual
(
os
.
listdir
(
self
.
software_root
),
...
@@ -562,14 +562,14 @@ chmod 755 etc/run/wrapper
...
@@ -562,14 +562,14 @@ chmod 755 etc/run/wrapper
self
.
assertSortedListEqual
(
self
.
assertSortedListEqual
(
os
.
listdir
(
instance
.
partition_path
),
os
.
listdir
(
instance
.
partition_path
),
[
'.0_wrapper.log'
,
'.0_wrapper.log.1'
,
'worked'
,
'buildout.cfg'
,
'etc'
])
[
'.0_wrapper.log'
,
'.0_wrapper.log.1'
,
'worked'
,
'buildout.cfg'
,
'etc'
])
tries
=
1
0
tries
=
5
0
expected_text
=
'Signal handler called with signal 15'
expected_text
=
'Signal handler called with signal 15'
while
tries
>
0
:
while
tries
>
0
:
tries
-=
1
tries
-=
1
found
=
expected_text
in
open
(
wrapper_log
,
'r'
).
read
()
found
=
expected_text
in
open
(
wrapper_log
,
'r'
).
read
()
if
found
:
if
found
:
break
break
time
.
sleep
(
0.
2
)
time
.
sleep
(
0.
1
)
self
.
assertTrue
(
found
)
self
.
assertTrue
(
found
)
self
.
assertEqual
(
computer
.
sequence
,
self
.
assertEqual
(
computer
.
sequence
,
[
'getFullComputerInformation'
,
'availableComputerPartition'
,
[
'getFullComputerInformation'
,
'availableComputerPartition'
,
...
@@ -606,13 +606,13 @@ chmod 755 etc/run/wrapper
...
@@ -606,13 +606,13 @@ chmod 755 etc/run/wrapper
'worked'
,
'etc'
,
'buildout.cfg'
])
'worked'
,
'etc'
,
'buildout.cfg'
])
self
.
assertSortedListEqual
(
os
.
listdir
(
self
.
software_root
),
self
.
assertSortedListEqual
(
os
.
listdir
(
self
.
software_root
),
[
instance
.
software
.
software_hash
])
[
instance
.
software
.
software_hash
])
tries
=
1
0
tries
=
5
0
wrapper_log
=
os
.
path
.
join
(
instance
.
partition_path
,
'.0_wrapper.log'
)
wrapper_log
=
os
.
path
.
join
(
instance
.
partition_path
,
'.0_wrapper.log'
)
while
tries
>
0
:
while
tries
>
0
:
tries
-=
1
tries
-=
1
if
os
.
path
.
getsize
(
wrapper_log
)
>
0
:
if
os
.
path
.
getsize
(
wrapper_log
)
>
0
:
break
break
time
.
sleep
(
0.
2
)
time
.
sleep
(
0.
1
)
self
.
assertTrue
(
'Working'
in
open
(
wrapper_log
,
'r'
).
read
())
self
.
assertTrue
(
'Working'
in
open
(
wrapper_log
,
'r'
).
read
())
self
.
assertEqual
(
computer
.
sequence
,
self
.
assertEqual
(
computer
.
sequence
,
[
'getFullComputerInformation'
,
'availableComputerPartition'
,
[
'getFullComputerInformation'
,
'availableComputerPartition'
,
...
@@ -680,20 +680,20 @@ class TestSlapgridCPWithMasterWatchdog(MasterMixin, unittest.TestCase):
...
@@ -680,20 +680,20 @@ class TestSlapgridCPWithMasterWatchdog(MasterMixin, unittest.TestCase):
'var'
])
'var'
])
self
.
assertSortedListEqual
(
os
.
listdir
(
partition
.
partition_path
),
self
.
assertSortedListEqual
(
os
.
listdir
(
partition
.
partition_path
),
[
'.0_daemon.log'
,
'worked'
,
'buildout.cfg'
,
'etc'
])
[
'.0_daemon.log'
,
'worked'
,
'buildout.cfg'
,
'etc'
])
tries
=
1
0
tries
=
5
0
daemon_log
=
os
.
path
.
join
(
partition
.
partition_path
,
'.0_daemon.log'
)
daemon_log
=
os
.
path
.
join
(
partition
.
partition_path
,
'.0_daemon.log'
)
while
tries
>
0
:
while
tries
>
0
:
tries
-=
1
tries
-=
1
if
os
.
path
.
getsize
(
daemon_log
)
>
0
:
if
os
.
path
.
getsize
(
daemon_log
)
>
0
:
break
break
time
.
sleep
(
0.
2
)
time
.
sleep
(
0.
1
)
self
.
assertTrue
(
'Failing'
in
open
(
daemon_log
,
'r'
).
read
())
self
.
assertTrue
(
'Failing'
in
open
(
daemon_log
,
'r'
).
read
())
tries
=
25
tries
=
25
while
tries
>
0
:
while
tries
>
0
:
tries
-=
1
tries
-=
1
if
os
.
path
.
exists
(
watchdog_banged
):
if
os
.
path
.
exists
(
watchdog_banged
):
break
break
time
.
sleep
(
0.
2
)
time
.
sleep
(
0.
1
)
self
.
assertTrue
(
os
.
path
.
exists
(
watchdog_banged
))
self
.
assertTrue
(
os
.
path
.
exists
(
watchdog_banged
))
self
.
assertTrue
(
'daemon'
in
open
(
watchdog_banged
,
'r'
).
read
())
self
.
assertTrue
(
'daemon'
in
open
(
watchdog_banged
,
'r'
).
read
())
...
@@ -737,20 +737,20 @@ touch worked
...
@@ -737,20 +737,20 @@ touch worked
'var'
])
'var'
])
self
.
assertSortedListEqual
(
os
.
listdir
(
partition
.
partition_path
),
self
.
assertSortedListEqual
(
os
.
listdir
(
partition
.
partition_path
),
[
'.0_daemon.log'
,
'worked'
,
'buildout.cfg'
,
'etc'
])
[
'.0_daemon.log'
,
'worked'
,
'buildout.cfg'
,
'etc'
])
tries
=
1
0
tries
=
5
0
daemon_log
=
os
.
path
.
join
(
partition
.
partition_path
,
'.0_daemon.log'
)
daemon_log
=
os
.
path
.
join
(
partition
.
partition_path
,
'.0_daemon.log'
)
while
tries
>
0
:
while
tries
>
0
:
tries
-=
1
tries
-=
1
if
os
.
path
.
getsize
(
daemon_log
)
>
0
:
if
os
.
path
.
getsize
(
daemon_log
)
>
0
:
break
break
time
.
sleep
(
0.
2
)
time
.
sleep
(
0.
1
)
self
.
assertTrue
(
'Failing'
in
open
(
daemon_log
,
'r'
).
read
())
self
.
assertTrue
(
'Failing'
in
open
(
daemon_log
,
'r'
).
read
())
tries
=
25
tries
=
25
while
tries
>
0
:
while
tries
>
0
:
tries
-=
1
tries
-=
1
if
os
.
path
.
exists
(
watchdog_banged
):
if
os
.
path
.
exists
(
watchdog_banged
):
break
break
time
.
sleep
(
0.
2
)
time
.
sleep
(
0.
1
)
self
.
assertFalse
(
os
.
path
.
exists
(
watchdog_banged
))
self
.
assertFalse
(
os
.
path
.
exists
(
watchdog_banged
))
...
@@ -1111,13 +1111,13 @@ class TestSlapgridUsageReport(MasterMixin, unittest.TestCase):
...
@@ -1111,13 +1111,13 @@ class TestSlapgridUsageReport(MasterMixin, unittest.TestCase):
'var'
])
'var'
])
self
.
assertSortedListEqual
(
os
.
listdir
(
instance
.
partition_path
),
[
'.0_wrapper.log'
,
self
.
assertSortedListEqual
(
os
.
listdir
(
instance
.
partition_path
),
[
'.0_wrapper.log'
,
'worked'
,
'buildout.cfg'
,
'etc'
])
'worked'
,
'buildout.cfg'
,
'etc'
])
tries
=
1
0
tries
=
5
0
wrapper_log
=
os
.
path
.
join
(
instance
.
partition_path
,
'.0_wrapper.log'
)
wrapper_log
=
os
.
path
.
join
(
instance
.
partition_path
,
'.0_wrapper.log'
)
while
tries
>
0
:
while
tries
>
0
:
tries
-=
1
tries
-=
1
if
os
.
path
.
getsize
(
wrapper_log
)
>
0
:
if
os
.
path
.
getsize
(
wrapper_log
)
>
0
:
break
break
time
.
sleep
(
0.
2
)
time
.
sleep
(
0.
1
)
self
.
assertTrue
(
'Working'
in
open
(
wrapper_log
,
'r'
).
read
())
self
.
assertTrue
(
'Working'
in
open
(
wrapper_log
,
'r'
).
read
())
self
.
assertSortedListEqual
(
os
.
listdir
(
self
.
software_root
),
self
.
assertSortedListEqual
(
os
.
listdir
(
self
.
software_root
),
[
instance
.
software
.
software_hash
])
[
instance
.
software
.
software_hash
])
...
@@ -1138,7 +1138,7 @@ class TestSlapgridUsageReport(MasterMixin, unittest.TestCase):
...
@@ -1138,7 +1138,7 @@ class TestSlapgridUsageReport(MasterMixin, unittest.TestCase):
self
.
assertSortedListEqual
(
os
.
listdir
(
self
.
software_root
),
self
.
assertSortedListEqual
(
os
.
listdir
(
self
.
software_root
),
[
instance
.
software
.
software_hash
])
[
instance
.
software
.
software_hash
])
# Assert supervisor stopped process
# Assert supervisor stopped process
tries
=
1
0
tries
=
5
0
wrapper_log
=
os
.
path
.
join
(
instance
.
partition_path
,
'.0_wrapper.log'
)
wrapper_log
=
os
.
path
.
join
(
instance
.
partition_path
,
'.0_wrapper.log'
)
exists
=
False
exists
=
False
while
tries
>
0
:
while
tries
>
0
:
...
@@ -1146,7 +1146,7 @@ class TestSlapgridUsageReport(MasterMixin, unittest.TestCase):
...
@@ -1146,7 +1146,7 @@ class TestSlapgridUsageReport(MasterMixin, unittest.TestCase):
if
os
.
path
.
exists
(
wrapper_log
):
if
os
.
path
.
exists
(
wrapper_log
):
exists
=
True
exists
=
True
break
break
time
.
sleep
(
0.
2
)
time
.
sleep
(
0.
1
)
self
.
assertFalse
(
exists
)
self
.
assertFalse
(
exists
)
self
.
assertEqual
(
computer
.
sequence
,
self
.
assertEqual
(
computer
.
sequence
,
...
@@ -1174,7 +1174,7 @@ class TestSlapgridUsageReport(MasterMixin, unittest.TestCase):
...
@@ -1174,7 +1174,7 @@ class TestSlapgridUsageReport(MasterMixin, unittest.TestCase):
tries
-=
1
tries
-=
1
if
os
.
path
.
getsize
(
wrapper_log
)
>
0
:
if
os
.
path
.
getsize
(
wrapper_log
)
>
0
:
break
break
time
.
sleep
(
0.
2
)
time
.
sleep
(
0.
1
)
self
.
assertTrue
(
'Working'
in
open
(
wrapper_log
,
'r'
).
read
())
self
.
assertTrue
(
'Working'
in
open
(
wrapper_log
,
'r'
).
read
())
self
.
assertSortedListEqual
(
os
.
listdir
(
self
.
software_root
),
self
.
assertSortedListEqual
(
os
.
listdir
(
self
.
software_root
),
[
instance
.
software
.
software_hash
])
[
instance
.
software
.
software_hash
])
...
@@ -1192,13 +1192,13 @@ class TestSlapgridUsageReport(MasterMixin, unittest.TestCase):
...
@@ -1192,13 +1192,13 @@ class TestSlapgridUsageReport(MasterMixin, unittest.TestCase):
self
.
assertSortedListEqual
(
self
.
assertSortedListEqual
(
os
.
listdir
(
instance
.
partition_path
),
os
.
listdir
(
instance
.
partition_path
),
[
'.0_wrapper.log'
,
'worked'
,
'buildout.cfg'
,
'etc'
])
[
'.0_wrapper.log'
,
'worked'
,
'buildout.cfg'
,
'etc'
])
tries
=
1
0
tries
=
5
0
wrapper_log
=
os
.
path
.
join
(
instance
.
partition_path
,
'.0_wrapper.log'
)
wrapper_log
=
os
.
path
.
join
(
instance
.
partition_path
,
'.0_wrapper.log'
)
while
tries
>
0
:
while
tries
>
0
:
tries
-=
1
tries
-=
1
if
os
.
path
.
getsize
(
wrapper_log
)
>
0
:
if
os
.
path
.
getsize
(
wrapper_log
)
>
0
:
break
break
time
.
sleep
(
0.
2
)
time
.
sleep
(
0.
1
)
self
.
assertTrue
(
'Working'
in
open
(
wrapper_log
,
'r'
).
read
())
self
.
assertTrue
(
'Working'
in
open
(
wrapper_log
,
'r'
).
read
())
self
.
assertSortedListEqual
(
os
.
listdir
(
self
.
instance_root
),
[
'0'
,
'etc'
,
self
.
assertSortedListEqual
(
os
.
listdir
(
self
.
instance_root
),
[
'0'
,
'etc'
,
'var'
])
'var'
])
...
@@ -1210,7 +1210,7 @@ class TestSlapgridUsageReport(MasterMixin, unittest.TestCase):
...
@@ -1210,7 +1210,7 @@ class TestSlapgridUsageReport(MasterMixin, unittest.TestCase):
tries
-=
1
tries
-=
1
if
os
.
path
.
getsize
(
wrapper_log
)
>
0
:
if
os
.
path
.
getsize
(
wrapper_log
)
>
0
:
break
break
time
.
sleep
(
0.
2
)
time
.
sleep
(
0.
1
)
self
.
assertEqual
(
computer
.
sequence
,
self
.
assertEqual
(
computer
.
sequence
,
[
'getFullComputerInformation'
])
[
'getFullComputerInformation'
])
self
.
assertEqual
(
'started'
,
instance
.
state
)
self
.
assertEqual
(
'started'
,
instance
.
state
)
...
@@ -1522,7 +1522,7 @@ exit 127""" % {'worked_file': worked_file})
...
@@ -1522,7 +1522,7 @@ exit 127""" % {'worked_file': worked_file})
computer
=
ComputerForTest
(
self
.
software_root
,
self
.
instance_root
)
computer
=
ComputerForTest
(
self
.
software_root
,
self
.
instance_root
)
instance
=
computer
.
instance_list
[
0
]
instance
=
computer
.
instance_list
[
0
]
instance
.
requested_state
=
'started'
instance
.
requested_state
=
'started'
self
.
fake_waiting_time
=
0.
2
self
.
fake_waiting_time
=
0.
1
worked_file
=
os
.
path
.
join
(
instance
.
partition_path
,
'succeed_worked'
)
worked_file
=
os
.
path
.
join
(
instance
.
partition_path
,
'succeed_worked'
)
succeed
=
(
"""#!/usr/bin/env sh
succeed
=
(
"""#!/usr/bin/env sh
touch "%(worked_file)s"
touch "%(worked_file)s"
...
@@ -1565,7 +1565,7 @@ exit 127""" % {'worked_file': worked_file})
...
@@ -1565,7 +1565,7 @@ exit 127""" % {'worked_file': worked_file})
instance
=
computer
.
instance_list
[
0
]
instance
=
computer
.
instance_list
[
0
]
instance
.
requested_state
=
'started'
instance
.
requested_state
=
'started'
self
.
fake_waiting_time
=
0.
2
self
.
fake_waiting_time
=
0.
1
promise_path
=
os
.
path
.
join
(
instance
.
partition_path
,
'etc'
,
'promise'
)
promise_path
=
os
.
path
.
join
(
instance
.
partition_path
,
'etc'
,
'promise'
)
os
.
makedirs
(
promise_path
)
os
.
makedirs
(
promise_path
)
...
@@ -1588,7 +1588,7 @@ exit 0""" % {'worked_file': worked_file})
...
@@ -1588,7 +1588,7 @@ exit 0""" % {'worked_file': worked_file})
instance
=
computer
.
instance_list
[
0
]
instance
=
computer
.
instance_list
[
0
]
instance
.
requested_state
=
'started'
instance
.
requested_state
=
'started'
self
.
fake_waiting_time
=
0.
2
self
.
fake_waiting_time
=
0.
1
for
i
in
range
(
0
,
2
):
for
i
in
range
(
0
,
2
):
worked_file
=
os
.
path
.
join
(
instance
.
partition_path
,
'succeed_%s_worked'
%
i
)
worked_file
=
os
.
path
.
join
(
instance
.
partition_path
,
'succeed_%s_worked'
%
i
)
...
@@ -1608,7 +1608,7 @@ exit 0""" % {'worked_file': worked_file})
...
@@ -1608,7 +1608,7 @@ exit 0""" % {'worked_file': worked_file})
computer
=
ComputerForTest
(
self
.
software_root
,
self
.
instance_root
)
computer
=
ComputerForTest
(
self
.
software_root
,
self
.
instance_root
)
instance
=
computer
.
instance_list
[
0
]
instance
=
computer
.
instance_list
[
0
]
instance
.
requested_state
=
'started'
instance
.
requested_state
=
'started'
self
.
fake_waiting_time
=
0.
2
self
.
fake_waiting_time
=
0.
1
for
i
in
range
(
2
):
for
i
in
range
(
2
):
worked_file
=
os
.
path
.
join
(
instance
.
partition_path
,
'promise_worked_%d'
%
i
)
worked_file
=
os
.
path
.
join
(
instance
.
partition_path
,
'promise_worked_%d'
%
i
)
...
@@ -1631,7 +1631,7 @@ fi""" % {'worked_file': worked_file, 'lockfile': lockfile})
...
@@ -1631,7 +1631,7 @@ fi""" % {'worked_file': worked_file, 'lockfile': lockfile})
computer
=
ComputerForTest
(
self
.
software_root
,
self
.
instance_root
)
computer
=
ComputerForTest
(
self
.
software_root
,
self
.
instance_root
)
instance
=
computer
.
instance_list
[
0
]
instance
=
computer
.
instance_list
[
0
]
instance
.
requested_state
=
'started'
instance
.
requested_state
=
'started'
self
.
fake_waiting_time
=
0.
2
self
.
fake_waiting_time
=
0.
1
for
i
in
range
(
2
):
for
i
in
range
(
2
):
worked_file
=
os
.
path
.
join
(
instance
.
partition_path
,
'promise_worked_%d'
%
i
)
worked_file
=
os
.
path
.
join
(
instance
.
partition_path
,
'promise_worked_%d'
%
i
)
lockfile
=
os
.
path
.
join
(
instance
.
partition_path
,
'lock'
)
lockfile
=
os
.
path
.
join
(
instance
.
partition_path
,
'lock'
)
...
...
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