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
Łukasz Nowak
slapos
Commits
2b4f32f3
Commit
2b4f32f3
authored
Apr 19, 2024
by
Łukasz Nowak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
XXX
parent
43a43300
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
24 deletions
+33
-24
software/kvm/test/test.py
software/kvm/test/test.py
+33
-24
No files found.
software/kvm/test/test.py
View file @
2b4f32f3
...
...
@@ -175,10 +175,12 @@ class KvmMixin:
)
def
getRunningImageList
(
self
,
kvm_instance_partition
,
self
,
_match_cdrom
=
re
.
compile
(
'file=(.+),media=cdrom$'
).
match
,
_sub_iso
=
re
.
compile
(
r'(/debian)(-[^-/]+)(-[^/]+-netinst\
.iso)$
').sub,
):
kvm_instance_partition = os.path.join(
self.slap.instance_directory, self.kvm_instance_partition_reference)
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
']
...
...
@@ -202,27 +204,25 @@ class KvmMixin:
return json.loads(
self.computer_partition.getConnectionParameterDict()['
_
'])
def getProcessInfo(self):
def getProcessInfo(self, kvm_additional_hash_file_list=None):
if kvm_additional_hash_file_list is None:
kvm_additional_hash_file_list = []
hash_value = generateHashFromFiles([
os.path.join(self.computer_partition_root_path, hash_file)
for hash_file in [
'
software_release
/
buildout
.
cfg
',
]
])
# find bin/kvm_raw
kvm_raw_list = glob.glob(
os.path.join(self.slap.instance_directory, '
*
', '
bin
', '
kvm_raw
'))
self.assertEqual(1, len(kvm_raw_list)) # allow to work only with one
kvm_partition = os.path.join(
self.slap.instance_directory, self.kvm_instance_partition_reference)
hash_file_list = [
# Note: order is important:
# * shall follow generated order in the hash_files
# * last shall be hash_existsing_files (software_release/buildout.cfg)
kvm_raw_list[0],
'
var
/
boot
-
image
-
url
-
select
/
boot
-
image
-
url
-
select
.
json
',
'
software_release
/
buildout
.
cfg
'
[os.path.join(kvm_partition, '
bin
', '
kvm_raw
')
] + kvm_additional_hash_file_list + [
'
software_release
/
buildout
.
cfg
']
]
kvm_hash_value = generateHashFromFiles([
os.path.join(
self.computer_partition_root_path
, hash_file)
os.path.join(
kvm_partition
, hash_file)
for hash_file in hash_file_list
])
with self.slap.instance_supervisor_rpc as supervisor:
...
...
@@ -299,6 +299,7 @@ class TestInstance(KVMTestCase, KvmMixin):
"""i0:6tunnel-10022-{hash}-on-watch RUNNING
i0:6tunnel-10080-{hash}-on-watch RUNNING
i0:6tunnel-10443-{hash}-on-watch RUNNING
i0:boot-image-url-list-updater-{hash} EXITED
i0:boot-image-url-select-updater-{hash} EXITED
i0:bootstrap-monitor EXITED
i0:certificate_authority-{hash}-on-watch RUNNING
...
...
@@ -311,7 +312,10 @@ i0:nginx-graceful EXITED
i0:nginx-on-watch RUNNING
i0:whitelist-domains-download-{hash} RUNNING
i0:whitelist-firewall-{hash} RUNNING""",
self.getProcessInfo()
self.getProcessInfo([
'
var
/
boot
-
image
-
url
-
list
/
boot
-
image
-
url
-
list
.
json
',
'
var
/
boot
-
image
-
url
-
select
/
boot
-
image
-
url
-
select
.
json
'
])
)
# assure that the default image is used
...
...
@@ -320,7 +324,7 @@ i0:whitelist-firewall-{hash} RUNNING""",
'
$
{
inst
}
/
srv
/
boot
-
image
-
url
-
select
-
repository
/
'
'
326
b7737c4262e8eb09cd26773f3356a
'
],
self.getRunningImageList(
self.computer_partition_root_path
)
self.getRunningImageList()
)
...
...
@@ -802,6 +806,8 @@ ir1:pbs_sshkeys_authority-on-watch RUNNING
ir2:6tunnel-10022-{hash}-on-watch RUNNING
ir2:6tunnel-10080-{hash}-on-watch RUNNING
ir2:6tunnel-10443-{hash}-on-watch RUNNING
ir2:boot-image-url-list-updater-{hash} EXITED
ir2:boot-image-url-select-updater-{hash} EXITED
ir2:bootstrap-monitor EXITED
ir2:certificate_authority-{hash}-on-watch RUNNING
ir2:crond-{hash}-on-watch RUNNING
...
...
@@ -829,7 +835,10 @@ ir3:resilient-web-takeover-httpd-on-watch RUNNING
ir3:resilient_sshkeys_authority-on-watch RUNNING
ir3:sshd-graceful EXITED
ir3:sshd-on-watch RUNNING""",
self.getProcessInfo()
self.getProcessInfo([
'
var
/
boot
-
image
-
url
-
list
/
boot
-
image
-
url
-
list
.
json
',
'
var
/
boot
-
image
-
url
-
select
/
boot
-
image
-
url
-
select
.
json
'
])
)
...
...
@@ -1079,7 +1088,7 @@ class TestBootImageUrlList(FakeImageServerMixin, KVMTestCase):
f'
$
{{
inst
}}
/
srv
/
{
self
.
image_directory
}
/
{
self
.
fake_image_md5sum
}
',
f'
$
{{
inst
}}
/
srv
/
{
self
.
image_directory
}
/
{
self
.
fake_image2_md5sum
}
',
],
self.getRunningImageList(
kvm_instance_partition
)
self.getRunningImageList()
)
# Switch image
...
...
@@ -1099,7 +1108,7 @@ class TestBootImageUrlList(FakeImageServerMixin, KVMTestCase):
f'
$
{{
inst
}}
/
srv
/
{
self
.
image_directory
}
/
{
self
.
fake_image3_md5sum
}
',
f'
$
{{
inst
}}
/
srv
/
{
self
.
image_directory
}
/
{
self
.
fake_image2_md5sum
}
',
],
self.getRunningImageList(
kvm_instance_partition
)
self.getRunningImageList()
)
# cleanup of images works, also asserts that configuration changes are
...
...
@@ -1117,7 +1126,7 @@ class TestBootImageUrlList(FakeImageServerMixin, KVMTestCase):
'
$
{
inst
}
/
srv
/
boot
-
image
-
url
-
select
-
repository
/
'
'
326
b7737c4262e8eb09cd26773f3356a
'
],
self.getRunningImageList(
kvm_instance_partition
)
self.getRunningImageList()
)
def test_bad_parameter(self):
...
...
@@ -1211,7 +1220,7 @@ class TestBootImageUrlSelect(FakeImageServerMixin, KVMTestCase):
'
$
{
inst
}
/
srv
/
boot
-
image
-
url
-
select
-
repository
/
'
'
326
b7737c4262e8eb09cd26773f3356a
'
],
self.getRunningImageList(
self.computer_partition_root_path
)
self.getRunningImageList()
)
# switch the image
self.rerequestInstance({
...
...
@@ -1234,7 +1243,7 @@ class TestBootImageUrlSelect(FakeImageServerMixin, KVMTestCase):
'
$
{
inst
}
/
srv
/
boot
-
image
-
url
-
select
-
repository
/
'
'
b710c178eb434d79ce40ce703d30a5f0
'
],
self.getRunningImageList(
self.computer_partition_root_path
)
self.getRunningImageList()
)
def test_bad_image(self):
...
...
@@ -1289,7 +1298,7 @@ class TestBootImageUrlSelect(FakeImageServerMixin, KVMTestCase):
'
$
{
inst
}
/
srv
/
boot
-
image
-
url
-
select
-
repository
/
'
'
b710c178eb434d79ce40ce703d30a5f0
'
],
self.getRunningImageList(
kvm_instance_partition
)
self.getRunningImageList()
)
# check that using only boot-image-url-list results with not having
...
...
@@ -1329,7 +1338,7 @@ class TestBootImageUrlSelect(FakeImageServerMixin, KVMTestCase):
'
$
{{
inst
}}
/
srv
/
boot
-
image
-
url
-
list
-
repository
/
{}
'.format(
self.fake_image_md5sum),
],
self.getRunningImageList(
kvm_instance_partition
)
self.getRunningImageList()
)
# cleanup of images works, also asserts that configuration changes are
...
...
@@ -1354,7 +1363,7 @@ class TestBootImageUrlSelect(FakeImageServerMixin, KVMTestCase):
'
$
{
inst
}
/
srv
/
boot
-
image
-
url
-
select
-
repository
/
'
'
326
b7737c4262e8eb09cd26773f3356a
'
],
self.getRunningImageList(
kvm_instance_partition
)
self.getRunningImageList()
)
...
...
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