aboutsummaryrefslogtreecommitdiffstats
path: root/tests/unit/benchmark/contexts/test_model.py
diff options
context:
space:
mode:
authorRoss Brattain <ross.b.brattain@intel.com>2017-03-15 19:46:19 -0700
committerRoss Brattain <ross.b.brattain@intel.com>2017-03-15 19:51:14 -0700
commit30e247e585969b29b5a504c0b6bbd23d07ea80c8 (patch)
tree8c54f82b08be637d2d05d92c779f48af5d9dc862 /tests/unit/benchmark/contexts/test_model.py
parent146c04bd06378fdee926799373fb12f56822b356 (diff)
pass user_data to heat template
We had code to support adding user_data but the Server model was not connected. The string formatting of the user_data is left as an exercise for the reader. Change-Id: I298657b93de67e19436bca616b119df636dacce2 Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
Diffstat (limited to 'tests/unit/benchmark/contexts/test_model.py')
-rw-r--r--tests/unit/benchmark/contexts/test_model.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/unit/benchmark/contexts/test_model.py b/tests/unit/benchmark/contexts/test_model.py
index a4b7d81ef..a8314aef4 100644
--- a/tests/unit/benchmark/contexts/test_model.py
+++ b/tests/unit/benchmark/contexts/test_model.py
@@ -230,4 +230,25 @@ class ServerTestCase(unittest.TestCase):
ports=['some-server-some-network-port'],
user=self.mock_context.user,
key_name=self.mock_context.keypair_name,
+ user_data='',
+ scheduler_hints='hints')
+
+ @mock.patch('yardstick.benchmark.contexts.heat.HeatTemplate')
+ def test__add_instance_with_user_data(self, mock_template):
+ user_data = "USER_DATA"
+ attrs = {
+ 'image': 'some-image', 'flavor': 'some-flavor',
+ 'user_data': user_data,
+ }
+ test_server = model.Server('foo', self.mock_context, attrs)
+
+ test_server._add_instance(mock_template, 'some-server',
+ [], 'hints')
+
+ mock_template.add_server.assert_called_with(
+ 'some-server', 'some-image', 'some-flavor',
+ ports=[],
+ user=self.mock_context.user,
+ key_name=self.mock_context.keypair_name,
+ user_data=user_data,
scheduler_hints='hints')