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
Boxiang Sun
slapos
Commits
11349158
Commit
11349158
authored
May 05, 2020
by
Thomas Gambier
🚴🏼
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
software/kvm: add more instantiation tests
parent
237db681
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
96 additions
and
0 deletions
+96
-0
software/kvm/test/test.py
software/kvm/test/test.py
+96
-0
No files found.
software/kvm/test/test.py
View file @
11349158
...
@@ -54,7 +54,45 @@ else:
...
@@ -54,7 +54,45 @@ else:
self
.
fail
(
'This environment is not usable for kvm testing,'
self
.
fail
(
'This environment is not usable for kvm testing,'
' as it lacks kvm_intel kernel module'
)
' as it lacks kvm_intel kernel module'
)
bootstrap_common_param_dict
=
{
# the bootstrap script is vm-bootstrap
"bootstrap-script-url"
:
"http://shacache.org/shacache/05105cd25d1ad798b71fd46a206c9b73da2c285a078af33d0e739525a595886785725a68811578bc21f75d0a97700a66d5e75bce5b2721ca4556a0734cb13e65#c98825aa1b6c8087914d2bfcafec3058"
,
"slave-frontend"
:
{
"slave-frontend-dict"
:
{}
},
"authorized-keys"
:
[
"ssh-rsa %s key_one"
%
(
"A"
*
372
),
"ssh-rsa %s key_two"
%
(
"B"
*
372
),
"ssh-rsa %s key_three"
%
(
"C"
*
372
)
],
"fw-restricted-access"
:
"off"
,
"fw-authorized-sources"
:
[],
"fw-reject-sources"
:
[
"10.32.0.0/13"
]
}
bootstrap_machine_param_dict
=
{
"computer-guid"
:
"local"
,
"disable-ansible-promise"
:
True
,
"state"
:
"started"
,
"auto-ballooning"
:
True
,
"ram-size"
:
4096
,
"cpu-count"
:
2
,
"disk-size"
:
50
,
# Debian 10 image
"virtual-hard-drive-url"
:
"http://shacache.org/shacache/9d3e6d017754fdd08e5ecf78093dec27fd792fb183df6146006adf003b6f4b98c0388d5a11566627101f7855d77f60e3dd4ba7ce66850f4a8f030573b904d5ab"
,
"virtual-hard-drive-md5sum"
:
"b7928d7b0a2b5e2888f5ddf68f5fe422"
,
"virtual-hard-drive-gzipped"
:
False
,
"hard-drive-url-check-certificate"
:
False
,
"use-tap"
:
True
,
"use-nat"
:
True
,
"nat-restrict-mode"
:
True
,
"enable-vhost"
:
True
,
"external-disk-number"
:
1
,
"external-disk-size"
:
100
,
"external-disk-format"
:
"qcow2"
,
"enable-monitor"
:
True
,
"keyboard-layout-language"
:
"fr"
}
@
skipUnlessKvm
@
skipUnlessKvm
class
ServicesTestCase
(
InstanceTestCase
):
class
ServicesTestCase
(
InstanceTestCase
):
def
test_hashes
(
self
):
def
test_hashes
(
self
):
...
@@ -198,6 +236,25 @@ class TestAccessDefaultAdditional(MonitorAccessMixin, InstanceTestCase):
...
@@ -198,6 +236,25 @@ class TestAccessDefaultAdditional(MonitorAccessMixin, InstanceTestCase):
)
)
self
.
assertIn
(
'<title>noVNC</title>'
,
result
.
text
)
self
.
assertIn
(
'<title>noVNC</title>'
,
result
.
text
)
@
skipUnlessKvm
class
TestAccessDefaultBootstrap
(
MonitorAccessMixin
,
InstanceTestCase
):
__partition_reference__
=
'adb'
expected_partition_with_monitor_base_url_count
=
1
@
classmethod
def
getInstanceParameterDict
(
cls
):
return
{
'_'
:
json
.
dumps
(
dict
(
bootstrap_common_param_dict
,
**
bootstrap_machine_param_dict
))}
def
test
(
self
):
connection_parameter_dict
=
self
.
computer_partition
\
.
getConnectionParameterDict
()
result
=
requests
.
get
(
connection_parameter_dict
[
'url'
],
verify
=
False
)
self
.
assertEqual
(
httplib
.
OK
,
result
.
status_code
)
self
.
assertIn
(
'<title>noVNC</title>'
,
result
.
text
)
@
skipUnlessKvm
@
skipUnlessKvm
class
TestAccessKvmCluster
(
MonitorAccessMixin
,
InstanceTestCase
):
class
TestAccessKvmCluster
(
MonitorAccessMixin
,
InstanceTestCase
):
...
@@ -270,6 +327,45 @@ class TestAccessKvmClusterAdditional(MonitorAccessMixin, InstanceTestCase):
...
@@ -270,6 +327,45 @@ class TestAccessKvmClusterAdditional(MonitorAccessMixin, InstanceTestCase):
)
)
self
.
assertIn
(
'<title>noVNC</title>'
,
result
.
text
)
self
.
assertIn
(
'<title>noVNC</title>'
,
result
.
text
)
@
skipUnlessKvm
class
TestAccessKvmClusterBootstrap
(
MonitorAccessMixin
,
InstanceTestCase
):
__partition_reference__
=
'akcb'
expected_partition_with_monitor_base_url_count
=
3
@
classmethod
def
getInstanceSoftwareType
(
cls
):
return
'kvm-cluster'
@
classmethod
def
getInstanceParameterDict
(
cls
):
return
{
'_'
:
json
.
dumps
(
dict
(
bootstrap_common_param_dict
,
**
{
"kvm-partition-dict"
:
{
"test-machine1"
:
bootstrap_machine_param_dict
,
"test-machine2"
:
dict
(
bootstrap_machine_param_dict
,
**
{
# Debian 9 image
"virtual-hard-drive-url"
:
"http://shacache.org/shacache/ce07873dbab7fa8501d1bf5565c2737b2eed6c8b9361b4997b21daf5f5d1590972db9ac00131cc5b27d9aa353f2f94071e073f9980cc61badd6d2427f592e6e8"
,
"virtual-hard-drive-md5sum"
:
"2b113e3cd8276b9740189622603d6f99"
})
}
}))}
def
test
(
self
):
connection_parameter_dict
=
self
.
computer_partition
\
.
getConnectionParameterDict
()
result
=
requests
.
get
(
connection_parameter_dict
[
'KVM0-url'
],
verify
=
False
)
self
.
assertEqual
(
httplib
.
OK
,
result
.
status_code
)
self
.
assertIn
(
'<title>noVNC</title>'
,
result
.
text
)
result
=
requests
.
get
(
connection_parameter_dict
[
'KVM1-url'
],
verify
=
False
)
self
.
assertEqual
(
httplib
.
OK
,
result
.
status_code
)
self
.
assertIn
(
'<title>noVNC</title>'
,
result
.
text
)
@
skipUnlessKvm
@
skipUnlessKvm
class
TestInstanceResilient
(
InstanceTestCase
):
class
TestInstanceResilient
(
InstanceTestCase
):
...
...
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