Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Alain Takoudjou
slapos
Commits
efbc92e2
Commit
efbc92e2
authored
Jan 28, 2021
by
Łukasz Nowak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
software/kvm: Test nat-rules
Default and cluster are tested for the most expected usage.
parent
e2f02f38
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
69 additions
and
0 deletions
+69
-0
software/kvm/test/test.py
software/kvm/test/test.py
+69
-0
No files found.
software/kvm/test/test.py
View file @
efbc92e2
...
...
@@ -924,3 +924,72 @@ class TestCpuMemMaxDynamic(InstanceTestCase):
self
.
assertIn
(
'smp_max_count = 3'
,
kvm_raw
)
self
.
assertIn
(
'ram_size = 2048'
,
kvm_raw
)
self
.
assertIn
(
"ram_max_size = '2560'"
,
kvm_raw
)
@
skipUnlessKvm
class
TestNatRules
(
InstanceTestCase
):
__partition_reference__
=
'nr'
@
classmethod
def
getInstanceParameterDict
(
cls
):
return
{
'nat-rules'
:
'100 200'
,
}
def
test
(
self
):
connection_parameter_dict
=
self
.
computer_partition
\
.
getConnectionParameterDict
()
self
.
assertIn
(
'nat-rule-port-tcp-100'
,
connection_parameter_dict
)
self
.
assertIn
(
'nat-rule-port-tcp-200'
,
connection_parameter_dict
)
self
.
assertEqual
(
'%s : 10100'
%
(
self
.
_ipv6_address
,),
connection_parameter_dict
[
'nat-rule-port-tcp-100'
]
)
self
.
assertEqual
(
'%s : 10200'
%
(
self
.
_ipv6_address
,),
connection_parameter_dict
[
'nat-rule-port-tcp-200'
]
)
@
skipUnlessKvm
class
TestNatRulesKvmCluster
(
InstanceTestCase
):
__partition_reference__
=
'nrkc'
nat_rules
=
[
"100"
,
"200"
,
"300"
]
@
classmethod
def
getInstanceSoftwareType
(
cls
):
return
'kvm-cluster'
@
classmethod
def
getInstanceParameterDict
(
cls
):
return
{
'_'
:
json
.
dumps
({
"kvm-partition-dict"
:
{
"KVM0"
:
{
"nat-rules"
:
cls
.
nat_rules
,
"disable-ansible-promise"
:
True
,
}
}
})}
def
getRunningHostFwd
(
self
):
with
self
.
slap
.
instance_supervisor_rpc
as
instance_supervisor
:
kvm_pid
=
[
q
for
q
in
instance_supervisor
.
getAllProcessInfo
()
if
'kvm-'
in
q
[
'name'
]][
0
][
'pid'
]
kvm_process
=
psutil
.
Process
(
kvm_pid
)
for
entry
in
kvm_process
.
cmdline
():
if
'hostfwd'
in
entry
:
return
entry
def
test
(
self
):
host_fwd_entry
=
self
.
getRunningHostFwd
()
self
.
assertIn
(
'hostfwd=tcp:%s:10100-:100'
%
(
self
.
_ipv4_address
,),
host_fwd_entry
)
self
.
assertIn
(
'hostfwd=tcp:%s:10200-:200'
%
(
self
.
_ipv4_address
,),
host_fwd_entry
)
self
.
assertIn
(
'hostfwd=tcp:%s:10300-:300'
%
(
self
.
_ipv4_address
,),
host_fwd_entry
)
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