'File exists' validator and Utils class for validators
Change-Id: I43451ae5a79618cd7d8b60a98e9904052b242276
This commit is contained in:
parent
80bbdeb5d6
commit
c4026b3ec4
@ -67,7 +67,7 @@
|
||||
MuranoPackages.import_and_list_packages:
|
||||
-
|
||||
args:
|
||||
package: "/home/jenkins/.rally/extra/murano/applications/HelloReporter/io.murano.apps.HelloReporter/"
|
||||
package: "~/.rally/extra/murano/applications/HelloReporter/io.murano.apps.HelloReporter/"
|
||||
runner:
|
||||
type: "constant"
|
||||
times: 10
|
||||
@ -81,7 +81,7 @@
|
||||
max: 0
|
||||
-
|
||||
args:
|
||||
package: "/home/jenkins/.rally/extra/murano/applications/HelloReporter/io.murano.apps.HelloReporter.zip"
|
||||
package: "~/.rally/extra/murano/applications/HelloReporter/io.murano.apps.HelloReporter.zip"
|
||||
runner:
|
||||
type: "constant"
|
||||
times: 1
|
||||
@ -97,7 +97,7 @@
|
||||
MuranoPackages.import_and_delete_package:
|
||||
-
|
||||
args:
|
||||
package: "/home/jenkins/.rally/extra/murano/applications/HelloReporter/io.murano.apps.HelloReporter/"
|
||||
package: "~/.rally/extra/murano/applications/HelloReporter/io.murano.apps.HelloReporter/"
|
||||
runner:
|
||||
type: "constant"
|
||||
times: 10
|
||||
@ -113,7 +113,7 @@
|
||||
MuranoPackages.import_and_filter_applications:
|
||||
-
|
||||
args:
|
||||
package: "/home/jenkins/.rally/extra/murano/applications/HelloReporter/io.murano.apps.HelloReporter/"
|
||||
package: "~/.rally/extra/murano/applications/HelloReporter/io.murano.apps.HelloReporter/"
|
||||
filter_query: {"category" : "Web"}
|
||||
runner:
|
||||
type: "constant"
|
||||
@ -130,7 +130,7 @@
|
||||
MuranoPackages.package_lifecycle:
|
||||
-
|
||||
args:
|
||||
package: "/home/jenkins/.rally/extra/murano/applications/HelloReporter/io.murano.apps.HelloReporter/"
|
||||
package: "~/.rally/extra/murano/applications/HelloReporter/io.murano.apps.HelloReporter/"
|
||||
body: {"categories": ["Web"]}
|
||||
operation: "add"
|
||||
runner:
|
||||
|
@ -737,7 +737,7 @@
|
||||
context:
|
||||
image_command_customizer:
|
||||
command:
|
||||
local_path: "/home/jenkins/.rally/extra/install_benchmark.sh"
|
||||
local_path: "~/.rally/extra/install_benchmark.sh"
|
||||
remote_path: "./install_benchmark.sh"
|
||||
flavor:
|
||||
name: "m1.tiny"
|
||||
|
@ -255,7 +255,7 @@
|
||||
hooks:
|
||||
- name: sys_call
|
||||
description: Run script
|
||||
args: sh /home/jenkins/.rally/extra/hook_example_script.sh
|
||||
args: sh ~/.rally/extra/hook_example_script.sh
|
||||
trigger:
|
||||
name: event
|
||||
args:
|
||||
|
@ -13,7 +13,6 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
|
||||
from oslo_config import cfg
|
||||
import requests
|
||||
|
||||
|
@ -51,7 +51,7 @@ class ListExecutions(utils.MistralScenario):
|
||||
sort_keys=sort_keys, sort_dirs=sort_dirs)
|
||||
|
||||
|
||||
@validation.file_exists("definition")
|
||||
@validation.add("file_exists", param_name="definition")
|
||||
@types.convert(definition={"type": "file"})
|
||||
@types.convert(params={"type": "file"})
|
||||
@types.convert(wf_input={"type": "file"})
|
||||
|
@ -38,7 +38,7 @@ class ListWorkbooks(utils.MistralScenario):
|
||||
self._list_workbooks()
|
||||
|
||||
|
||||
@validation.file_exists("definition")
|
||||
@validation.add("file_exists", param_name="definition")
|
||||
@types.convert(definition={"type": "file"})
|
||||
@validation.add("required_platform", platform="openstack", users=True)
|
||||
@validation.add("required_services",
|
||||
|
@ -25,7 +25,7 @@ from rally.task import validation
|
||||
"""Scenarios for Murano packages."""
|
||||
|
||||
|
||||
@validation.file_exists(param_name="package", mode=os.F_OK)
|
||||
@validation.add("file_exists", param_name="package", mode=os.F_OK)
|
||||
@validation.add("required_services", services=[consts.Service.MURANO])
|
||||
@validation.add("required_platform", platform="openstack", users=True)
|
||||
@scenario.configure(context={"cleanup": ["murano.packages"]},
|
||||
@ -55,7 +55,7 @@ class ImportAndListPackages(utils.MuranoScenario):
|
||||
os.remove(package_path)
|
||||
|
||||
|
||||
@validation.file_exists(param_name="package", mode=os.F_OK)
|
||||
@validation.add("file_exists", param_name="package", mode=os.F_OK)
|
||||
@validation.add("required_services", services=[consts.Service.MURANO])
|
||||
@validation.add("required_platform", platform="openstack", users=True)
|
||||
@scenario.configure(context={"cleanup": ["murano.packages"]},
|
||||
@ -82,7 +82,7 @@ class ImportAndDeletePackage(utils.MuranoScenario):
|
||||
os.remove(package_path)
|
||||
|
||||
|
||||
@validation.file_exists(param_name="package", mode=os.F_OK)
|
||||
@validation.add("file_exists", param_name="package", mode=os.F_OK)
|
||||
@validation.add("required_services", services=[consts.Service.MURANO])
|
||||
@validation.add("required_platform", platform="openstack", users=True)
|
||||
@scenario.configure(context={"cleanup": ["murano.packages"]},
|
||||
@ -118,7 +118,7 @@ class PackageLifecycle(utils.MuranoScenario):
|
||||
os.remove(package_path)
|
||||
|
||||
|
||||
@validation.file_exists(param_name="package", mode=os.F_OK)
|
||||
@validation.add("file_exists", param_name="package", mode=os.F_OK)
|
||||
@validation.add("required_services", services=[consts.Service.MURANO])
|
||||
@validation.add("required_platform", platform="openstack", users=True)
|
||||
@scenario.configure(context={"cleanup": ["murano.packages"]},
|
||||
|
@ -124,8 +124,9 @@ class VMScenario(nova_utils.NovaScenario):
|
||||
"or list type")
|
||||
cmd.extend(remote_path)
|
||||
if command.get("local_path"):
|
||||
ssh.put_file(command["local_path"], remote_path[-1],
|
||||
mode=self.USER_RWX_OTHERS_RX_ACCESS_MODE)
|
||||
ssh.put_file(os.path.expanduser(
|
||||
command["local_path"]), remote_path[-1],
|
||||
mode=self.USER_RWX_OTHERS_RX_ACCESS_MODE)
|
||||
|
||||
if command.get("script_file"):
|
||||
stdin = open(os.path.expanduser(command["script_file"]), "rb")
|
||||
|
@ -13,6 +13,8 @@
|
||||
# under the License.
|
||||
|
||||
import os
|
||||
import shutil
|
||||
import tempfile
|
||||
import traceback
|
||||
|
||||
import mock
|
||||
@ -30,6 +32,22 @@ class RallyJobsTestCase(test.TestCase):
|
||||
rally_jobs_path = os.path.join(
|
||||
os.path.dirname(rally.__file__), "..", "rally-jobs")
|
||||
|
||||
def setUp(self):
|
||||
super(RallyJobsTestCase, self).setUp()
|
||||
self.tmp_dir = tempfile.mkdtemp()
|
||||
os.makedirs(os.path.join(self.tmp_dir, ".rally"))
|
||||
shutil.copytree(os.path.join(self.rally_jobs_path, "extra"),
|
||||
os.path.join(self.tmp_dir, ".rally", "extra"))
|
||||
|
||||
self.original_home = os.environ["HOME"]
|
||||
os.environ["HOME"] = self.tmp_dir
|
||||
|
||||
def return_home():
|
||||
os.environ["HOME"] = self.original_home
|
||||
self.addCleanup(shutil.rmtree, self.tmp_dir)
|
||||
|
||||
self.addCleanup(return_home)
|
||||
|
||||
def test_schema_is_valid(self):
|
||||
discover.load_plugins(os.path.join(self.rally_jobs_path, "plugins"))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user