[CDN-153] Avoid passing args to cdn server

This PR fixes a bug where the command line args were being passed
from the calling process (API tests) to the called process (CDN Server).
This commit is contained in:
Malini Kamalambal 2014-07-31 14:45:57 -04:00
parent 2a9968bc90
commit 8bdfea2085
5 changed files with 68 additions and 5 deletions

View File

@ -21,9 +21,9 @@ To run the tests
export CAFE_ROOT_LOG_PATH=~/.cdn/logs
export CAFE_TEST_LOG_PATH=~/.cdn/logs
3. Copy the tests.conf file to the path set by CAFE_CONFIG_FILE_PATH::
3. Copy the api.conf file to the path set by CAFE_CONFIG_FILE_PATH::
cp tests/api/etc/tests.conf ~/.cdn/tests.conf
cp tests/etc/api.conf ~/.cdn/tests.conf
4. Once you are ready to run the tests::

View File

@ -14,6 +14,7 @@
# limitations under the License.
import jsonschema
import os
from oslo.config import cfg
@ -35,6 +36,8 @@ class TestBase(fixtures.BaseTestFixture):
@classmethod
def setUpClass(cls):
cls.conf_file = 'cdn_mockdb.conf'
super(TestBase, cls).setUpClass()
cls.auth_config = config.AuthConfig()
@ -51,9 +54,14 @@ class TestBase(fixtures.BaseTestFixture):
deserialize_format='json')
cls.server_config = config.CDNServerConfig()
if cls.server_config.run_server:
conf = cfg.CONF
conf(project='cdn', prog='cdn')
conf_path = os.environ["CDN_TESTS_CONFIGS_DIR"]
config_file = os.path.join(conf_path, cls.conf_file)
conf = cfg.ConfigOpts()
conf(project='cdn', prog='cdn', args=[],
default_config_files=[config_file])
cdn_server = server.CDNServer()
cdn_server.start(conf)

View File

@ -16,7 +16,7 @@
import ddt
import uuid
from tests.api.utils import base
from tests.api import base
from tests.api.utils.schema import response

55
tests/etc/cdn_mockdb.conf Normal file
View File

@ -0,0 +1,55 @@
# By default, this should live in one of:
# ~/.cdn/cdn.conf
# /etc/cdn/cdn.conf
[DEFAULT]
# Show more verbose log output (sets INFO log level output)
;verbose = False
# Show debugging output in logs (sets DEBUG log level output)
;debug = False
# Log to this file
log_file = cdn.log
;auth_strategy =
# ================= Syslog Options ============================
# Send logs to syslog (/dev/log) instead of to file specified
# by `log_file`
;use_syslog = False
# Facility to use. If unset defaults to LOG_USER.
;syslog_log_facility = LOG_LOCAL0
# ================= Driver Options ============================
[drivers]
# Transport driver module (e.g., falcon, pecan)
transport = falcon
# Manager driver module (e.g. default)
manager = default
# Storage driver module (e.g., mongodb, sqlite, cassandra)
storage = mockdb
[drivers:transport:falcon]
bind = 0.0.0.0
port = 8888
[drivers:storage:mongodb]
uri = mongodb://localhost
database = cdn
[drivers:storage:cassandra]
cluster = "localhost"
keyspace = cdn
[drivers:storage:mockdb]
database = cdn
[drivers:provider:fastly]
apikey = "MYAPIKEY"