[raas] Adding a decorator of api_wrapper
If we send a request to remote server, we need api_wrapper to restore enough info which includes requests' path and the type of request. Change-Id: Ia3add4e0827462b7e45062aa801ecb9a1a129d18
This commit is contained in:
parent
c8da1a60e0
commit
d83a7621dc
@ -15,11 +15,11 @@
|
||||
|
||||
import inspect
|
||||
import json
|
||||
import mock
|
||||
import os
|
||||
import re
|
||||
import traceback
|
||||
|
||||
import mock
|
||||
import yaml
|
||||
|
||||
import rally
|
||||
@ -57,7 +57,8 @@ class TaskSampleTestCase(test.TestCase):
|
||||
with open(full_path) as task_file:
|
||||
try:
|
||||
task_config = yaml.safe_load(
|
||||
self.rapi.task.render_template(task_file.read()))
|
||||
self.rapi.task.render_template(
|
||||
task_template=task_file.read()))
|
||||
eng = engine.TaskEngine(task_config,
|
||||
mock.MagicMock(), mock.Mock())
|
||||
eng.validate(only_syntax=True)
|
||||
@ -84,7 +85,7 @@ class TaskSampleTestCase(test.TestCase):
|
||||
with open(full_path) as task_file:
|
||||
try:
|
||||
json.loads(self.rapi.task.render_template(
|
||||
task_file.read()))
|
||||
task_template=task_file.read()))
|
||||
except Exception:
|
||||
print(traceback.format_exc())
|
||||
self.fail("Invalid JSON file: %s" % full_path)
|
||||
@ -125,10 +126,12 @@ class TaskSampleTestCase(test.TestCase):
|
||||
if os.path.exists(yaml_path) and os.path.exists(json_path):
|
||||
with open(json_path) as json_file:
|
||||
json_config = yaml.safe_load(
|
||||
self.rapi.task.render_template(json_file.read()))
|
||||
self.rapi.task.render_template(
|
||||
task_template=json_file.read()))
|
||||
with open(yaml_path) as yaml_file:
|
||||
yaml_config = yaml.safe_load(
|
||||
self.rapi.task.render_template(yaml_file.read()))
|
||||
self.rapi.task.render_template(
|
||||
task_template=yaml_file.read()))
|
||||
self.assertEqual(json_config, yaml_config,
|
||||
"Sample task configs are not equal:"
|
||||
"\n%s\n%s" % (yaml_path, json_path))
|
||||
|
@ -57,7 +57,8 @@ class RallyJobsTestCase(test.TestCase):
|
||||
"presenatation" % args_file)
|
||||
|
||||
task_inst = api._Task(api.API(skip_db_check=True))
|
||||
task = task_inst.render_template(task_file.read(), **args)
|
||||
task = task_inst.render_template(
|
||||
task_template=task_file.read(), **args)
|
||||
task = yaml.safe_load(task)
|
||||
|
||||
eng = engine.TaskEngine(task, mock.MagicMock(),
|
||||
|
Loading…
x
Reference in New Issue
Block a user