2015-03-02 18:27:36 +03:00
|
|
|
# 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
|
|
|
|
|
2015-03-11 16:57:10 +03:00
|
|
|
from shaker.engine.executors import netperf
|
2015-03-02 18:27:36 +03:00
|
|
|
|
|
|
|
|
|
|
|
IP = '10.0.0.10'
|
|
|
|
AGENT = {'slave': {'ip': IP}}
|
|
|
|
|
|
|
|
|
|
|
|
class TestNetperfExecutor(testtools.TestCase):
|
|
|
|
|
|
|
|
def test_get_command(self):
|
2015-03-11 16:57:10 +03:00
|
|
|
executor = netperf.NetperfExecutor({}, AGENT)
|
2015-03-02 18:27:36 +03:00
|
|
|
|
2015-03-19 19:35:40 +03:00
|
|
|
expected = {'data': ('netperf -H %s -l 60 -t TCP_STREAM') % IP,
|
|
|
|
'type': 'program'}
|
2015-03-02 18:27:36 +03:00
|
|
|
self.assertEqual(expected, executor.get_command())
|
|
|
|
|
|
|
|
def test_get_command_options(self):
|
2015-03-11 16:57:10 +03:00
|
|
|
executor = netperf.NetperfExecutor(
|
2015-03-02 18:27:36 +03:00
|
|
|
{'method': 'UDP_STREAM', 'time': 30}, AGENT)
|
|
|
|
|
2015-03-19 19:35:40 +03:00
|
|
|
expected = {'data': ('netperf -H %s -l 30 -t UDP_STREAM') % IP,
|
|
|
|
'type': 'program'}
|
2015-03-02 18:27:36 +03:00
|
|
|
self.assertEqual(expected, executor.get_command())
|