summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwenjuan dong <dong.wenjuan@zte.com.cn>2017-09-15 01:00:30 +0000
committerGerrit Code Review <gerrit@opnfv.org>2017-09-15 01:00:30 +0000
commit25759e0a0204765a7a9454d7586df66592e943c2 (patch)
tree0f94755b48a577d49d8d34708fb4ed43a553fef4
parent87da3b937f3130c49cc84608b49a1556fa3d2728 (diff)
parent44d1e135eced7afe13b8772a610ae5cdae310b68 (diff)
Merge "fix package path and move files under doctor_tests"
-rw-r--r--doctor_tests/alarm.py (renamed from tests/alarm.py)8
-rw-r--r--doctor_tests/common/__init__.py (renamed from tests/common/__init__.py)0
-rw-r--r--doctor_tests/common/constants.py (renamed from tests/common/constants.py)0
-rw-r--r--doctor_tests/common/utils.py (renamed from tests/common/utils.py)0
-rw-r--r--doctor_tests/config.py (renamed from tests/config.py)22
-rw-r--r--doctor_tests/consumer/__init__.py (renamed from tests/consumer/__init__.py)4
-rw-r--r--doctor_tests/consumer/base.py (renamed from tests/consumer/base.py)0
-rw-r--r--doctor_tests/consumer/sample.py (renamed from tests/consumer/sample.py)4
-rw-r--r--doctor_tests/identity_auth.py (renamed from tests/identity_auth.py)1
-rw-r--r--doctor_tests/image.py (renamed from tests/image.py)4
-rw-r--r--doctor_tests/inspector/__init__.py (renamed from tests/inspector/__init__.py)4
-rw-r--r--doctor_tests/inspector/base.py (renamed from tests/inspector/base.py)0
-rw-r--r--doctor_tests/inspector/congress.py (renamed from tests/inspector/congress.py)8
-rw-r--r--doctor_tests/inspector/sample.py (renamed from tests/inspector/sample.py)12
-rw-r--r--doctor_tests/installer/__init__.py (renamed from tests/installer/__init__.py)6
-rw-r--r--doctor_tests/installer/apex.py (renamed from tests/installer/apex.py)7
-rw-r--r--doctor_tests/installer/base.py (renamed from tests/installer/base.py)0
-rw-r--r--doctor_tests/installer/common/congress.py (renamed from tests/installer/common/congress.py)0
-rw-r--r--doctor_tests/installer/common/restore_ceilometer.py (renamed from tests/installer/common/restore_ceilometer.py)0
-rw-r--r--doctor_tests/installer/common/set_ceilometer.py (renamed from tests/installer/common/set_ceilometer.py)0
-rw-r--r--doctor_tests/installer/local.py (renamed from tests/installer/local.py)6
-rw-r--r--doctor_tests/instance.py (renamed from tests/instance.py)8
-rw-r--r--doctor_tests/logger.py (renamed from tests/logger.py)0
-rw-r--r--doctor_tests/main.py (renamed from tests/main.py)42
-rw-r--r--doctor_tests/monitor/__init__.py (renamed from tests/monitor/__init__.py)4
-rw-r--r--doctor_tests/monitor/base.py (renamed from tests/monitor/base.py)0
-rw-r--r--doctor_tests/monitor/collectd.py (renamed from tests/monitor/collectd.py)3
-rw-r--r--doctor_tests/monitor/sample.py (renamed from tests/monitor/sample.py)4
-rw-r--r--doctor_tests/network.py (renamed from tests/network.py)6
-rw-r--r--doctor_tests/os_clients.py (renamed from tests/os_clients.py)0
-rw-r--r--doctor_tests/profiler_poc.py (renamed from tests/profiler_poc.py)0
-rw-r--r--doctor_tests/scenario/__init__.py (renamed from tests/scenario/__init__.py)0
-rw-r--r--doctor_tests/scenario/common.py (renamed from tests/scenario/common.py)5
-rw-r--r--doctor_tests/scenario/network_failure.py (renamed from tests/scenario/network_failure.py)6
-rw-r--r--doctor_tests/user.py (renamed from tests/user.py)6
-rw-r--r--setup.cfg8
-rw-r--r--tests/inspector.py2
-rw-r--r--tox.ini2
38 files changed, 90 insertions, 92 deletions
diff --git a/tests/alarm.py b/doctor_tests/alarm.py
index 916f4405..3b1aaf3f 100644
--- a/tests/alarm.py
+++ b/doctor_tests/alarm.py
@@ -8,10 +8,10 @@
##############################################################################
from oslo_config import cfg
-from identity_auth import get_identity_auth
-from identity_auth import get_session
-from os_clients import aodh_client
-from os_clients import nova_client
+from doctor_tests.identity_auth import get_identity_auth
+from doctor_tests.identity_auth import get_session
+from doctor_tests.os_clients import aodh_client
+from doctor_tests.os_clients import nova_client
OPTS = [
cfg.StrOpt('alarm_basename',
diff --git a/tests/common/__init__.py b/doctor_tests/common/__init__.py
index e68a3070..e68a3070 100644
--- a/tests/common/__init__.py
+++ b/doctor_tests/common/__init__.py
diff --git a/tests/common/constants.py b/doctor_tests/common/constants.py
index 72d037af..72d037af 100644
--- a/tests/common/constants.py
+++ b/doctor_tests/common/constants.py
diff --git a/tests/common/utils.py b/doctor_tests/common/utils.py
index 2e823acb..2e823acb 100644
--- a/tests/common/utils.py
+++ b/doctor_tests/common/utils.py
diff --git a/tests/config.py b/doctor_tests/config.py
index c71d5ad7..273e84d5 100644
--- a/tests/config.py
+++ b/doctor_tests/config.py
@@ -10,17 +10,17 @@ import itertools
from oslo_config import cfg
-import alarm
-import consumer
-import image
-import instance
-import installer
-import network
-import inspector
-import monitor
-import os_clients
-import profiler_poc
-import user
+from doctor_tests import alarm
+from doctor_tests import consumer
+from doctor_tests import image
+from doctor_tests import instance
+from doctor_tests import installer
+from doctor_tests import network
+from doctor_tests import inspector
+from doctor_tests import monitor
+from doctor_tests import os_clients
+from doctor_tests import profiler_poc
+from doctor_tests import user
def list_opts():
diff --git a/tests/consumer/__init__.py b/doctor_tests/consumer/__init__.py
index ccec8644..2c66a547 100644
--- a/tests/consumer/__init__.py
+++ b/doctor_tests/consumer/__init__.py
@@ -28,10 +28,10 @@ OPTS = [
_consumer_name_class_mapping = {
- 'sample': 'consumer.sample.SampleConsumer'
+ 'sample': 'doctor_tests.consumer.sample.SampleConsumer'
}
def get_consumer(conf, log):
consumer_class = _consumer_name_class_mapping.get(conf.consumer.type)
- return importutils.import_object(consumer_class, conf, log) \ No newline at end of file
+ return importutils.import_object(consumer_class, conf, log)
diff --git a/tests/consumer/base.py b/doctor_tests/consumer/base.py
index 35170748..35170748 100644
--- a/tests/consumer/base.py
+++ b/doctor_tests/consumer/base.py
diff --git a/tests/consumer/sample.py b/doctor_tests/consumer/sample.py
index 20ad9d57..d76a764b 100644
--- a/tests/consumer/sample.py
+++ b/doctor_tests/consumer/sample.py
@@ -13,7 +13,7 @@ import time
from threading import Thread
import requests
-from consumer.base import BaseConsumer
+from doctor_tests.consumer.base import BaseConsumer
class SampleConsumer(BaseConsumer):
@@ -68,4 +68,4 @@ class ConsumerApp(Thread):
func()
return 'consumer app shutting down...'
- app.run(host="0.0.0.0", port=self.port) \ No newline at end of file
+ app.run(host="0.0.0.0", port=self.port)
diff --git a/tests/identity_auth.py b/doctor_tests/identity_auth.py
index c94893f4..2586720c 100644
--- a/tests/identity_auth.py
+++ b/doctor_tests/identity_auth.py
@@ -6,7 +6,6 @@
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
-
import os
from keystoneauth1 import loading
diff --git a/tests/image.py b/doctor_tests/image.py
index 453322b8..2e313e12 100644
--- a/tests/image.py
+++ b/doctor_tests/image.py
@@ -11,8 +11,8 @@ import urllib.request
from oslo_config import cfg
-from identity_auth import get_session
-from os_clients import glance_client
+from doctor_tests.identity_auth import get_session
+from doctor_tests.os_clients import glance_client
OPTS = [
cfg.StrOpt('image_name',
diff --git a/tests/inspector/__init__.py b/doctor_tests/inspector/__init__.py
index afba4800..3be79e57 100644
--- a/tests/inspector/__init__.py
+++ b/doctor_tests/inspector/__init__.py
@@ -30,8 +30,8 @@ OPTS = [
_inspector_name_class_mapping = {
- 'sample': 'inspector.sample.SampleInspector',
- 'congress': 'inspector.congress.CongressInspector',
+ 'sample': 'doctor_tests.inspector.sample.SampleInspector',
+ 'congress': 'doctor_tests.inspector.congress.CongressInspector',
}
diff --git a/tests/inspector/base.py b/doctor_tests/inspector/base.py
index 854f0695..854f0695 100644
--- a/tests/inspector/base.py
+++ b/doctor_tests/inspector/base.py
diff --git a/tests/inspector/congress.py b/doctor_tests/inspector/congress.py
index ae295852..c89a41bd 100644
--- a/tests/inspector/congress.py
+++ b/doctor_tests/inspector/congress.py
@@ -6,11 +6,11 @@
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
-from identity_auth import get_identity_auth
-from identity_auth import get_session
-from os_clients import congress_client
+from doctor_tests.identity_auth import get_identity_auth
+from doctor_tests.identity_auth import get_session
+from doctor_tests.os_clients import congress_client
-from inspector.base import BaseInspector
+from doctor_tests.inspector.base import BaseInspector
class CongressInspector(BaseInspector):
diff --git a/tests/inspector/sample.py b/doctor_tests/inspector/sample.py
index 1c05cede..114e4ebd 100644
--- a/tests/inspector/sample.py
+++ b/doctor_tests/inspector/sample.py
@@ -14,12 +14,12 @@ import time
from threading import Thread
import requests
-from common import utils
-from identity_auth import get_identity_auth
-from identity_auth import get_session
-from os_clients import nova_client
-from os_clients import neutron_client
-from inspector.base import BaseInspector
+from doctor_tests.common import utils
+from doctor_tests.identity_auth import get_identity_auth
+from doctor_tests.identity_auth import get_session
+from doctor_tests.os_clients import nova_client
+from doctor_tests.os_clients import neutron_client
+from doctor_tests.inspector.base import BaseInspector
class SampleInspector(BaseInspector):
diff --git a/tests/installer/__init__.py b/doctor_tests/installer/__init__.py
index bb0e452d..02735b11 100644
--- a/tests/installer/__init__.py
+++ b/doctor_tests/installer/__init__.py
@@ -28,11 +28,11 @@ OPTS = [
_installer_name_class_mapping = {
- 'local': 'installer.local.LocalInstaller',
- 'apex': 'installer.apex.ApexInstaller'
+ 'local': 'doctor_tests.installer.local.LocalInstaller',
+ 'apex': 'doctor_tests.installer.apex.ApexInstaller'
}
def get_installer(conf, log):
installer_class = _installer_name_class_mapping[conf.installer.type]
- return importutils.import_object(installer_class, conf, log) \ No newline at end of file
+ return importutils.import_object(installer_class, conf, log)
diff --git a/tests/installer/apex.py b/doctor_tests/installer/apex.py
index 98eb6c9c..2a1ce94b 100644
--- a/tests/installer/apex.py
+++ b/doctor_tests/installer/apex.py
@@ -12,10 +12,9 @@ import os
import pwd
import stat
import subprocess
-import sys
-from common.utils import SSHClient
-from installer.base import BaseInstaller
+from doctor_tests.common.utils import SSHClient
+from doctor_tests.installer.base import BaseInstaller
class ApexInstaller(BaseInstaller):
@@ -59,7 +58,7 @@ class ApexInstaller(BaseInstaller):
gid = grp.getgrnam(user).gr_gid
os.chown('./instack_key', uid, gid)
os.chmod('./instack_key', stat.S_IREAD)
- current_dir = sys.path[0]
+ current_dir = os.curdir
self.key_file = '{0}/{1}'.format(current_dir, 'instack_key')
return self.key_file
diff --git a/tests/installer/base.py b/doctor_tests/installer/base.py
index fa39816a..fa39816a 100644
--- a/tests/installer/base.py
+++ b/doctor_tests/installer/base.py
diff --git a/tests/installer/common/congress.py b/doctor_tests/installer/common/congress.py
index db882de2..db882de2 100644
--- a/tests/installer/common/congress.py
+++ b/doctor_tests/installer/common/congress.py
diff --git a/tests/installer/common/restore_ceilometer.py b/doctor_tests/installer/common/restore_ceilometer.py
index d25b9ede..d25b9ede 100644
--- a/tests/installer/common/restore_ceilometer.py
+++ b/doctor_tests/installer/common/restore_ceilometer.py
diff --git a/tests/installer/common/set_ceilometer.py b/doctor_tests/installer/common/set_ceilometer.py
index f5946cb2..f5946cb2 100644
--- a/tests/installer/common/set_ceilometer.py
+++ b/doctor_tests/installer/common/set_ceilometer.py
diff --git a/tests/installer/local.py b/doctor_tests/installer/local.py
index dcdf41e3..7d0ae542 100644
--- a/tests/installer/local.py
+++ b/doctor_tests/installer/local.py
@@ -10,9 +10,9 @@ import os
import shutil
import subprocess
-from installer.base import BaseInstaller
-from common.utils import load_json_file
-from common.utils import write_json_file
+from doctor_tests.installer.base import BaseInstaller
+from doctor_tests.common.utils import load_json_file
+from doctor_tests.common.utils import write_json_file
class LocalInstaller(BaseInstaller):
diff --git a/tests/instance.py b/doctor_tests/instance.py
index c6acbc3d..27f412e2 100644
--- a/tests/instance.py
+++ b/doctor_tests/instance.py
@@ -11,10 +11,10 @@ import time
from oslo_config import cfg
-from identity_auth import get_identity_auth
-from identity_auth import get_session
-from os_clients import neutron_client
-from os_clients import nova_client
+from doctor_tests.identity_auth import get_identity_auth
+from doctor_tests.identity_auth import get_session
+from doctor_tests.os_clients import neutron_client
+from doctor_tests.os_clients import nova_client
OPTS = [
cfg.StrOpt('flavor',
diff --git a/tests/logger.py b/doctor_tests/logger.py
index b7a49fdb..b7a49fdb 100644
--- a/tests/logger.py
+++ b/doctor_tests/logger.py
diff --git a/tests/main.py b/doctor_tests/main.py
index edff16f2..006aac9f 100644
--- a/tests/main.py
+++ b/doctor_tests/main.py
@@ -12,25 +12,25 @@ import random
import sys
import time
-from alarm import Alarm
-from common.constants import Host
-from common.utils import match_rep_in_file
-import config
-from consumer import get_consumer
-from identity_auth import get_identity_auth
-from identity_auth import get_session
-from image import Image
-from instance import Instance
-from inspector import get_inspector
-from installer import get_installer
-import logger as doctor_log
-from network import Network
-from monitor import get_monitor
-from os_clients import nova_client
-from profiler_poc import main as profiler_main
-from scenario.common import calculate_notification_time
-from scenario.network_failure import NetworkFault
-from user import User
+from doctor_tests.alarm import Alarm
+from doctor_tests.common.constants import Host
+from doctor_tests.common.utils import match_rep_in_file
+from doctor_tests import config
+from doctor_tests.consumer import get_consumer
+from doctor_tests.identity_auth import get_identity_auth
+from doctor_tests.identity_auth import get_session
+from doctor_tests.image import Image
+from doctor_tests.instance import Instance
+from doctor_tests.inspector import get_inspector
+from doctor_tests.installer import get_installer
+import doctor_tests.logger as doctor_log
+from doctor_tests.network import Network
+from doctor_tests.monitor import get_monitor
+from doctor_tests.os_clients import nova_client
+from doctor_tests.profiler_poc import main as profiler_main
+from doctor_tests.scenario.common import calculate_notification_time
+from doctor_tests.scenario.network_failure import NetworkFault
+from doctor_tests.user import User
LOG = doctor_log.Logger('doctor').getLogger()
@@ -201,7 +201,9 @@ class DoctorTest(object):
def main():
"""doctor main"""
- doctor_root_dir = os.path.dirname(sys.path[0])
+ test_dir = os.path.split(os.path.realpath(__file__))[0]
+ doctor_root_dir = os.path.dirname(test_dir)
+
config_file_dir = '{0}/{1}'.format(doctor_root_dir, 'etc/')
config_files = [join(config_file_dir, f) for f in os.listdir(config_file_dir)
if isfile(join(config_file_dir, f))]
diff --git a/tests/monitor/__init__.py b/doctor_tests/monitor/__init__.py
index e268907f..7e30c9f8 100644
--- a/tests/monitor/__init__.py
+++ b/doctor_tests/monitor/__init__.py
@@ -19,8 +19,8 @@ OPTS = [
_monitor_name_class_mapping = {
- 'sample': 'monitor.sample.SampleMonitor',
- 'collectd': 'monitor.collectd.CollectdMonitor'
+ 'sample': 'doctor_tests.monitor.sample.SampleMonitor',
+ 'collectd': 'doctor_tests.monitor.collectd.CollectdMonitor'
}
def get_monitor(conf, inspector_url, log):
diff --git a/tests/monitor/base.py b/doctor_tests/monitor/base.py
index 119c8a1c..119c8a1c 100644
--- a/tests/monitor/base.py
+++ b/doctor_tests/monitor/base.py
diff --git a/tests/monitor/collectd.py b/doctor_tests/monitor/collectd.py
index e2a800ea..a22d7edc 100644
--- a/tests/monitor/collectd.py
+++ b/doctor_tests/monitor/collectd.py
@@ -6,13 +6,12 @@
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
-
import os
import socket
import getpass
import sys
-from monitor.base import BaseMonitor
+from doctor_tests.monitor.base import BaseMonitor
class CollectdMonitor(BaseMonitor):
diff --git a/tests/monitor/sample.py b/doctor_tests/monitor/sample.py
index 9ac1bccf..7a463048 100644
--- a/tests/monitor/sample.py
+++ b/doctor_tests/monitor/sample.py
@@ -13,8 +13,8 @@ import socket
from threading import Thread
import time
-from identity_auth import get_session
-from monitor.base import BaseMonitor
+from doctor_tests.identity_auth import get_session
+from doctor_tests.monitor.base import BaseMonitor
class SampleMonitor(BaseMonitor):
diff --git a/tests/network.py b/doctor_tests/network.py
index da7ad09d..ee153e66 100644
--- a/tests/network.py
+++ b/doctor_tests/network.py
@@ -8,9 +8,9 @@
##############################################################################
from oslo_config import cfg
-from identity_auth import get_identity_auth
-from identity_auth import get_session
-from os_clients import neutron_client
+from doctor_tests.identity_auth import get_identity_auth
+from doctor_tests.identity_auth import get_session
+from doctor_tests.os_clients import neutron_client
OPTS = [
diff --git a/tests/os_clients.py b/doctor_tests/os_clients.py
index 44fa3aad..44fa3aad 100644
--- a/tests/os_clients.py
+++ b/doctor_tests/os_clients.py
diff --git a/tests/profiler_poc.py b/doctor_tests/profiler_poc.py
index ea36eaeb..ea36eaeb 100644
--- a/tests/profiler_poc.py
+++ b/doctor_tests/profiler_poc.py
diff --git a/tests/scenario/__init__.py b/doctor_tests/scenario/__init__.py
index 48893ae6..48893ae6 100644
--- a/tests/scenario/__init__.py
+++ b/doctor_tests/scenario/__init__.py
diff --git a/tests/scenario/common.py b/doctor_tests/scenario/common.py
index a33c50ff..a5cbe483 100644
--- a/tests/scenario/common.py
+++ b/doctor_tests/scenario/common.py
@@ -7,7 +7,8 @@
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
import sys
-from common.utils import match_rep_in_file
+
+from doctor_tests.common.utils import match_rep_in_file
def calculate_notification_time():
@@ -25,4 +26,4 @@ def calculate_notification_time():
raise Exception('Can not match notified time')
notified = result.group(0)
- return float(notified) - float(detected) \ No newline at end of file
+ return float(notified) - float(detected)
diff --git a/tests/scenario/network_failure.py b/doctor_tests/scenario/network_failure.py
index e9a239db..b94a622d 100644
--- a/tests/scenario/network_failure.py
+++ b/doctor_tests/scenario/network_failure.py
@@ -6,9 +6,9 @@
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
-from identity_auth import get_session
-from os_clients import nova_client
-from common.utils import SSHClient
+from doctor_tests.identity_auth import get_session
+from doctor_tests.os_clients import nova_client
+from doctor_tests.common.utils import SSHClient
LINK_DOWN_SCRIPT = """
#!/bin/bash -x
diff --git a/tests/user.py b/doctor_tests/user.py
index b21bd1a8..33f995e7 100644
--- a/tests/user.py
+++ b/doctor_tests/user.py
@@ -10,9 +10,9 @@ import os
from oslo_config import cfg
-from identity_auth import get_session
-from os_clients import keystone_client
-from os_clients import nova_client
+from doctor_tests.identity_auth import get_session
+from doctor_tests.os_clients import keystone_client
+from doctor_tests.os_clients import nova_client
OPTS = [
diff --git a/setup.cfg b/setup.cfg
index d294cf38..a9e8144c 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -1,13 +1,11 @@
[metadata]
-name = doctor-test
+name = doctor-tests
version = 2017.9.0
home-page = https://wiki.opnfv.org/display/doctor/Doctor+Home
[files]
-packages = tests
-scripts =
- tests/run.sh
+packages = doctor_tests
[entry_points]
console_scripts =
- doctor-test = tests.main:main
+ doctor-test = doctor_tests.main:main
diff --git a/tests/inspector.py b/tests/inspector.py
index 82ffc338..0046b999 100644
--- a/tests/inspector.py
+++ b/tests/inspector.py
@@ -19,7 +19,7 @@ import time
from keystoneauth1 import session
import novaclient.client as novaclient
-import identity_auth
+import doctor_tests.identity_auth
LOG = doctor_log.Logger('doctor_inspector').getLogger()
diff --git a/tox.ini b/tox.ini
index c8cebe8b..748241e7 100644
--- a/tox.ini
+++ b/tox.ini
@@ -26,5 +26,5 @@ passenv =
INSTALLER_TYPE
INSTALLER_IP
PROFILER_TYPE
-changedir = {toxinidir}/tests
+changedir = {toxinidir}/doctor_tests
commands = doctor-test