Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
snf-ganeti
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
itminedu
snf-ganeti
Commits
8947cf2b
Commit
8947cf2b
authored
17 years ago
by
Michael Hanselmann
Browse files
Options
Downloads
Patches
Plain Diff
Do QA tests on “gnt-os“, including partially valid OSes.
Reviewed-by: iustinp
parent
90ab92e3
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
qa/Makefile.am
+2
-1
2 additions, 1 deletion
qa/Makefile.am
qa/ganeti-qa.py
+8
-0
8 additions, 0 deletions
qa/ganeti-qa.py
qa/qa-sample.yaml
+2
-0
2 additions, 0 deletions
qa/qa-sample.yaml
qa/qa_os.py
+137
-0
137 additions, 0 deletions
qa/qa_os.py
with
149 additions
and
1 deletion
qa/Makefile.am
+
2
−
1
View file @
8947cf2b
...
...
@@ -5,7 +5,8 @@ EXTRA_DIST = ganeti-qa.py qa-sample.yaml \
qa_env.py
\
qa_error.py
\
qa_instance.py
\
qa_node.py
qa_node.py
\
qa_os.py
\
qa_other.py
\
qa_utils.py
CLEANFILES
=
*
.py[co]
This diff is collapsed.
Click to expand it.
qa/ganeti-qa.py
+
8
−
0
View file @
8947cf2b
...
...
@@ -37,6 +37,7 @@ import qa_daemon
import
qa_env
import
qa_instance
import
qa_node
import
qa_os
import
qa_other
...
...
@@ -121,6 +122,13 @@ def main():
if
qa_config
.
TestEnabled
(
'
cluster-master-failover
'
):
RunTest
(
qa_cluster
.
TestClusterMasterFailover
)
if
qa_config
.
TestEnabled
(
'
os
'
):
RunTest
(
qa_os
.
TestOsList
)
RunTest
(
qa_os
.
TestOsDiagnose
)
RunTest
(
qa_os
.
TestOsValid
)
RunTest
(
qa_os
.
TestOsInvalid
)
RunTest
(
qa_os
.
TestOsPartiallyValid
)
node
=
qa_config
.
AcquireNode
()
try
:
if
qa_config
.
TestEnabled
(
'
instance-add-plain-disk
'
):
...
...
This diff is collapsed.
Click to expand it.
qa/qa-sample.yaml
+
2
−
0
View file @
8947cf2b
...
...
@@ -26,6 +26,8 @@ instances:
tests
:
env
:
True
os
:
True
cluster-verify
:
True
cluster-info
:
True
cluster-getmaster
:
True
...
...
This diff is collapsed.
Click to expand it.
qa/qa_os.py
0 → 100644
+
137
−
0
View file @
8947cf2b
# Copyright (C) 2007 Google Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
"""
OS related QA tests.
"""
import
os
import
os.path
from
ganeti
import
utils
from
ganeti
import
constants
import
qa_config
import
qa_utils
from
qa_utils
import
AssertEqual
,
StartSSH
_TEMP_OS_NAME
=
"
TEMP-Ganeti-QA-OS
"
_TEMP_OS_PATH
=
os
.
path
.
join
(
constants
.
OS_SEARCH_PATH
[
0
],
_TEMP_OS_NAME
)
def
TestOsList
():
"""
gnt-os list
"""
master
=
qa_config
.
GetMasterNode
()
cmd
=
[
'
gnt-os
'
,
'
list
'
]
AssertEqual
(
StartSSH
(
master
[
'
primary
'
],
utils
.
ShellQuoteArgs
(
cmd
)).
wait
(),
0
)
def
TestOsDiagnose
():
"""
gnt-os diagnose
"""
master
=
qa_config
.
GetMasterNode
()
cmd
=
[
'
gnt-os
'
,
'
diagnose
'
]
AssertEqual
(
StartSSH
(
master
[
'
primary
'
],
utils
.
ShellQuoteArgs
(
cmd
)).
wait
(),
0
)
def
_SetupTempOs
(
node
,
dir
,
valid
):
"""
Creates a temporary OS definition on the given node.
"""
sq
=
utils
.
ShellQuoteArgs
parts
=
[
sq
([
"
rm
"
,
"
-rf
"
,
dir
]),
sq
([
"
mkdir
"
,
"
-p
"
,
dir
]),
sq
([
"
cd
"
,
dir
]),
sq
([
"
ln
"
,
"
-fs
"
,
"
/bin/true
"
,
"
export
"
]),
sq
([
"
ln
"
,
"
-fs
"
,
"
/bin/true
"
,
"
import
"
]),
sq
([
"
ln
"
,
"
-fs
"
,
"
/bin/true
"
,
"
rename
"
])]
if
valid
:
parts
.
append
(
sq
([
"
ln
"
,
"
-fs
"
,
"
/bin/true
"
,
"
create
"
]))
parts
.
append
(
sq
([
"
echo
"
,
str
(
constants
.
OS_API_VERSION
)])
+
"
>ganeti_api_version
"
)
cmd
=
'
&&
'
.
join
(
parts
)
qa_utils
.
PrintInfo
(
"
Setting up %s with %s OS definition
"
%
(
node
[
"
primary
"
],
[
"
an invalid
"
,
"
a valid
"
][
int
(
valid
)]))
AssertEqual
(
StartSSH
(
node
[
'
primary
'
],
cmd
).
wait
(),
0
)
def
_RemoveTempOs
(
node
,
dir
):
"""
Removes a temporary OS definition.
"""
cmd
=
[
'
rm
'
,
'
-rf
'
,
dir
]
AssertEqual
(
StartSSH
(
node
[
'
primary
'
],
utils
.
ShellQuoteArgs
(
cmd
)).
wait
(),
0
)
def
_TestOs
(
mode
):
"""
Generic function for OS definition testing
"""
master
=
qa_config
.
GetMasterNode
()
dir
=
_TEMP_OS_PATH
nodes
=
[]
try
:
i
=
0
for
node
in
qa_config
.
get
(
'
nodes
'
):
nodes
.
append
(
node
)
if
mode
==
0
:
valid
=
False
elif
mode
==
1
:
valid
=
True
else
:
valid
=
bool
(
i
%
2
)
_SetupTempOs
(
node
,
dir
,
valid
)
i
+=
1
cmd
=
[
'
gnt-os
'
,
'
diagnose
'
]
result
=
StartSSH
(
master
[
'
primary
'
],
utils
.
ShellQuoteArgs
(
cmd
)).
wait
()
if
mode
==
1
:
AssertEqual
(
result
,
0
)
else
:
AssertEqual
(
result
,
1
)
finally
:
for
node
in
nodes
:
_RemoveTempOs
(
node
,
dir
)
def
TestOsValid
():
"""
Testing valid OS definition
"""
return
_TestOs
(
1
)
def
TestOsInvalid
():
"""
Testing invalid OS definition
"""
return
_TestOs
(
0
)
def
TestOsPartiallyValid
():
"""
Testing partially valid OS definition
"""
return
_TestOs
(
2
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment