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
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
Léo-Paul Géneau
slapos
Commits
f4872dcf
Commit
f4872dcf
authored
Mar 17, 2022
by
Łukasz Nowak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kvm: flak8ize test
parent
8a172d3c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
10 deletions
+18
-10
software/kvm/test/test.py
software/kvm/test/test.py
+18
-10
No files found.
software/kvm/test/test.py
View file @
f4872dcf
...
...
@@ -455,8 +455,8 @@ class TestAccessDefaultBootstrap(MonitorAccessMixin, InstanceTestCase):
self
.
slap
.
waitForInstance
(
max_retry
=
10
)
# END: mock .slapos-resource with tap.ipv4_addr
c
onnection_parameter_dict
=
self
.
computer_partition
\
.
getConnectionParameterDict
()
c
p
=
self
.
computer_partition
connection_parameter_dict
=
cp
.
getConnectionParameterDict
()
result
=
requests
.
get
(
connection_parameter_dict
[
'url'
],
verify
=
False
)
self
.
assertEqual
(
...
...
@@ -887,13 +887,14 @@ class TestBootImageUrlList(InstanceTestCase, FakeImageServerMixin):
self
.
slap
.
waitForInstance
(
max_retry
=
10
)
super
(
InstanceTestCase
,
self
).
tearDown
()
def
getRunningImageList
(
self
,
kvm_instance_partition
,
def
getRunningImageList
(
self
,
kvm_instance_partition
,
_match_cdrom
=
re
.
compile
(
'file=(.+),media=cdrom$'
).
match
,
_sub_iso
=
re
.
compile
(
r'(/debian)(-[^-/]+)(-[^/]+-netinst\
.iso)$
').sub,
):
):
with self.slap.instance_supervisor_rpc as instance_supervisor:
kvm_pid = next(q for q in instance_supervisor.getAllProcessInfo()
if '
kvm
-
' in q['
name
'])['
pid
']
if '
kvm
-
' in q['
name
'])['
pid
']
sub_shared = re.compile(r'
^%
s
/
[
^/
]
+/
[
0
-
9
a
-
f
]{
32
}
/
'
% re.escape(self.slap.shared_directory)).sub
image_list = []
...
...
@@ -902,10 +903,12 @@ class TestBootImageUrlList(InstanceTestCase, FakeImageServerMixin):
if m:
path = m.group(1)
image_list.append(
_sub_iso(r'
\
1
-
$
{
ver
}
\
3
',
sub_shared(r'
$
{
shared
}
/
',
path.replace(kvm_instance_partition, '
$
{
inst
}
')
)))
_sub_iso(
r'
\
1
-
$
{
ver
}
\
3
',
sub_shared(
r'
$
{
shared
}
/
',
path.replace(kvm_instance_partition, '
$
{
inst
}
')
)))
return image_list
def test(self):
...
...
@@ -1039,6 +1042,7 @@ class TestBootImageUrlList(InstanceTestCase, FakeImageServerMixin):
@skipUnlessKvm
class TestBootImageUrlListResilient(TestBootImageUrlList):
kvm_instance_partition_reference = '
biul2
'
@classmethod
def getInstanceSoftwareType(cls):
return '
kvm
-
resilient
'
...
...
@@ -1149,6 +1153,7 @@ class TestBootImageUrlSelect(TestBootImageUrlList):
@
skipUnlessKvm
class
TestBootImageUrlSelectResilient
(
TestBootImageUrlSelect
):
kvm_instance_partition_reference
=
'bius2'
@
classmethod
def
getInstanceSoftwareType
(
cls
):
return
'kvm-resilient'
...
...
@@ -1264,6 +1269,7 @@ class TestNatRulesKvmCluster(InstanceTestCase):
__partition_reference__
=
'nrkc'
nat_rules
=
[
"100"
,
"200"
,
"300"
]
@
classmethod
def
getInstanceSoftwareType
(
cls
):
return
'kvm-cluster'
...
...
@@ -1340,6 +1346,7 @@ class TestWhitelistFirewall(InstanceTestCase):
@
skipUnlessKvm
class
TestWhitelistFirewallRequest
(
TestWhitelistFirewall
):
whitelist_domains
=
'2.2.2.2 3.3.3.3
\
n
4.4.4.4'
@
classmethod
def
getInstanceParameterDict
(
cls
):
return
{
...
...
@@ -1655,7 +1662,7 @@ class TestParameterDefault(InstanceTestCase, KvmMixin):
def
_test
(
self
,
parameter_dict
,
expected
):
self
.
rerequestInstance
(
self
.
mangleParameterDict
(
parameter_dict
))
self
.
slap
.
waitForInstance
(
max_retry
=
10
)
kvm_raw
=
glob
.
glob
(
os
.
path
.
join
(
self
.
slap
.
instance_directory
,
'*'
,
'bin'
,
'kvm_raw'
))
self
.
assertEqual
(
len
(
kvm_raw
),
1
)
...
...
@@ -1704,6 +1711,7 @@ class TestParameterDefault(InstanceTestCase, KvmMixin):
@
skipUnlessKvm
class
TestParameterResilient
(
TestParameterDefault
):
__partition_reference__
=
'pr'
@
classmethod
def
getInstanceSoftwareType
(
cls
):
return
'kvm-resilient'
...
...
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