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
Boxiang Sun
slapos.core
Commits
7f45fa10
Commit
7f45fa10
authored
Feb 16, 2022
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tests: fix some trailing whitespaces and inconsistent indentations
parent
55ff948c
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
79 additions
and
86 deletions
+79
-86
slapos/tests/test_configure_local.py
slapos/tests/test_configure_local.py
+1
-1
slapos/tests/test_promise.py
slapos/tests/test_promise.py
+4
-5
slapos/tests/test_register.py
slapos/tests/test_register.py
+4
-9
slapos/tests/test_slap.py
slapos/tests/test_slap.py
+1
-2
slapos/tests/test_slapformat.py
slapos/tests/test_slapformat.py
+1
-1
slapos/tests/test_slapgrid.py
slapos/tests/test_slapgrid.py
+40
-40
slapos/tests/test_slapproxy.py
slapos/tests/test_slapproxy.py
+28
-28
No files found.
slapos/tests/test_configure_local.py
View file @
7f45fa10
slapos/tests/test_promise.py
View file @
7f45fa10
...
@@ -2021,4 +2021,3 @@ class RunPromise(GenericPromise):
...
@@ -2021,4 +2021,3 @@ class RunPromise(GenericPromise):
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
unittest
.
main
()
unittest
.
main
()
slapos/tests/test_register.py
View file @
7f45fa10
...
@@ -50,8 +50,3 @@ class TestRegister(unittest.TestCase):
...
@@ -50,8 +50,3 @@ class TestRegister(unittest.TestCase):
'partition_amount'
,
'partition_amount'
,
'create_tap'
]:
'create_tap'
]:
self
.
assertTrue
(
entry
in
template
,
"%s is not in template (%s)"
%
(
entry
,
template
))
self
.
assertTrue
(
entry
in
template
,
"%s is not in template (%s)"
%
(
entry
,
template
))
slapos/tests/test_slap.py
View file @
7f45fa10
...
@@ -1471,7 +1471,7 @@ class TestOpenOrder(SlapMixin):
...
@@ -1471,7 +1471,7 @@ class TestOpenOrder(SlapMixin):
},
},
"text_content"
:
{
"text_content"
:
{
"title"
:
"Parameter XML"
,
"title"
:
"Parameter XML"
,
"default"
:
dict2xml
({
'_'
:
json
.
dumps
(
parameter_dict
)}),
"default"
:
dict2xml
({
'_'
:
json
.
dumps
(
parameter_dict
)}),
"key"
:
"field_my_text_content"
,
"key"
:
"field_my_text_content"
,
"type"
:
"TextAreaField"
"type"
:
"TextAreaField"
},
},
...
@@ -1689,4 +1689,3 @@ class TestSoftwareProductCollection(SlapMixin):
...
@@ -1689,4 +1689,3 @@ class TestSoftwareProductCollection(SlapMixin):
self
.
product_collection
.
get
self
.
product_collection
.
get
)
)
self
.
assertEqual
(
self
.
product_collection
.
foo
,
'0'
)
self
.
assertEqual
(
self
.
product_collection
.
foo
,
'0'
)
slapos/tests/test_slapformat.py
View file @
7f45fa10
slapos/tests/test_slapgrid.py
View file @
7f45fa10
...
@@ -3446,7 +3446,7 @@ class TestSlapgridWithDevPermManagerDevPermAllowLsblk(TestSlapgridWithDevPermLsb
...
@@ -3446,7 +3446,7 @@ class TestSlapgridWithDevPermManagerDevPermAllowLsblk(TestSlapgridWithDevPermLsb
class TestSlapgridWithWhitelistfirewall(MasterMixin, unittest.TestCase):
class TestSlapgridWithWhitelistfirewall(MasterMixin, unittest.TestCase):
config = {
config = {
'manager_list': 'whitelistfirewall',
'manager_list': 'whitelistfirewall',
'firewall':{
'firewall':
{
'firewall_cmd': 'firewall_cmd',
'firewall_cmd': 'firewall_cmd',
}
}
}
}
...
...
slapos/tests/test_slapproxy.py
View file @
7f45fa10
...
@@ -462,7 +462,7 @@ class MasterMixin(BasicMixin, unittest.TestCase):
...
@@ -462,7 +462,7 @@ class MasterMixin(BasicMixin, unittest.TestCase):
def
supply
(
self
,
url
,
computer_id
=
None
,
state
=
'available'
):
def
supply
(
self
,
url
,
computer_id
=
None
,
state
=
'available'
):
if
not
computer_id
:
if
not
computer_id
:
computer_id
=
self
.
computer_id
computer_id
=
self
.
computer_id
request_dict
=
{
'url'
:
url
,
'computer_id'
:
computer_id
,
'state'
:
state
}
request_dict
=
{
'url'
:
url
,
'computer_id'
:
computer_id
,
'state'
:
state
}
rv
=
self
.
app
.
post
(
'/supplySupply'
,
rv
=
self
.
app
.
post
(
'/supplySupply'
,
data
=
request_dict
)
data
=
request_dict
)
# XXX return a Software Release
# XXX return a Software Release
...
@@ -1027,7 +1027,7 @@ class TestSlaveRequest(MasterMixin):
...
@@ -1027,7 +1027,7 @@ class TestSlaveRequest(MasterMixin):
before_timestamp
=
after_timestamp
before_timestamp
=
after_timestamp
time
.
sleep
(
0.1
)
time
.
sleep
(
0.1
)
self
.
request
(
'http://sr//'
,
None
,
'MySecondSlave'
,
shared
=
True
,
partition_parameter_kw
=
{
'a'
:
'b'
})
self
.
request
(
'http://sr//'
,
None
,
'MySecondSlave'
,
shared
=
True
,
partition_parameter_kw
=
{
'a'
:
'b'
})
after
=
getPartition
()
after
=
getPartition
()
after_timestamp
=
getTimestamp
(
after
)
after_timestamp
=
getTimestamp
(
after
)
self
.
assertEqual
(
len
(
after
.
_parameter_dict
[
'slave_instance_list'
]),
2
)
self
.
assertEqual
(
len
(
after
.
_parameter_dict
[
'slave_instance_list'
]),
2
)
...
@@ -1035,7 +1035,7 @@ class TestSlaveRequest(MasterMixin):
...
@@ -1035,7 +1035,7 @@ class TestSlaveRequest(MasterMixin):
before_timestamp
=
after_timestamp
before_timestamp
=
after_timestamp
time
.
sleep
(
0.1
)
time
.
sleep
(
0.1
)
self
.
request
(
'http://sr//'
,
None
,
'MySecondSlave'
,
shared
=
True
,
partition_parameter_kw
=
{
'a'
:
'b'
})
self
.
request
(
'http://sr//'
,
None
,
'MySecondSlave'
,
shared
=
True
,
partition_parameter_kw
=
{
'a'
:
'b'
})
after
=
getPartition
()
after
=
getPartition
()
after_timestamp
=
getTimestamp
(
after
)
after_timestamp
=
getTimestamp
(
after
)
self
.
assertEqual
(
len
(
after
.
_parameter_dict
[
'slave_instance_list'
]),
2
)
self
.
assertEqual
(
len
(
after
.
_parameter_dict
[
'slave_instance_list'
]),
2
)
...
@@ -1468,7 +1468,7 @@ class TestMultiNodeSupport(MasterMixin):
...
@@ -1468,7 +1468,7 @@ class TestMultiNodeSupport(MasterMixin):
self
.
assertEqual
(
rv
.
_status_code
,
404
)
self
.
assertEqual
(
rv
.
_status_code
,
404
)
rv
=
self
.
_requestComputerPartition
(
'http://sr//'
,
None
,
'MyFirstInstance'
,
'slappart2'
,
rv
=
self
.
_requestComputerPartition
(
'http://sr//'
,
None
,
'MyFirstInstance'
,
'slappart2'
,
filter_kw
=
{
'computer_guid'
:
self
.
computer_id
})
filter_kw
=
{
'computer_guid'
:
self
.
computer_id
})
self
.
assertEqual
(
rv
.
_status_code
,
404
)
self
.
assertEqual
(
rv
.
_status_code
,
404
)
# Register default computer: deployment works
# Register default computer: deployment works
...
@@ -1480,7 +1480,7 @@ class TestMultiNodeSupport(MasterMixin):
...
@@ -1480,7 +1480,7 @@ class TestMultiNodeSupport(MasterMixin):
# No free space on default computer: request without SLA fails
# No free space on default computer: request without SLA fails
rv
=
self
.
_requestComputerPartition
(
'http://sr//'
,
None
,
'CanIHasPartition'
,
'slappart2'
,
rv
=
self
.
_requestComputerPartition
(
'http://sr//'
,
None
,
'CanIHasPartition'
,
'slappart2'
,
filter_kw
=
{
'computer_guid'
:
self
.
computer_id
})
filter_kw
=
{
'computer_guid'
:
self
.
computer_id
})
self
.
assertEqual
(
rv
.
_status_code
,
404
)
self
.
assertEqual
(
rv
.
_status_code
,
404
)
def
test_multi_node_support_instance
(
self
):
def
test_multi_node_support_instance
(
self
):
...
@@ -1498,13 +1498,13 @@ class TestMultiNodeSupport(MasterMixin):
...
@@ -1498,13 +1498,13 @@ class TestMultiNodeSupport(MasterMixin):
# Deploy to first non-default computer using SLA
# Deploy to first non-default computer using SLA
# It should fail since computer is not registered
# It should fail since computer is not registered
rv
=
self
.
_requestComputerPartition
(
software_release_1
,
None
,
'MyFirstInstance'
,
'slappart2'
,
filter_kw
=
{
'computer_guid'
:
computer_0_id
})
rv
=
self
.
_requestComputerPartition
(
software_release_1
,
None
,
'MyFirstInstance'
,
'slappart2'
,
filter_kw
=
{
'computer_guid'
:
computer_0_id
})
self
.
assertEqual
(
rv
.
_status_code
,
404
)
self
.
assertEqual
(
rv
.
_status_code
,
404
)
self
.
format_for_number_of_partitions
(
2
,
computer_id
=
computer_0_id
)
self
.
format_for_number_of_partitions
(
2
,
computer_id
=
computer_0_id
)
# Deploy to first non-default computer using SLA
# Deploy to first non-default computer using SLA
partition
=
self
.
request
(
software_release_1
,
None
,
'MyFirstInstance'
,
'slappart0'
,
filter_kw
=
{
'computer_guid'
:
computer_0_id
})
partition
=
self
.
request
(
software_release_1
,
None
,
'MyFirstInstance'
,
'slappart0'
,
filter_kw
=
{
'computer_guid'
:
computer_0_id
})
self
.
assertEqual
(
partition
.
getState
(),
'started'
)
self
.
assertEqual
(
partition
.
getState
(),
'started'
)
self
.
assertEqual
(
partition
.
_partition_id
,
'slappart0'
)
self
.
assertEqual
(
partition
.
_partition_id
,
'slappart0'
)
self
.
assertEqual
(
partition
.
_computer_id
,
computer_0_id
)
self
.
assertEqual
(
partition
.
_computer_id
,
computer_0_id
)
...
@@ -1517,7 +1517,7 @@ class TestMultiNodeSupport(MasterMixin):
...
@@ -1517,7 +1517,7 @@ class TestMultiNodeSupport(MasterMixin):
self
.
assertTrue
(
computer_1
.
_computer_partition_list
[
1
].
_software_release_document
==
None
)
self
.
assertTrue
(
computer_1
.
_computer_partition_list
[
1
].
_software_release_document
==
None
)
# Deploy to second non-default computer using SLA
# Deploy to second non-default computer using SLA
partition
=
self
.
request
(
software_release_2
,
None
,
'MySecondInstance'
,
'slappart0'
,
filter_kw
=
{
'computer_guid'
:
computer_1_id
})
partition
=
self
.
request
(
software_release_2
,
None
,
'MySecondInstance'
,
'slappart0'
,
filter_kw
=
{
'computer_guid'
:
computer_1_id
})
self
.
assertEqual
(
partition
.
getState
(),
'started'
)
self
.
assertEqual
(
partition
.
getState
(),
'started'
)
self
.
assertEqual
(
partition
.
_partition_id
,
'slappart0'
)
self
.
assertEqual
(
partition
.
_partition_id
,
'slappart0'
)
self
.
assertEqual
(
partition
.
_computer_id
,
computer_1_id
)
self
.
assertEqual
(
partition
.
_computer_id
,
computer_1_id
)
...
@@ -1539,10 +1539,10 @@ class TestMultiNodeSupport(MasterMixin):
...
@@ -1539,10 +1539,10 @@ class TestMultiNodeSupport(MasterMixin):
computer_1_id
=
'COMP-1'
computer_1_id
=
'COMP-1'
self
.
format_for_number_of_partitions
(
6
,
computer_id
=
computer_0_id
)
self
.
format_for_number_of_partitions
(
6
,
computer_id
=
computer_0_id
)
self
.
format_for_number_of_partitions
(
6
,
computer_id
=
computer_1_id
)
self
.
format_for_number_of_partitions
(
6
,
computer_id
=
computer_1_id
)
partition_first
=
self
.
request
(
'http://sr//'
,
None
,
'MyFirstInstance'
,
'slappart0'
,
filter_kw
=
{
'computer_guid'
:
computer_0_id
})
partition_first
=
self
.
request
(
'http://sr//'
,
None
,
'MyFirstInstance'
,
'slappart0'
,
filter_kw
=
{
'computer_guid'
:
computer_0_id
})
partition_second
=
self
.
request
(
'http://sr//'
,
None
,
'MySecondInstance'
,
'slappart0'
,
filter_kw
=
{
'computer_guid'
:
computer_1_id
})
partition_second
=
self
.
request
(
'http://sr//'
,
None
,
'MySecondInstance'
,
'slappart0'
,
filter_kw
=
{
'computer_guid'
:
computer_1_id
})
partition_first
=
self
.
request
(
'http://sr//'
,
None
,
'MyFirstInstance'
,
'slappart0'
,
filter_kw
=
{
'computer_guid'
:
computer_0_id
},
state
=
'stopped'
)
partition_first
=
self
.
request
(
'http://sr//'
,
None
,
'MyFirstInstance'
,
'slappart0'
,
filter_kw
=
{
'computer_guid'
:
computer_0_id
},
state
=
'stopped'
)
computer_0
=
loads
(
self
.
app
.
get
(
'/getFullComputerInformation?computer_id=COMP-0'
).
data
)
computer_0
=
loads
(
self
.
app
.
get
(
'/getFullComputerInformation?computer_id=COMP-0'
).
data
)
computer_1
=
loads
(
self
.
app
.
get
(
'/getFullComputerInformation?computer_id=COMP-1'
).
data
)
computer_1
=
loads
(
self
.
app
.
get
(
'/getFullComputerInformation?computer_id=COMP-1'
).
data
)
...
@@ -1562,8 +1562,8 @@ class TestMultiNodeSupport(MasterMixin):
...
@@ -1562,8 +1562,8 @@ class TestMultiNodeSupport(MasterMixin):
computer_1_id
=
'COMP-1'
computer_1_id
=
'COMP-1'
self
.
format_for_number_of_partitions
(
2
,
computer_id
=
computer_0_id
)
self
.
format_for_number_of_partitions
(
2
,
computer_id
=
computer_0_id
)
self
.
format_for_number_of_partitions
(
2
,
computer_id
=
computer_1_id
)
self
.
format_for_number_of_partitions
(
2
,
computer_id
=
computer_1_id
)
partition
=
self
.
request
(
'http://sr//'
,
None
,
'MyFirstInstance'
,
'slappart0'
,
filter_kw
=
{
'computer_guid'
:
computer_0_id
})
partition
=
self
.
request
(
'http://sr//'
,
None
,
'MyFirstInstance'
,
'slappart0'
,
filter_kw
=
{
'computer_guid'
:
computer_0_id
})
partition
=
self
.
request
(
'http://sr//'
,
None
,
'MyFirstInstance'
,
'slappart0'
,
filter_kw
=
{
'computer_guid'
:
computer_1_id
})
partition
=
self
.
request
(
'http://sr//'
,
None
,
'MyFirstInstance'
,
'slappart0'
,
filter_kw
=
{
'computer_guid'
:
computer_1_id
})
self
.
assertEqual
(
partition
.
_computer_id
,
computer_0_id
)
self
.
assertEqual
(
partition
.
_computer_id
,
computer_0_id
)
...
@@ -1582,19 +1582,19 @@ class TestMultiNodeSupport(MasterMixin):
...
@@ -1582,19 +1582,19 @@ class TestMultiNodeSupport(MasterMixin):
self
.
format_for_number_of_partitions
(
2
,
computer_id
=
computer_0_id
)
self
.
format_for_number_of_partitions
(
2
,
computer_id
=
computer_0_id
)
self
.
format_for_number_of_partitions
(
2
,
computer_id
=
computer_1_id
)
self
.
format_for_number_of_partitions
(
2
,
computer_id
=
computer_1_id
)
self
.
format_for_number_of_partitions
(
2
)
self
.
format_for_number_of_partitions
(
2
)
self
.
request
(
'http://sr2//'
,
None
,
'MyFirstInstance'
,
'slappart0'
,
filter_kw
=
{
'computer_guid'
:
computer_0_id
})
self
.
request
(
'http://sr2//'
,
None
,
'MyFirstInstance'
,
'slappart0'
,
filter_kw
=
{
'computer_guid'
:
computer_0_id
})
self
.
request
(
'http://sr//'
,
None
,
'MyOtherInstance'
,
'slappart0'
,
filter_kw
=
{
'computer_guid'
:
computer_1_id
})
self
.
request
(
'http://sr//'
,
None
,
'MyOtherInstance'
,
'slappart0'
,
filter_kw
=
{
'computer_guid'
:
computer_1_id
})
# Request slave without SLA: will fail
# Request slave without SLA: will fail
rv
=
self
.
_requestComputerPartition
(
'http://sr//'
,
None
,
'MySlaveInstance'
,
'slappart2'
,
shared
=
True
)
rv
=
self
.
_requestComputerPartition
(
'http://sr//'
,
None
,
'MySlaveInstance'
,
'slappart2'
,
shared
=
True
)
self
.
assertEqual
(
rv
.
_status_code
,
404
)
self
.
assertEqual
(
rv
.
_status_code
,
404
)
# Request slave with SLA on incorrect computer: will fail
# Request slave with SLA on incorrect computer: will fail
rv
=
self
.
_requestComputerPartition
(
'http://sr//'
,
None
,
'MySlaveInstance'
,
'slappart2'
,
shared
=
True
,
filter_kw
=
{
'computer_guid'
:
computer_0_id
})
rv
=
self
.
_requestComputerPartition
(
'http://sr//'
,
None
,
'MySlaveInstance'
,
'slappart2'
,
shared
=
True
,
filter_kw
=
{
'computer_guid'
:
computer_0_id
})
self
.
assertEqual
(
rv
.
_status_code
,
404
)
self
.
assertEqual
(
rv
.
_status_code
,
404
)
# Request computer on correct computer: will succeed
# Request computer on correct computer: will succeed
partition
=
self
.
request
(
'http://sr//'
,
None
,
'MySlaveInstance'
,
'slappart2'
,
shared
=
True
,
filter_kw
=
{
'computer_guid'
:
computer_1_id
})
partition
=
self
.
request
(
'http://sr//'
,
None
,
'MySlaveInstance'
,
'slappart2'
,
shared
=
True
,
filter_kw
=
{
'computer_guid'
:
computer_1_id
})
self
.
assertEqual
(
partition
.
_computer_id
,
computer_1_id
)
self
.
assertEqual
(
partition
.
_computer_id
,
computer_1_id
)
def
test_multi_node_support_instance_guid
(
self
):
def
test_multi_node_support_instance_guid
(
self
):
...
@@ -1608,8 +1608,8 @@ class TestMultiNodeSupport(MasterMixin):
...
@@ -1608,8 +1608,8 @@ class TestMultiNodeSupport(MasterMixin):
self
.
format_for_number_of_partitions
(
2
,
computer_id
=
computer_0_id
)
self
.
format_for_number_of_partitions
(
2
,
computer_id
=
computer_0_id
)
self
.
format_for_number_of_partitions
(
2
,
computer_id
=
computer_1_id
)
self
.
format_for_number_of_partitions
(
2
,
computer_id
=
computer_1_id
)
self
.
format_for_number_of_partitions
(
2
)
self
.
format_for_number_of_partitions
(
2
)
partition_computer_0
=
self
.
request
(
'http://sr2//'
,
None
,
'MyFirstInstance'
,
'slappart0'
,
filter_kw
=
{
'computer_guid'
:
computer_0_id
})
partition_computer_0
=
self
.
request
(
'http://sr2//'
,
None
,
'MyFirstInstance'
,
'slappart0'
,
filter_kw
=
{
'computer_guid'
:
computer_0_id
})
partition_computer_1
=
self
.
request
(
'http://sr//'
,
None
,
'MyOtherInstance'
,
'slappart0'
,
filter_kw
=
{
'computer_guid'
:
computer_1_id
})
partition_computer_1
=
self
.
request
(
'http://sr//'
,
None
,
'MyOtherInstance'
,
'slappart0'
,
filter_kw
=
{
'computer_guid'
:
computer_1_id
})
partition_computer_default
=
self
.
request
(
'http://sr//'
,
None
,
'MyThirdInstance'
,
'slappart0'
)
partition_computer_default
=
self
.
request
(
'http://sr//'
,
None
,
'MyThirdInstance'
,
'slappart0'
)
self
.
assertEqual
(
partition_computer_0
.
getInstanceGuid
(),
'COMP-0-slappart0'
)
self
.
assertEqual
(
partition_computer_0
.
getInstanceGuid
(),
'COMP-0-slappart0'
)
...
...
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