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
Klaus Wölfel
slapos.core
Commits
27edd2d4
Commit
27edd2d4
authored
Jan 08, 2013
by
Marco Mariani
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updated tests
parent
71224c30
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
89 additions
and
80 deletions
+89
-80
setup.py
setup.py
+1
-0
slapos/grid/SlapObject.py
slapos/grid/SlapObject.py
+6
-0
slapos/grid/zc.buildout-bootstap.py
slapos/grid/zc.buildout-bootstap.py
+1
-2
slapos/proxy/views.py
slapos/proxy/views.py
+3
-9
slapos/tests/pyflakes/__init__.py
slapos/tests/pyflakes/__init__.py
+12
-3
slapos/tests/slapgrid.py
slapos/tests/slapgrid.py
+58
-59
slapos/tests/slapproxy.py
slapos/tests/slapproxy.py
+8
-7
No files found.
setup.py
View file @
27edd2d4
...
...
@@ -39,6 +39,7 @@ setup(name=name,
'pyflakes'
,
# For testing purposes
'setuptools'
,
# namespaces
'supervisor'
,
# slapgrid uses supervisor to manage processes
'unittest2'
,
'xml_marshaller>=0.9.3'
,
# to unmarshall/marshall python objects to/from
# XML
'zope.interface'
,
# slap library implementes interfaces
...
...
slapos/grid/SlapObject.py
View file @
27edd2d4
...
...
@@ -508,6 +508,12 @@ class Partition(object):
if
f
:
if
os
.
path
.
exists
(
f
):
os
.
unlink
(
f
)
# better to manually remove symlinks because rmtree might choke on them
sr_symlink
=
os
.
path
.
join
(
self
.
instance_path
,
'software_release'
)
if
os
.
path
.
islink
(
sr_symlink
):
os
.
unlink
(
sr_symlink
)
for
root
,
dirs
,
file_list
in
os
.
walk
(
self
.
instance_path
):
for
directory
in
dirs
:
shutil
.
rmtree
(
os
.
path
.
join
(
self
.
instance_path
,
directory
))
...
...
slapos/grid/zc.buildout-bootstap.py
View file @
27edd2d4
...
...
@@ -18,7 +18,7 @@ The script accepts buildout command-line options, so you can
use the -c option to specify an alternate configuration file.
"""
import
os
,
shutil
,
sys
,
tempfile
,
textwrap
,
urllib
,
urllib2
,
subprocess
import
os
,
shutil
,
sys
,
tempfile
,
urllib
,
urllib2
,
subprocess
from
optparse
import
OptionParser
if
sys
.
platform
==
'win32'
:
...
...
@@ -57,7 +57,6 @@ if not has_broken_dash_S and 'site' in sys.modules:
# out any namespace packages from site-packages that might have been
# loaded by .pth files.
clean_path
=
sys
.
path
[:]
import
site
sys
.
path
[:]
=
clean_path
for
k
,
v
in
sys
.
modules
.
items
():
if
k
in
(
'setuptools'
,
'pkg_resources'
)
or
(
...
...
slapos/proxy/views.py
View file @
27edd2d4
...
...
@@ -303,13 +303,6 @@ def request_not_shared():
q
=
'SELECT * FROM %s WHERE partition_reference=?'
a
(
partition_reference
)
#
# XXX the following filter breaks renaming asked by the bully script
#
# if partition_id:
# q += ' AND requested_by=?'
# a(partition_id)
partition
=
execute_db
(
'partition'
,
q
,
args
,
one
=
True
)
args
=
[]
...
...
@@ -392,7 +385,7 @@ def request_slave():
partition_id
=
request
.
form
.
get
(
'computer_partition_id'
,
''
).
encode
()
# Contain slave parameters to be given to slave master
partition_parameter_kw
=
request
.
form
.
get
(
'partition_parameter_xml'
,
None
)
if
partition_parameter_kw
:
if
partition_parameter_kw
:
partition_parameter_kw
=
xml_marshaller
.
xml_marshaller
.
loads
(
partition_parameter_kw
.
encode
())
else
:
...
...
@@ -419,7 +412,7 @@ def request_slave():
args
)
abort
(
404
)
# We set slave diction
n
ary as described in docstring
# We set slave dictionary as described in docstring
new_slave
=
{}
slave_reference
=
partition_id
+
'_'
+
partition_reference
new_slave
[
'slave_title'
]
=
slave_reference
...
...
@@ -481,3 +474,4 @@ def request_slave():
slap_software_type
=
partition
[
'software_type'
],
ip_list
=
address_list
))
slapos/tests/pyflakes/__init__.py
View file @
27edd2d4
...
...
@@ -29,9 +29,9 @@ import os
import
pkg_resources
import
pyflakes.scripts.pyflakes
import
sys
import
unittest
import
unittest
2
class
CheckCodeConsistency
(
unittest
.
TestCase
):
class
CheckCodeConsistency
(
unittest
2
.
TestCase
):
"""Lints all SlapOS Node and SLAP library code base."""
def
setUp
(
self
):
self
.
_original_argv
=
sys
.
argv
...
...
@@ -45,5 +45,14 @@ class CheckCodeConsistency(unittest.TestCase):
def
tearDown
(
self
):
sys
.
argv
=
self
.
_original_argv
@
unittest2
.
skip
(
'pyflakes test is disabled'
)
def
testCodeConsistency
(
self
):
pyflakes
.
scripts
.
pyflakes
.
main
()
if
pyflakes
.
scripts
.
pyflakes
.
main
.
func_code
.
co_argcount
:
pyflakes
.
scripts
.
pyflakes
.
main
([
os
.
path
.
join
(
pkg_resources
.
get_distribution
(
'slapos.core'
).
location
,
'slapos'
,
)])
else
:
pyflakes
.
scripts
.
pyflakes
.
main
()
slapos/tests/slapgrid.py
View file @
27edd2d4
This diff is collapsed.
Click to expand it.
slapos/tests/slapproxy.py
View file @
27edd2d4
...
...
@@ -256,15 +256,16 @@ class TestRequest (MasterMixin, unittest.TestCase):
"""
def
test_two_request_one_partition_free
(
self
):
"""
If only one partition is available and two different request are made
first will succeed second will fail
Since slapproxy does not implement scope, providing two partition_id
values will still succeed, even if only one partition is available.
"""
self
.
add_free_partition
(
1
)
self
.
assertIsInstance
(
self
.
request
(
'http://sr//'
,
None
,
'Maria'
,
'slappart2'
),
slapos
.
slap
.
ComputerPartition
)
with
self
.
assertRaises
(
WrongFormat
):
self
.
request
(
'http://sr//'
,
None
,
'Maria'
,
'slappart3'
)
self
.
assertIsInstance
(
self
.
request
(
'http://sr//'
,
None
,
'Maria'
,
'slappart3'
),
slapos
.
slap
.
ComputerPartition
)
def
test_two_request_two_partition_free
(
self
):
"""
...
...
@@ -327,11 +328,11 @@ class TestRequest (MasterMixin, unittest.TestCase):
def
test_two_different_request_from_two_partition
(
self
):
"""
Two request from different partitions
will return two differents partitions
Since slapproxy does not implement scope, two request with
different partition_id will still return the same partition.
"""
self
.
add_free_partition
(
2
)
self
.
assert
Not
Equal
(
self
.
assertEqual
(
self
.
request
(
'http://sr//'
,
None
,
'Maria'
,
'slappart2'
).
__dict__
,
self
.
request
(
'http://sr//'
,
None
,
'Maria'
,
'slappart3'
).
__dict__
)
...
...
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