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
Labels
Merge Requests
18
Merge Requests
18
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
nexedi
slapos.core
Commits
9bedce75
Commit
9bedce75
authored
Sep 13, 2012
by
Cédric de Saint Martin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove trailing whitespaces
parent
416e25a9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
14 deletions
+14
-14
slapos/tests/slapgrid.py
slapos/tests/slapgrid.py
+14
-14
No files found.
slapos/tests/slapgrid.py
View file @
9bedce75
...
@@ -37,7 +37,7 @@ class BasicMixin:
...
@@ -37,7 +37,7 @@ class BasicMixin:
self
.
master_url
,
self
.
computer_id
,
self
.
supervisord_socket
,
self
.
master_url
,
self
.
computer_id
,
self
.
supervisord_socket
,
self
.
supervisord_configuration_path
,
self
.
usage_report_periodicity
,
self
.
supervisord_configuration_path
,
self
.
usage_report_periodicity
,
self
.
buildout
,
develop
=
develop
)
self
.
buildout
,
develop
=
develop
)
def
tearDown
(
self
):
def
tearDown
(
self
):
# XXX: Hardcoded pid, as it is not configurable in slapos
# XXX: Hardcoded pid, as it is not configurable in slapos
svc
=
os
.
path
.
join
(
self
.
instance_root
,
'var'
,
'run'
,
'supervisord.pid'
)
svc
=
os
.
path
.
join
(
self
.
instance_root
,
'var'
,
'run'
,
'supervisord.pid'
)
...
@@ -134,7 +134,7 @@ touch worked""")
...
@@ -134,7 +134,7 @@ touch worked""")
def
_server_response
(
self_test
,
_requested_state
,
timestamp
=
None
):
def
_server_response
(
self_test
,
_requested_state
,
timestamp
=
None
):
def
server_response
(
self_httplib
,
path
,
method
,
body
,
header
):
def
server_response
(
self_httplib
,
path
,
method
,
body
,
header
):
parsed_url
=
urlparse
.
urlparse
(
path
.
lstrip
(
'/'
))
parsed_url
=
urlparse
.
urlparse
(
path
.
lstrip
(
'/'
))
self_test
.
sequence
.
append
(
parsed_url
.
path
)
self_test
.
sequence
.
append
(
parsed_url
.
path
)
if
method
==
'GET'
:
if
method
==
'GET'
:
parsed_qs
=
urlparse
.
parse_qs
(
parsed_url
.
query
)
parsed_qs
=
urlparse
.
parse_qs
(
parsed_url
.
query
)
else
:
else
:
...
@@ -150,7 +150,7 @@ def _server_response (self_test,_requested_state,timestamp=None):
...
@@ -150,7 +150,7 @@ def _server_response (self_test,_requested_state,timestamp=None):
partition
.
_software_release_document
=
sr
partition
.
_software_release_document
=
sr
partition
.
_requested_state
=
_requested_state
partition
.
_requested_state
=
_requested_state
if
not
timestamp
==
None
:
if
not
timestamp
==
None
:
partition
.
_parameter_dict
=
{
'timestamp'
:
timestamp
}
partition
.
_parameter_dict
=
{
'timestamp'
:
timestamp
}
slap_computer
.
_computer_partition_list
=
[
partition
]
slap_computer
.
_computer_partition_list
=
[
partition
]
return
(
200
,
{},
xml_marshaller
.
xml_marshaller
.
dumps
(
slap_computer
))
return
(
200
,
{},
xml_marshaller
.
xml_marshaller
.
dumps
(
slap_computer
))
if
parsed_url
.
path
==
'availableComputerPartition'
and
\
if
parsed_url
.
path
==
'availableComputerPartition'
and
\
...
@@ -173,7 +173,7 @@ def _server_response (self_test,_requested_state,timestamp=None):
...
@@ -173,7 +173,7 @@ def _server_response (self_test,_requested_state,timestamp=None):
return
(
200
,
{},
''
)
return
(
200
,
{},
''
)
else
:
else
:
return
(
404
,
{},
''
)
return
(
404
,
{},
''
)
return
server_response
return
server_response
...
@@ -457,16 +457,16 @@ touch worked""")
...
@@ -457,16 +457,16 @@ touch worked""")
self
.
assertSortedListEqual
(
os
.
listdir
(
partition
),
[
'.timestamp'
,
'worked'
,
self
.
assertSortedListEqual
(
os
.
listdir
(
partition
),
[
'.timestamp'
,
'worked'
,
'buildout.cfg'
])
'buildout.cfg'
])
self
.
assertSortedListEqual
(
os
.
listdir
(
self
.
software_root
),
self
.
assertSortedListEqual
(
os
.
listdir
(
self
.
software_root
),
[
software_hash
])
[
software_hash
])
timestamp_path
=
os
.
path
.
join
(
partition_path
,
'.timestamp'
)
timestamp_path
=
os
.
path
.
join
(
partition_path
,
'.timestamp'
)
self
.
setSlapgrid
()
self
.
setSlapgrid
()
self
.
assertTrue
(
self
.
grid
.
processComputerPartitionList
())
self
.
assertTrue
(
self
.
grid
.
processComputerPartitionList
())
self
.
assertTrue
(
self
.
timestamp
in
open
(
timestamp_path
,
'r'
).
read
())
self
.
assertTrue
(
self
.
timestamp
in
open
(
timestamp_path
,
'r'
).
read
())
self
.
assertEqual
(
self
.
sequence
,
self
.
assertEqual
(
self
.
sequence
,
[
'getFullComputerInformation'
,
'availableComputerPartition'
,
[
'getFullComputerInformation'
,
'availableComputerPartition'
,
'stoppedComputerPartition'
,
'getFullComputerInformation'
])
'stoppedComputerPartition'
,
'getFullComputerInformation'
])
def
test_partition_timestamp_develop
(
self
):
def
test_partition_timestamp_develop
(
self
):
...
@@ -549,7 +549,7 @@ touch worked""")
...
@@ -549,7 +549,7 @@ touch worked""")
self
.
assertEqual
(
self
.
sequence
,
self
.
assertEqual
(
self
.
sequence
,
[
'getFullComputerInformation'
,
'availableComputerPartition'
,
[
'getFullComputerInformation'
,
'availableComputerPartition'
,
'stoppedComputerPartition'
,
'getFullComputerInformation'
])
'stoppedComputerPartition'
,
'getFullComputerInformation'
])
def
test_partition_timestamp_new_timestamp
(
self
):
def
test_partition_timestamp_new_timestamp
(
self
):
...
@@ -585,9 +585,9 @@ touch worked""")
...
@@ -585,9 +585,9 @@ touch worked""")
httplib
.
HTTPConnection
.
_callback
=
_server_response
(
self
,
httplib
.
HTTPConnection
.
_callback
=
_server_response
(
self
,
'stopped'
,
'stopped'
,
str
(
int
(
self
.
timestamp
)
+
1
))
str
(
int
(
self
.
timestamp
)
+
1
))
self
.
setSlapgrid
()
self
.
setSlapgrid
()
self
.
assertTrue
(
self
.
grid
.
processComputerPartitionList
())
self
.
assertTrue
(
self
.
grid
.
processComputerPartitionList
())
self
.
setSlapgrid
()
self
.
setSlapgrid
()
self
.
assertTrue
(
self
.
grid
.
processComputerPartitionList
())
self
.
assertTrue
(
self
.
grid
.
processComputerPartitionList
())
self
.
assertEqual
(
self
.
sequence
,
self
.
assertEqual
(
self
.
sequence
,
[
'getFullComputerInformation'
,
'availableComputerPartition'
,
[
'getFullComputerInformation'
,
'availableComputerPartition'
,
...
@@ -627,7 +627,7 @@ touch worked""")
...
@@ -627,7 +627,7 @@ touch worked""")
[
software_hash
])
[
software_hash
])
httplib
.
HTTPConnection
.
_callback
=
_server_response
(
self
,
httplib
.
HTTPConnection
.
_callback
=
_server_response
(
self
,
'stopped'
)
'stopped'
)
self
.
setSlapgrid
()
self
.
setSlapgrid
()
self
.
assertTrue
(
self
.
grid
.
processComputerPartitionList
())
self
.
assertTrue
(
self
.
grid
.
processComputerPartitionList
())
self
.
assertEqual
(
self
.
sequence
,
self
.
assertEqual
(
self
.
sequence
,
[
'getFullComputerInformation'
,
'availableComputerPartition'
,
[
'getFullComputerInformation'
,
'availableComputerPartition'
,
...
@@ -1177,10 +1177,10 @@ fi""" % {'worked_file': worked_file, 'lockfile': lockfile})
...
@@ -1177,10 +1177,10 @@ fi""" % {'worked_file': worked_file, 'lockfile': lockfile})
with
open
(
promise
,
'w'
)
as
f
:
with
open
(
promise
,
'w'
)
as
f
:
f
.
write
(
"""#!/usr/bin/env sh
f
.
write
(
"""#!/usr/bin/env sh
touch "%(worked_file)s"
touch "%(worked_file)s"
if [ ! -f %(lockfile)s ]
if [ ! -f %(lockfile)s ]
then
then
touch "%(lockfile)s"
touch "%(lockfile)s"
else
else
sleep 5
sleep 5
fi
fi
exit 0"""
%
{
'worked_file'
:
worked_file
,
'lockfile'
:
lockfile
})
exit 0"""
%
{
'worked_file'
:
worked_file
,
'lockfile'
:
lockfile
})
...
...
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