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
Eric Zheng
slapos
Commits
bba71aee
Commit
bba71aee
authored
Nov 19, 2019
by
Łukasz Nowak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kvm/test: Add sanity check
Assert that machine running tests is good enough for KVM tests.
parent
d8b356fa
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
6 deletions
+19
-6
software/kvm/test/test.py
software/kvm/test/test.py
+19
-6
No files found.
software/kvm/test/test.py
View file @
bba71aee
...
@@ -30,6 +30,7 @@ import json
...
@@ -30,6 +30,7 @@ import json
import
os
import
os
import
requests
import
requests
import
slapos.util
import
slapos.util
import
subprocess
import
sqlite3
import
sqlite3
import
urlparse
import
urlparse
...
@@ -42,8 +43,20 @@ setUpModule, InstanceTestCase = makeModuleSetUpAndTestCaseClass(
...
@@ -42,8 +43,20 @@ setUpModule, InstanceTestCase = makeModuleSetUpAndTestCaseClass(
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
'..'
,
'software.cfg'
)))
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
'..'
,
'software.cfg'
)))
class
ServicesTestCase
(
InstanceTestCase
):
class
SanityCheckedInstanceTestCase
(
InstanceTestCase
):
def
test_kvm_sanity_check
(
self
):
"""Sanity check - if fails, machine is not able to run KVM tests"""
try
:
output
=
subprocess
.
check_output
(
"lsmod | grep kvm_intel"
,
shell
=
True
)
except
subprocess
.
CalledProcessError
as
e
:
state
=
False
output
=
e
.
output
else
:
state
=
True
self
.
assertTrue
(
state
)
self
.
assertRegexpMatches
(
output
,
r'kvm.*kvm_intel'
)
class
ServicesTestCase
(
SanityCheckedInstanceTestCase
):
def
test_hashes
(
self
):
def
test_hashes
(
self
):
hash_files
=
[
hash_files
=
[
'software_release/buildout.cfg'
,
'software_release/buildout.cfg'
,
...
@@ -138,7 +151,7 @@ class MonitorAccessMixin(object):
...
@@ -138,7 +151,7 @@ class MonitorAccessMixin(object):
)
)
class
TestAccessDefault
(
MonitorAccessMixin
,
InstanceTestCase
):
class
TestAccessDefault
(
MonitorAccessMixin
,
SanityChecked
InstanceTestCase
):
__partition_reference__
=
'ad'
__partition_reference__
=
'ad'
expected_partition_with_monitor_base_url_count
=
1
expected_partition_with_monitor_base_url_count
=
1
...
@@ -154,7 +167,7 @@ class TestAccessDefault(MonitorAccessMixin, InstanceTestCase):
...
@@ -154,7 +167,7 @@ class TestAccessDefault(MonitorAccessMixin, InstanceTestCase):
self
.
assertFalse
(
'url-additional'
in
connection_parameter_dict
)
self
.
assertFalse
(
'url-additional'
in
connection_parameter_dict
)
class
TestAccessDefaultAdditional
(
MonitorAccessMixin
,
InstanceTestCase
):
class
TestAccessDefaultAdditional
(
MonitorAccessMixin
,
SanityChecked
InstanceTestCase
):
__partition_reference__
=
'ada'
__partition_reference__
=
'ada'
expected_partition_with_monitor_base_url_count
=
1
expected_partition_with_monitor_base_url_count
=
1
...
@@ -184,7 +197,7 @@ class TestAccessDefaultAdditional(MonitorAccessMixin, InstanceTestCase):
...
@@ -184,7 +197,7 @@ class TestAccessDefaultAdditional(MonitorAccessMixin, InstanceTestCase):
self
.
assertTrue
(
'<title>noVNC</title>'
in
result
.
text
)
self
.
assertTrue
(
'<title>noVNC</title>'
in
result
.
text
)
class
TestAccessKvmCluster
(
MonitorAccessMixin
,
InstanceTestCase
):
class
TestAccessKvmCluster
(
MonitorAccessMixin
,
SanityChecked
InstanceTestCase
):
__partition_reference__
=
'akc'
__partition_reference__
=
'akc'
expected_partition_with_monitor_base_url_count
=
2
expected_partition_with_monitor_base_url_count
=
2
...
@@ -214,7 +227,7 @@ class TestAccessKvmCluster(MonitorAccessMixin, InstanceTestCase):
...
@@ -214,7 +227,7 @@ class TestAccessKvmCluster(MonitorAccessMixin, InstanceTestCase):
self
.
assertFalse
(
'kvm0-url-additional'
in
connection_parameter_dict
)
self
.
assertFalse
(
'kvm0-url-additional'
in
connection_parameter_dict
)
class
TestAccessKvmClusterAdditional
(
MonitorAccessMixin
,
InstanceTestCase
):
class
TestAccessKvmClusterAdditional
(
MonitorAccessMixin
,
SanityChecked
InstanceTestCase
):
__partition_reference__
=
'akca'
__partition_reference__
=
'akca'
expected_partition_with_monitor_base_url_count
=
2
expected_partition_with_monitor_base_url_count
=
2
...
...
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