diff --git a/rally-jobs/rally-murano.yaml b/rally-jobs/rally-murano.yaml index aa554f98..d346b790 100644 --- a/rally-jobs/rally-murano.yaml +++ b/rally-jobs/rally-murano.yaml @@ -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: diff --git a/rally-jobs/rally-neutron.yaml b/rally-jobs/rally-neutron.yaml index c5cc14f7..848f7f95 100644 --- a/rally-jobs/rally-neutron.yaml +++ b/rally-jobs/rally-neutron.yaml @@ -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" diff --git a/rally-jobs/self-rally.yaml b/rally-jobs/self-rally.yaml index db7ddccc..ca7cbb02 100644 --- a/rally-jobs/self-rally.yaml +++ b/rally-jobs/self-rally.yaml @@ -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: diff --git a/rally/plugins/openstack/scenarios/heat/utils.py b/rally/plugins/openstack/scenarios/heat/utils.py index d23258d2..c6c4ce75 100644 --- a/rally/plugins/openstack/scenarios/heat/utils.py +++ b/rally/plugins/openstack/scenarios/heat/utils.py @@ -13,7 +13,6 @@ # License for the specific language governing permissions and limitations # under the License. - from oslo_config import cfg import requests diff --git a/rally/plugins/openstack/scenarios/mistral/executions.py b/rally/plugins/openstack/scenarios/mistral/executions.py index 50802a1f..105f4a99 100644 --- a/rally/plugins/openstack/scenarios/mistral/executions.py +++ b/rally/plugins/openstack/scenarios/mistral/executions.py @@ -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"}) diff --git a/rally/plugins/openstack/scenarios/mistral/workbooks.py b/rally/plugins/openstack/scenarios/mistral/workbooks.py index 6e38da0c..a52992ea 100644 --- a/rally/plugins/openstack/scenarios/mistral/workbooks.py +++ b/rally/plugins/openstack/scenarios/mistral/workbooks.py @@ -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", diff --git a/rally/plugins/openstack/scenarios/murano/packages.py b/rally/plugins/openstack/scenarios/murano/packages.py index 20bf9f8d..99c8e63c 100644 --- a/rally/plugins/openstack/scenarios/murano/packages.py +++ b/rally/plugins/openstack/scenarios/murano/packages.py @@ -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"]}, diff --git a/rally/plugins/openstack/scenarios/vm/utils.py b/rally/plugins/openstack/scenarios/vm/utils.py index ad41409f..7895a6b8 100644 --- a/rally/plugins/openstack/scenarios/vm/utils.py +++ b/rally/plugins/openstack/scenarios/vm/utils.py @@ -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") diff --git a/tests/unit/rally_jobs/test_jobs.py b/tests/unit/rally_jobs/test_jobs.py index 665d8b9e..5245406c 100644 --- a/tests/unit/rally_jobs/test_jobs.py +++ b/tests/unit/rally_jobs/test_jobs.py @@ -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"))