Replace tests.base part8
It is the last step to replace using openstack.common.test. In this patch is changed for using openstack.common.test and added needed fixtures in test classes. Cleaning base.py and deleted TestCase class. Change-Id: If4b5992de70fb01cf29363243fb7e50196653fff
This commit is contained in:
parent
5c7e3e1e3f
commit
537c60badd
@ -18,55 +18,12 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
"""Test base classes.
|
"""Test base classes.
|
||||||
"""
|
"""
|
||||||
import fixtures
|
|
||||||
import functools
|
import functools
|
||||||
from oslo.config import cfg
|
|
||||||
import os.path
|
import os.path
|
||||||
import testtools
|
|
||||||
from testtools import testcase
|
from testtools import testcase
|
||||||
|
|
||||||
from ceilometer.openstack.common import test
|
from ceilometer.openstack.common import test
|
||||||
from ceilometer.openstack.common import timeutils
|
from ceilometer.openstack.common import timeutils
|
||||||
from ceilometer.openstack.common.fixture import config
|
|
||||||
from ceilometer.openstack.common.fixture import moxstubout
|
|
||||||
|
|
||||||
|
|
||||||
cfg.CONF.import_opt('pipeline_cfg_file', 'ceilometer.pipeline')
|
|
||||||
|
|
||||||
|
|
||||||
class TestCase(testtools.TestCase):
|
|
||||||
def setUp(self):
|
|
||||||
super(TestCase, self).setUp()
|
|
||||||
self.tempdir = self.useFixture(fixtures.TempDir())
|
|
||||||
self.useFixture(fixtures.FakeLogger())
|
|
||||||
self.useFixture(config.Config())
|
|
||||||
moxfixture = self.useFixture(moxstubout.MoxStubout())
|
|
||||||
self.mox = moxfixture.mox
|
|
||||||
self.stubs = moxfixture.stubs
|
|
||||||
|
|
||||||
cfg.CONF([], project='ceilometer')
|
|
||||||
|
|
||||||
# Set a default location for the pipeline config file so the
|
|
||||||
# tests work even if ceilometer is not installed globally on
|
|
||||||
# the system.
|
|
||||||
cfg.CONF.set_override(
|
|
||||||
'pipeline_cfg_file',
|
|
||||||
self.path_get('etc/ceilometer/pipeline.yaml')
|
|
||||||
)
|
|
||||||
|
|
||||||
def path_get(self, project_file=None):
|
|
||||||
root = os.path.abspath(os.path.join(os.path.dirname(__file__),
|
|
||||||
'..',
|
|
||||||
'..',
|
|
||||||
)
|
|
||||||
)
|
|
||||||
if project_file:
|
|
||||||
return os.path.join(root, project_file)
|
|
||||||
else:
|
|
||||||
return root
|
|
||||||
|
|
||||||
def temp_config_file_path(self, name='ceilometer.conf'):
|
|
||||||
return os.path.join(self.tempdir.path, name)
|
|
||||||
|
|
||||||
|
|
||||||
class BaseTestCase(test.BaseTestCase):
|
class BaseTestCase(test.BaseTestCase):
|
||||||
|
@ -29,8 +29,9 @@ from stevedore.tests import manager as extension_tests
|
|||||||
from ceilometer import sample
|
from ceilometer import sample
|
||||||
from ceilometer import pipeline
|
from ceilometer import pipeline
|
||||||
from ceilometer import agent
|
from ceilometer import agent
|
||||||
from ceilometer.tests import base
|
|
||||||
from ceilometer import transformer
|
from ceilometer import transformer
|
||||||
|
from ceilometer.openstack.common.fixture import config
|
||||||
|
from ceilometer.tests import base
|
||||||
|
|
||||||
|
|
||||||
default_test_data = sample.Sample(
|
default_test_data = sample.Sample(
|
||||||
@ -64,7 +65,7 @@ class TestPollsterException(TestPollster):
|
|||||||
raise Exception()
|
raise Exception()
|
||||||
|
|
||||||
|
|
||||||
class BaseAgentManagerTestCase(base.TestCase):
|
class BaseAgentManagerTestCase(base.BaseTestCase):
|
||||||
|
|
||||||
class Pollster(TestPollster):
|
class Pollster(TestPollster):
|
||||||
samples = []
|
samples = []
|
||||||
@ -162,6 +163,11 @@ class BaseAgentManagerTestCase(base.TestCase):
|
|||||||
'publishers': ["test"],
|
'publishers': ["test"],
|
||||||
}, ]
|
}, ]
|
||||||
self.setup_pipeline()
|
self.setup_pipeline()
|
||||||
|
self.CONF = self.useFixture(config.Config()).conf
|
||||||
|
self.CONF.set_override(
|
||||||
|
'pipeline_cfg_file',
|
||||||
|
self.path_get('etc/ceilometer/pipeline.yaml')
|
||||||
|
)
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
self.Pollster.samples = []
|
self.Pollster.samples = []
|
||||||
|
@ -19,11 +19,11 @@
|
|||||||
"""
|
"""
|
||||||
import mock
|
import mock
|
||||||
|
|
||||||
from ceilometer.tests import base
|
from ceilometer.openstack.common import test
|
||||||
from ceilometer.alarm import evaluator
|
from ceilometer.alarm import evaluator
|
||||||
|
|
||||||
|
|
||||||
class TestEvaluatorBaseClass(base.TestCase):
|
class TestEvaluatorBaseClass(test.BaseTestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TestEvaluatorBaseClass, self).setUp()
|
super(TestEvaluatorBaseClass, self).setUp()
|
||||||
self.called = False
|
self.called = False
|
||||||
|
@ -19,36 +19,38 @@
|
|||||||
"""
|
"""
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from oslo.config import cfg
|
|
||||||
|
|
||||||
from ceilometer.api.v1 import app
|
from ceilometer.api.v1 import app
|
||||||
from ceilometer.api import acl
|
from ceilometer.api import acl
|
||||||
from ceilometer import service
|
from ceilometer import service
|
||||||
from ceilometer.tests import base
|
from ceilometer.openstack.common import fileutils
|
||||||
|
from ceilometer.openstack.common import test
|
||||||
|
from ceilometer.openstack.common.fixture import config
|
||||||
|
|
||||||
|
|
||||||
class TestApp(base.TestCase):
|
class TestApp(test.BaseTestCase):
|
||||||
|
|
||||||
def tearDown(self):
|
def setUp(self):
|
||||||
super(TestApp, self).tearDown()
|
super(TestApp, self).setUp()
|
||||||
cfg.CONF.reset()
|
self.CONF = self.useFixture(config.Config()).conf
|
||||||
|
|
||||||
def test_keystone_middleware_conf(self):
|
def test_keystone_middleware_conf(self):
|
||||||
cfg.CONF.set_override("auth_protocol", "foottp",
|
self.CONF.set_override("auth_protocol", "foottp",
|
||||||
group=acl.OPT_GROUP_NAME)
|
group=acl.OPT_GROUP_NAME)
|
||||||
cfg.CONF.set_override("auth_version", "v2.0", group=acl.OPT_GROUP_NAME)
|
self.CONF.set_override("auth_version", "v2.0",
|
||||||
cfg.CONF.set_override("auth_uri", None,
|
group=acl.OPT_GROUP_NAME)
|
||||||
group=acl.OPT_GROUP_NAME)
|
self.CONF.set_override("auth_uri", None,
|
||||||
api_app = app.make_app(cfg.CONF, attach_storage=False)
|
group=acl.OPT_GROUP_NAME)
|
||||||
|
api_app = app.make_app(self.CONF, attach_storage=False)
|
||||||
self.assertTrue(api_app.wsgi_app.auth_uri.startswith('foottp'))
|
self.assertTrue(api_app.wsgi_app.auth_uri.startswith('foottp'))
|
||||||
|
|
||||||
def test_keystone_middleware_parse_conffile(self):
|
def test_keystone_middleware_parse_conffile(self):
|
||||||
tmpfile = self.temp_config_file_path()
|
content = "[{0}]\nauth_protocol = barttp"\
|
||||||
with open(tmpfile, "w") as f:
|
"\nauth_version = v2.0".format(acl.OPT_GROUP_NAME)
|
||||||
f.write("[%s]\nauth_protocol = barttp" % acl.OPT_GROUP_NAME)
|
tmpfile = fileutils.write_to_tempfile(content=content,
|
||||||
f.write("\nauth_version = v2.0")
|
prefix='ceilometer',
|
||||||
|
suffix='.conf')
|
||||||
service.prepare_service(['ceilometer-api',
|
service.prepare_service(['ceilometer-api',
|
||||||
'--config-file=%s' % tmpfile])
|
'--config-file=%s' % tmpfile])
|
||||||
api_app = app.make_app(cfg.CONF, attach_storage=False)
|
api_app = app.make_app(self.CONF, attach_storage=False)
|
||||||
self.assertTrue(api_app.wsgi_app.auth_uri.startswith('barttp'))
|
self.assertTrue(api_app.wsgi_app.auth_uri.startswith('barttp'))
|
||||||
os.unlink(tmpfile)
|
os.unlink(tmpfile)
|
||||||
|
@ -20,48 +20,52 @@
|
|||||||
"""
|
"""
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from oslo.config import cfg
|
|
||||||
|
|
||||||
from ceilometer.api import app
|
from ceilometer.api import app
|
||||||
from ceilometer.api import acl
|
from ceilometer.api import acl
|
||||||
from ceilometer import service
|
from ceilometer import service
|
||||||
|
from ceilometer.openstack.common import fileutils
|
||||||
from ceilometer.openstack.common import gettextutils
|
from ceilometer.openstack.common import gettextutils
|
||||||
|
from ceilometer.openstack.common.fixture import config
|
||||||
from ceilometer.openstack.common.fixture import moxstubout
|
from ceilometer.openstack.common.fixture import moxstubout
|
||||||
from ceilometer.tests import base
|
from ceilometer.tests import base
|
||||||
from ceilometer.tests import db as tests_db
|
from ceilometer.tests import db as tests_db
|
||||||
from .base import FunctionalTest
|
from .base import FunctionalTest
|
||||||
|
|
||||||
|
|
||||||
class TestApp(base.TestCase):
|
class TestApp(base.BaseTestCase):
|
||||||
|
|
||||||
def tearDown(self):
|
def setUp(self):
|
||||||
super(TestApp, self).tearDown()
|
super(TestApp, self).setUp()
|
||||||
cfg.CONF.reset()
|
self.CONF = self.useFixture(config.Config()).conf
|
||||||
|
|
||||||
def test_keystone_middleware_conf(self):
|
def test_keystone_middleware_conf(self):
|
||||||
cfg.CONF.set_override("auth_protocol", "foottp",
|
self.CONF.set_override("auth_protocol", "foottp",
|
||||||
group=acl.OPT_GROUP_NAME)
|
group=acl.OPT_GROUP_NAME)
|
||||||
cfg.CONF.set_override("auth_version", "v2.0", group=acl.OPT_GROUP_NAME)
|
self.CONF.set_override("auth_version", "v2.0",
|
||||||
cfg.CONF.set_override("pipeline_cfg_file",
|
group=acl.OPT_GROUP_NAME)
|
||||||
self.path_get("etc/ceilometer/pipeline.yaml"))
|
self.CONF.set_override("pipeline_cfg_file",
|
||||||
cfg.CONF.set_override('connection', "log://", group="database")
|
self.path_get("etc/ceilometer/pipeline.yaml"))
|
||||||
cfg.CONF.set_override("auth_uri", None, group=acl.OPT_GROUP_NAME)
|
self.CONF.set_override('connection', "log://", group="database")
|
||||||
|
self.CONF.set_override("auth_uri", None, group=acl.OPT_GROUP_NAME)
|
||||||
|
|
||||||
api_app = app.setup_app()
|
api_app = app.setup_app()
|
||||||
self.assertTrue(api_app.auth_uri.startswith('foottp'))
|
self.assertTrue(api_app.auth_uri.startswith('foottp'))
|
||||||
|
|
||||||
def test_keystone_middleware_parse_conffile(self):
|
def test_keystone_middleware_parse_conffile(self):
|
||||||
tmpfile = self.temp_config_file_path()
|
pipeline_conf = self.path_get("etc/ceilometer/pipeline.yaml")
|
||||||
with open(tmpfile, "w") as f:
|
content = "[DEFAULT]\n"\
|
||||||
f.write("[DEFAULT]\n")
|
"pipeline_cfg_file = {0}\n"\
|
||||||
f.write("pipeline_cfg_file = %s\n" %
|
"[{1}]\n"\
|
||||||
self.path_get("etc/ceilometer/pipeline.yaml"))
|
"auth_protocol = barttp\n"\
|
||||||
f.write("[%s]\n" % acl.OPT_GROUP_NAME)
|
"auth_version = v2.0\n".format(pipeline_conf,
|
||||||
f.write("auth_protocol = barttp\n")
|
acl.OPT_GROUP_NAME)
|
||||||
f.write("auth_version = v2.0\n")
|
|
||||||
|
tmpfile = fileutils.write_to_tempfile(content=content,
|
||||||
|
prefix='ceilometer',
|
||||||
|
suffix='.conf')
|
||||||
service.prepare_service(['ceilometer-api',
|
service.prepare_service(['ceilometer-api',
|
||||||
'--config-file=%s' % tmpfile])
|
'--config-file=%s' % tmpfile])
|
||||||
cfg.CONF.set_override('connection', "log://", group="database")
|
self.CONF.set_override('connection', "log://", group="database")
|
||||||
api_app = app.setup_app()
|
api_app = app.setup_app()
|
||||||
self.assertTrue(api_app.auth_uri.startswith('barttp'))
|
self.assertTrue(api_app.auth_uri.startswith('barttp'))
|
||||||
os.unlink(tmpfile)
|
os.unlink(tmpfile)
|
||||||
|
@ -23,11 +23,11 @@ from sqlalchemy.types import DATETIME, NUMERIC
|
|||||||
from sqlalchemy.dialects.mysql import DECIMAL
|
from sqlalchemy.dialects.mysql import DECIMAL
|
||||||
|
|
||||||
from ceilometer import utils
|
from ceilometer import utils
|
||||||
|
from ceilometer.openstack.common import test
|
||||||
from ceilometer.storage.sqlalchemy import models
|
from ceilometer.storage.sqlalchemy import models
|
||||||
from ceilometer.tests import base
|
|
||||||
|
|
||||||
|
|
||||||
class PreciseTimestampTest(base.TestCase):
|
class PreciseTimestampTest(test.BaseTestCase):
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def fake_dialect(name):
|
def fake_dialect(name):
|
||||||
|
@ -19,21 +19,28 @@
|
|||||||
|
|
||||||
import httplib2
|
import httplib2
|
||||||
import json
|
import json
|
||||||
|
import os
|
||||||
import random
|
import random
|
||||||
import socket
|
import socket
|
||||||
import subprocess
|
import subprocess
|
||||||
import time
|
import time
|
||||||
|
|
||||||
from ceilometer.tests import base
|
from ceilometer.tests import base
|
||||||
|
from ceilometer.openstack.common import fileutils
|
||||||
|
|
||||||
|
|
||||||
class BinTestCase(base.TestCase):
|
class BinTestCase(base.BaseTestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(BinTestCase, self).setUp()
|
super(BinTestCase, self).setUp()
|
||||||
self.tempfile = self.temp_config_file_path()
|
content = "[database]\n"\
|
||||||
with open(self.tempfile, 'w') as tmp:
|
"connection=log://localhost\n"
|
||||||
tmp.write("[database]\n")
|
self.tempfile = fileutils.write_to_tempfile(content=content,
|
||||||
tmp.write("connection=log://localhost\n")
|
prefix='ceilometer',
|
||||||
|
suffix='.conf')
|
||||||
|
|
||||||
|
def tearDown(self):
|
||||||
|
super(BinTestCase, self).tearDown()
|
||||||
|
os.remove(self.tempfile)
|
||||||
|
|
||||||
def test_dbsync_run(self):
|
def test_dbsync_run(self):
|
||||||
subp = subprocess.Popen(['ceilometer-dbsync',
|
subp = subprocess.Popen(['ceilometer-dbsync',
|
||||||
@ -46,17 +53,21 @@ class BinTestCase(base.TestCase):
|
|||||||
self.assertEqual(subp.wait(), 0)
|
self.assertEqual(subp.wait(), 0)
|
||||||
|
|
||||||
|
|
||||||
class BinSendCounterTestCase(base.TestCase):
|
class BinSendCounterTestCase(base.BaseTestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(BinSendCounterTestCase, self).setUp()
|
super(BinSendCounterTestCase, self).setUp()
|
||||||
self.tempfile = self.temp_config_file_path()
|
|
||||||
pipeline_cfg_file = self.path_get('etc/ceilometer/pipeline.yaml')
|
pipeline_cfg_file = self.path_get('etc/ceilometer/pipeline.yaml')
|
||||||
with open(self.tempfile, 'w') as tmp:
|
content = "[DEFAULT]\n"\
|
||||||
tmp.write("[DEFAULT]\n")
|
"rpc_backend=ceilometer.openstack.common.rpc.impl_fake\n"\
|
||||||
tmp.write(
|
"pipeline_cfg_file={0}\n".format(pipeline_cfg_file)
|
||||||
"rpc_backend=ceilometer.openstack.common.rpc.impl_fake\n")
|
|
||||||
tmp.write(
|
self.tempfile = fileutils.write_to_tempfile(content=content,
|
||||||
"pipeline_cfg_file=%s\n" % pipeline_cfg_file)
|
prefix='ceilometer',
|
||||||
|
suffix='.conf')
|
||||||
|
|
||||||
|
def tearDown(self):
|
||||||
|
super(BinSendCounterTestCase, self).tearDown()
|
||||||
|
os.remove(self.tempfile)
|
||||||
|
|
||||||
def test_send_counter_run(self):
|
def test_send_counter_run(self):
|
||||||
subp = subprocess.Popen([self.path_get('bin/ceilometer-send-counter'),
|
subp = subprocess.Popen([self.path_get('bin/ceilometer-send-counter'),
|
||||||
@ -66,32 +77,30 @@ class BinSendCounterTestCase(base.TestCase):
|
|||||||
self.assertEqual(subp.wait(), 0)
|
self.assertEqual(subp.wait(), 0)
|
||||||
|
|
||||||
|
|
||||||
class BinApiTestCase(base.TestCase):
|
class BinApiTestCase(base.BaseTestCase):
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(BinApiTestCase, self).setUp()
|
super(BinApiTestCase, self).setUp()
|
||||||
self.api_port = random.randint(10000, 11000)
|
self.api_port = random.randint(10000, 11000)
|
||||||
self.http = httplib2.Http()
|
self.http = httplib2.Http()
|
||||||
self.tempfile = self.temp_config_file_path()
|
|
||||||
pipeline_cfg_file = self.path_get('etc/ceilometer/pipeline.yaml')
|
pipeline_cfg_file = self.path_get('etc/ceilometer/pipeline.yaml')
|
||||||
policy_file = self.path_get('tests/policy.json')
|
policy_file = self.path_get('tests/policy.json')
|
||||||
with open(self.tempfile, 'w') as tmp:
|
content = "[DEFAULT]\n"\
|
||||||
tmp.write("[DEFAULT]\n")
|
"rpc_backend=ceilometer.openstack.common.rpc.impl_fake\n"\
|
||||||
tmp.write(
|
"auth_strategy=noauth\n"\
|
||||||
"rpc_backend=ceilometer.openstack.common.rpc.impl_fake\n")
|
"debug=true\n"\
|
||||||
tmp.write(
|
"pipeline_cfg_file={0}\n"\
|
||||||
"auth_strategy=noauth\n")
|
"policy_file={1}\n"\
|
||||||
tmp.write(
|
"[api]\n"\
|
||||||
"debug=true\n")
|
"port={2}\n"\
|
||||||
tmp.write(
|
"[database]\n"\
|
||||||
"pipeline_cfg_file=%s\n" % pipeline_cfg_file)
|
"connection=log://localhost\n".format(pipeline_cfg_file,
|
||||||
tmp.write(
|
policy_file,
|
||||||
"policy_file=%s\n" % policy_file)
|
self.api_port)
|
||||||
tmp.write("[api]\n")
|
|
||||||
tmp.write(
|
self.tempfile = fileutils.write_to_tempfile(content=content,
|
||||||
"port=%s\n" % self.api_port)
|
prefix='ceilometer',
|
||||||
tmp.write("[database]\n")
|
suffix='.conf')
|
||||||
tmp.write("connection=log://localhost\n")
|
|
||||||
self.subp = subprocess.Popen(['ceilometer-api',
|
self.subp = subprocess.Popen(['ceilometer-api',
|
||||||
"--config-file=%s" % self.tempfile])
|
"--config-file=%s" % self.tempfile])
|
||||||
|
|
||||||
@ -99,6 +108,7 @@ class BinApiTestCase(base.TestCase):
|
|||||||
super(BinApiTestCase, self).tearDown()
|
super(BinApiTestCase, self).tearDown()
|
||||||
self.subp.kill()
|
self.subp.kill()
|
||||||
self.subp.wait()
|
self.subp.wait()
|
||||||
|
os.remove(self.tempfile)
|
||||||
|
|
||||||
def get_response(self, path):
|
def get_response(self, path):
|
||||||
url = 'http://%s:%d/%s' % ('127.0.0.1', self.api_port, path)
|
url = 'http://%s:%d/%s' % ('127.0.0.1', self.api_port, path)
|
||||||
|
@ -26,9 +26,11 @@ import time
|
|||||||
import threading
|
import threading
|
||||||
from ceilometer import service
|
from ceilometer import service
|
||||||
from ceilometer.tests import base
|
from ceilometer.tests import base
|
||||||
|
from ceilometer.openstack.common import fileutils
|
||||||
|
from ceilometer.openstack.common import test
|
||||||
|
|
||||||
|
|
||||||
class ServiceTestCase(base.TestCase):
|
class ServiceTestCase(test.BaseTestCase):
|
||||||
def test_prepare_service(self):
|
def test_prepare_service(self):
|
||||||
service.prepare_service([])
|
service.prepare_service([])
|
||||||
|
|
||||||
@ -60,31 +62,30 @@ class ParseOutput(threading.Thread):
|
|||||||
self.thread_stop = True
|
self.thread_stop = True
|
||||||
|
|
||||||
|
|
||||||
class ServiceRestartTest(base.TestCase):
|
class ServiceRestartTest(base.BaseTestCase):
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(ServiceRestartTest, self).setUp()
|
super(ServiceRestartTest, self).setUp()
|
||||||
self.tempfile = self.temp_config_file_path()
|
self.pipeline_cfg_file = fileutils.write_to_tempfile(content='',
|
||||||
self.pipeline_cfg_file = self.temp_config_file_path(name=
|
prefix='pipeline',
|
||||||
'pipeline.yaml')
|
suffix='.yaml')
|
||||||
shutil.copy(self.path_get('etc/ceilometer/pipeline.yaml'),
|
shutil.copy(self.path_get('etc/ceilometer/pipeline.yaml'),
|
||||||
self.pipeline_cfg_file)
|
self.pipeline_cfg_file)
|
||||||
self.pipelinecfg_read_from_file()
|
self.pipelinecfg_read_from_file()
|
||||||
policy_file = self.path_get('tests/policy.json')
|
policy_file = self.path_get('tests/policy.json')
|
||||||
with open(self.tempfile, 'w') as tmp:
|
content = "[DEFAULT]\n"\
|
||||||
tmp.write("[DEFAULT]\n")
|
"rpc_backend=ceilometer.openstack.common.rpc.impl_fake\n"\
|
||||||
tmp.write(
|
"auth_strategy=noauth\n"\
|
||||||
"rpc_backend=ceilometer.openstack.common.rpc.impl_fake\n")
|
"debug=true\n"\
|
||||||
tmp.write(
|
"pipeline_cfg_file={0}\n"\
|
||||||
"auth_strategy=noauth\n")
|
"policy_file={1}\n"\
|
||||||
tmp.write(
|
"[database]\n"\
|
||||||
"debug=true\n")
|
"connection=log://localhost\n".format(self.pipeline_cfg_file,
|
||||||
tmp.write(
|
policy_file)
|
||||||
"pipeline_cfg_file=%s\n" % self.pipeline_cfg_file)
|
|
||||||
tmp.write(
|
self.tempfile = fileutils.write_to_tempfile(content=content,
|
||||||
"policy_file=%s\n" % policy_file)
|
prefix='ceilometer',
|
||||||
tmp.write("[database]\n")
|
suffix='.conf')
|
||||||
tmp.write("connection=log://localhost\n")
|
|
||||||
|
|
||||||
def _modify_pipeline_file(self):
|
def _modify_pipeline_file(self):
|
||||||
with open(self.pipeline_cfg_file, 'w') as pipe_fd:
|
with open(self.pipeline_cfg_file, 'w') as pipe_fd:
|
||||||
@ -100,6 +101,8 @@ class ServiceRestartTest(base.TestCase):
|
|||||||
super(ServiceRestartTest, self).tearDown()
|
super(ServiceRestartTest, self).tearDown()
|
||||||
self.sub.kill()
|
self.sub.kill()
|
||||||
self.sub.wait()
|
self.sub.wait()
|
||||||
|
os.remove(self.pipeline_cfg_file)
|
||||||
|
os.remove(self.tempfile)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _check_process_alive(pid):
|
def _check_process_alive(pid):
|
||||||
|
Loading…
Reference in New Issue
Block a user