Merge "Add functional test for task samples"

This commit is contained in:
Jenkins 2015-05-20 22:58:36 +00:00 committed by Gerrit Code Review
commit 5c7c18b89f
7 changed files with 63 additions and 8 deletions

View File

@ -11,7 +11,7 @@
"name": "m1.tiny" "name": "m1.tiny"
}, },
"image": { "image": {
"name": "cirros-0.3.2-x86_64-uec" "name": "^cirros.*uec$"
} }
}, },
"context": { "context": {

View File

@ -5,7 +5,7 @@
flavor: flavor:
name: "m1.tiny" name: "m1.tiny"
image: image:
name: "cirros-0.3.2-x86_64-uec" name: "^cirros.*uec$"
runner: runner:
type: "constant" type: "constant"
times: 1 times: 1

View File

@ -6,10 +6,10 @@
"name": "m1.tiny" "name": "m1.tiny"
}, },
"from_image": { "from_image": {
"name": "cirros-0.3.2-x86_64-uec" "name": "^cirros.*uec$"
}, },
"to_image": { "to_image": {
"name": "cirros-0.3.2-x86_64-uec" "name": "^cirros.*uec$"
} }
}, },
"runner": { "runner": {

View File

@ -4,9 +4,9 @@ NovaServers.boot_and_rebuild_server:
flavor: flavor:
name: "m1.tiny" name: "m1.tiny"
from_image: from_image:
name: "cirros-0.3.2-x86_64-uec" name: "^cirros.*uec$"
to_image: to_image:
name: "cirros-0.3.2-x86_64-uec" name: "^cirros.*uec$"
runner: runner:
type: constant type: constant
times: 5 times: 5

View File

@ -6,7 +6,7 @@
"name": "m1.tiny" "name": "m1.tiny"
}, },
"image": { "image": {
"name": "cirros-0.3.2-x86_64-uec" "name": "^cirros.*uec$"
} }
}, },
"runner": { "runner": {

View File

@ -5,7 +5,7 @@
flavor: flavor:
name: "m1.tiny" name: "m1.tiny"
image: image:
name: "cirros-0.3.2-x86_64-uec" name: "^cirros.*uec$"
runner: runner:
type: "constant" type: "constant"
times: 10 times: 10

View File

@ -0,0 +1,55 @@
# Copyright 2014: Mirantis Inc.
# Copyright 2014: Catalyst IT Ltd.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import os
import re
import traceback
import unittest
from tests.functional import utils
class TestTaskSamples(unittest.TestCase):
def test_task_samples_is_valid(self):
rally = utils.Rally()
samples_path = os.path.join(
os.path.dirname(__file__), os.pardir, os.pardir,
"samples", "tasks")
matcher = re.compile("\.json$")
for dirname, dirnames, filenames in os.walk(samples_path):
# NOTE(rvasilets): Skip by suggest of boris-42 because in
# future we don't what to maintain this dir
if dirname.find("tempest-do-not-run-against-production") != -1:
continue
for filename in filenames:
full_path = os.path.join(dirname, filename)
# NOTE(hughsaunders): Skip non config files
# (bug https://bugs.launchpad.net/rally/+bug/1314369)
if not matcher.search(filename):
continue
try:
rally("task validate --task %s" % full_path)
except utils.RallyCmdError as e:
if re.search(
"[Ss]ervice is not available", e.output) is None:
raise e
except Exception:
print(traceback.format_exc())
self.assertTrue(False,
"Wrong task config %s" % full_path)