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
22
Merge Requests
22
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
slapos.core
Commits
7bcfc6fe
Commit
7bcfc6fe
authored
Dec 12, 2018
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tests: make each test use a different partition_id
This can hide problems when tests are not isolated correctly.
parent
6d95ac41
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
13 deletions
+13
-13
slapos/tests/cli.py
slapos/tests/cli.py
+1
-1
slapos/tests/slap.py
slapos/tests/slap.py
+12
-12
No files found.
slapos/tests/cli.py
View file @
7bcfc6fe
...
...
@@ -332,7 +332,7 @@ print(request('software_release', 'instance').getInstanceParameterDict()['parame
@
contextmanager
def
_test_console
(
self
):
cp
=
slapos
.
slap
.
ComputerPartition
(
'computer_
id'
,
'partition_id'
)
cp
=
slapos
.
slap
.
ComputerPartition
(
'computer_
%s'
%
self
.
id
(),
'partition_%s'
%
self
.
id
()
)
cp
.
_parameter_dict
=
{
'parameter_name'
:
'parameter_value'
}
with
patch
.
object
(
slapos
.
slap
.
OpenOrder
,
'request'
,
return_value
=
cp
)
as
mock_request
,
\
...
...
slapos/tests/slap.py
View file @
7bcfc6fe
...
...
@@ -55,7 +55,7 @@ class SlapMixin(unittest.TestCase):
self
.
server_url
=
self
.
_server_url
print
(
'Testing against SLAP server %r'
%
self
.
server_url
)
self
.
slap
=
slapos
.
slap
.
slap
()
self
.
partition_id
=
'PARTITION_01'
self
.
partition_id
=
self
.
id
()
os
.
environ
.
pop
(
'SLAPGRID_INSTANCE_ROOT'
,
None
)
def
tearDown
(
self
):
...
...
@@ -224,7 +224,7 @@ class TestSlap(SlapMixin):
"""
computer_guid
=
self
.
_getTestComputerId
()
self
.
slap
.
initializeConnection
(
self
.
server_url
)
partition_id
=
'PARTITION_01'
partition_id
=
self
.
id
()
def
handler
(
url
,
req
):
qs
=
parse
.
parse_qs
(
url
.
query
)
...
...
@@ -645,7 +645,7 @@ class TestComputerPartition(SlapMixin):
'software_type'
,
'myref'
)
def
test_request_not_raises
(
self
):
partition_id
=
'PARTITION_01'
partition_id
=
self
.
id
()
def
handler
(
url
,
req
):
qs
=
parse
.
parse_qs
(
url
.
query
)
...
...
@@ -689,7 +689,7 @@ class TestComputerPartition(SlapMixin):
self
.
assertIsInstance
(
requested_partition
,
slapos
.
slap
.
ComputerPartition
)
def
test_request_raises_later
(
self
):
partition_id
=
'PARTITION_01'
partition_id
=
self
.
id
()
def
handler
(
url
,
req
):
qs
=
parse
.
parse_qs
(
url
.
query
)
...
...
@@ -736,8 +736,8 @@ class TestComputerPartition(SlapMixin):
requested_partition
.
getId
)
def
test_request_fullfilled_work
(
self
):
partition_id
=
'PARTITION_01
'
requested_partition_id
=
'PARTITION_02
'
partition_id
=
'PARTITION_01
-%s'
%
self
.
id
()
requested_partition_id
=
'PARTITION_02
-%s'
%
self
.
id
()
computer_guid
=
self
.
_getTestComputerId
()
def
handler
(
url
,
req
):
...
...
@@ -793,7 +793,7 @@ class TestComputerPartition(SlapMixin):
def
test_request_with_slapgrid_request_transaction
(
self
):
from
slapos.slap.slap
import
COMPUTER_PARTITION_REQUEST_LIST_TEMPLATE_FILENAME
partition_id
=
'PARTITION_01'
partition_id
=
self
.
id
()
instance_root
=
tempfile
.
mkdtemp
()
partition_root
=
os
.
path
.
join
(
instance_root
,
partition_id
)
os
.
mkdir
(
partition_root
)
...
...
@@ -875,7 +875,7 @@ class TestComputerPartition(SlapMixin):
Partition
"""
computer_guid
=
self
.
_getTestComputerId
()
partition_id
=
'PARTITION_01'
partition_id
=
self
.
id
()
slap
=
self
.
slap
slap
.
initializeConnection
(
self
.
server_url
)
...
...
@@ -919,7 +919,7 @@ class TestComputerPartition(SlapMixin):
Asserts that calling ComputerPartition.error on new partition works
"""
computer_guid
=
self
.
_getTestComputerId
()
partition_id
=
'PARTITION_01'
partition_id
=
self
.
id
()
slap
=
self
.
slap
slap
.
initializeConnection
(
self
.
server_url
)
...
...
@@ -1071,7 +1071,7 @@ class TestOpenOrder(SlapMixin):
# XXX: Interface lack registerOpenOrder method declaration
open_order
=
self
.
slap
.
registerOpenOrder
()
computer_guid
=
self
.
_getTestComputerId
()
requested_partition_id
=
'PARTITION_01'
requested_partition_id
=
self
.
id
()
def
handler
(
url
,
req
):
from
slapos.slap.slap
import
SoftwareInstance
...
...
@@ -1097,7 +1097,7 @@ class TestOpenOrder(SlapMixin):
# XXX: Interface lack registerOpenOrder method declaration
open_order
=
self
.
slap
.
registerOpenOrder
()
computer_guid
=
self
.
_getTestComputerId
()
requested_partition_id
=
'PARTITION_01'
requested_partition_id
=
self
.
id
()
def
handler
(
url
,
req
):
from
slapos.slap.slap
import
SoftwareInstance
...
...
@@ -1127,7 +1127,7 @@ class TestOpenOrder(SlapMixin):
# XXX: Interface lack registerOpenOrder method declaration
open_order
=
self
.
slap
.
registerOpenOrder
()
computer_guid
=
self
.
_getTestComputerId
()
requested_partition_id
=
'PARTITION_01'
requested_partition_id
=
self
.
id
()
def
handler
(
url
,
req
):
from
slapos.slap.slap
import
SoftwareInstance
...
...
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