Skip to content

Commit

Permalink
Fix unit test error
Browse files Browse the repository at this point in the history
  • Loading branch information
changzhi1990 committed Jan 15, 2016
1 parent 934b7bd commit 9f32be8
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 4 deletions.
4 changes: 2 additions & 2 deletions stetho/agent/drivers/iperf.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ def start_client(self, host, port=5001, protocol='TCP', timeout=5,
out_dict.pop()
out_data = out_dict[-1].split()
data = dict()
data['Bandwidth'] = out_data[-2] + out_data[-1]
data['Transfer'] = out_data[-4] + out_data[-3]
data['Bandwidth'] = out_data[-2] + ' ' + out_data[-1]
data['Transfer'] = out_data[-4] + ' ' + out_data[-3]
data['Interval'] = out_data[-6]
return data
raise Exception('Start iperf failed, please check on the node.')
11 changes: 10 additions & 1 deletion stetho/stethoclient/agent_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
from cliff.command import Command
from cliff.lister import Lister
from json import JSONDecoder
from stetho.stethoclient.constants import AGENT_INFOS

LISTEN_PORT = 9698
SETUP_LINK_IP_PRE = "192.168.100."
Expand All @@ -48,6 +47,16 @@ def log_fail(info):
print Logger.FAIL + info + Logger.ENDC


try:
from stetho.stethoclient.constants import AGENT_INFOS
except:
AGENT_INFOS = {
'agent-64': "127.0.0.1",
'agent-65': "127.0.0.1",
}
Logger.log_fail("Import stetho configure file fail. Use fake data!")


def setup_server(agent):
log = logging.getLogger(__name__)
if agent in AGENT_INFOS:
Expand Down
10 changes: 9 additions & 1 deletion stetho/stethoclient/drivers/iperf_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import sys

from cliff.lister import Lister
from stetho.stethoclient.constants import AGENT_INFOS

LISTEN_PORT = 9698

Expand All @@ -45,6 +44,15 @@ def log_high(info):
def log_fail(info):
print Logger.FAIL + info + Logger.ENDC

try:
from stetho.stethoclient.constants import AGENT_INFOS
except:
AGENT_INFOS = {
'agent-64': "127.0.0.1",
'agent-65': "127.0.0.1",
}
Logger.log_fail("Import stetho configure file fail. Use fake data!")


def setup_server(agent):
log = logging.getLogger(__name__)
Expand Down

0 comments on commit 9f32be8

Please sign in to comment.