shaker/tests/test_netperf_executor.py
Ilya Shakhat a37b9ed228 Refactor executors build command lines
Change-Id: I968148ce232607801e628ee0b4c2810b9eb3d9af
2015-03-02 18:27:36 +03:00

39 lines
1.2 KiB
Python

# Copyright (c) 2015 Mirantis Inc.
#
# 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 testtools
from shaker.engine import executors
IP = '10.0.0.10'
AGENT = {'slave': {'ip': IP}}
class TestNetperfExecutor(testtools.TestCase):
def test_get_command(self):
executor = executors.NetperfExecutor({}, AGENT)
expected = 'netperf -H %s -l 60 -t TCP_STREAM' % IP
self.assertEqual(expected, executor.get_command())
def test_get_command_options(self):
executor = executors.NetperfExecutor(
{'method': 'UDP_STREAM', 'time': 30}, AGENT)
expected = 'netperf -H %s -l 30 -t UDP_STREAM' % IP
self.assertEqual(expected, executor.get_command())