updated tests to use poppy
This commit is contained in:
parent
d4030bb1c6
commit
31906801f8
@ -1,5 +1,5 @@
|
||||
[run]
|
||||
omit = *cdn/openstack*
|
||||
omit = *poppy/openstack*
|
||||
|
||||
[report]
|
||||
exclude_lines =
|
||||
|
12
HACKING.rst
12
HACKING.rst
@ -86,7 +86,7 @@ Template::
|
||||
\n
|
||||
{{third-party lib imports in human alphabetical order}}
|
||||
\n
|
||||
{{cdn imports in human alphabetical order}}
|
||||
{{poppy imports in human alphabetical order}}
|
||||
\n
|
||||
\n
|
||||
{{begin your code}}
|
||||
@ -102,9 +102,9 @@ Example::
|
||||
|
||||
import eventlet
|
||||
|
||||
import cdn.common
|
||||
from cdn import test
|
||||
import cdn.storage.cassandra
|
||||
import poppy.common
|
||||
from poppy import test
|
||||
import poppy.storage.cassandra
|
||||
|
||||
|
||||
More Import Examples
|
||||
@ -112,11 +112,11 @@ More Import Examples
|
||||
|
||||
**INCORRECT** ::
|
||||
|
||||
import cdn.transport.wsgi as wsgi
|
||||
import poppy.transport.wsgi as wsgi
|
||||
|
||||
**CORRECT** ::
|
||||
|
||||
from cdn.transport import wsgi
|
||||
from poppy.transport import wsgi
|
||||
|
||||
Docstrings
|
||||
----------
|
||||
|
45
README.rst
45
README.rst
@ -1,16 +1,16 @@
|
||||
CDN
|
||||
Poppy
|
||||
=======
|
||||
|
||||
Content Delivery Network Management as a Service
|
||||
CDN Provider Management as a Service
|
||||
|
||||
Note: This is a work in progress and is not currently recommended for production use.
|
||||
|
||||
What is CDN
|
||||
What is Poppy
|
||||
============
|
||||
|
||||
Users have come to expect exceptional speed in their applications, websites, and video experiences. Because of this, using a CDN has become standard for companies, no matter their size.
|
||||
|
||||
CDN will take all the guess work out of the CDN market for our users. CDN will give them a consistently speedy experience from integrated partners, with an easy to use RESTful API.
|
||||
Poppy will take all the guess work out of the CDN market for our users. Poppy will give them a consistently speedy experience from integrated partners, with an easy to use RESTful API.
|
||||
|
||||
Vendor lock-in to a particular CDN provider is removed by abstracting away the plethora of vendor API's available. This means that a customer only has to integrate with one CDN API, and reap the benefits of using multiple providers.
|
||||
|
||||
@ -39,10 +39,10 @@ Features
|
||||
+ Set Restrictions on who can access cached content
|
||||
|
||||
|
||||
What CDN is not
|
||||
What Poppy is not
|
||||
----------------------
|
||||
|
||||
CDN does not run its own Edge Cache or POP servers. This is purely a management API to abstract away the myriad of CDN providers on the market.
|
||||
Poppy does not run its own Edge Cache or POP servers. This is purely a management API to abstract away the myriad of CDN providers on the market.
|
||||
|
||||
|
||||
|
||||
@ -53,38 +53,38 @@ Getting Started
|
||||
not all of these steps are required. It is assumed you have `CassandraDB`
|
||||
installed and running.
|
||||
|
||||
1. From your home folder create the ``~/.cdn`` folder and clone the repo::
|
||||
1. From your home folder create the ``~/.poppy`` folder and clone the repo::
|
||||
|
||||
$ cd
|
||||
$ mkdir .cdn
|
||||
$ git clone https://github.com/rackerlabs/cdn.git
|
||||
|
||||
2. Copy the CDN config files to the directory ``~/.cdn``::
|
||||
2. Copy the Poppy config files to the directory ``~/.poppy``::
|
||||
|
||||
$ cp cdn/etc/cdn.conf ~/.cdn/cdn.conf
|
||||
$ cp cdn/etc/logging.conf ~/.cdn/logging.conf
|
||||
$ cp poppy/etc/cdn.conf ~/.poppy/poppy.conf
|
||||
$ cp poppy/etc/logging.conf ~/.poppy/logging.conf
|
||||
|
||||
3. Find the ``[drivers:storage:cassandradb]`` section in
|
||||
``~/.cdn/cdn.conf`` and modify the URI to point
|
||||
``~/.poppy/poppy.conf`` and modify the URI to point
|
||||
to your local casssandra cluster::
|
||||
|
||||
[drivers:storage:cassandra]
|
||||
cluster = "localhost"
|
||||
keyspace = cdn
|
||||
keyspace = poppy
|
||||
|
||||
4. By using cassandra storage plugin, you will need to create the default
|
||||
keyspace "cdn" on your cassandra host/cluster. So log into cqlsh, do::
|
||||
|
||||
cqlsh> CREATE KEYSPACE cdn WITH REPLICATION = { 'class' : 'SimpleStrategy' , 'replication_factor' : 1} ;
|
||||
cqlsh> CREATE KEYSPACE poppy WITH REPLICATION = { 'class' : 'SimpleStrategy' , 'replication_factor' : 1} ;
|
||||
|
||||
5. For logging, find the ``[DEFAULT]`` section in
|
||||
``~/.cdn/cdn.conf`` and modify as desired::
|
||||
``~/.poppy/poppy.conf`` and modify as desired::
|
||||
|
||||
log_file = server.log
|
||||
|
||||
6. Change directories back to your local copy of the repo::
|
||||
|
||||
$ cd cdn
|
||||
$ cd poppy
|
||||
|
||||
|
||||
7. Install general requirements::
|
||||
@ -93,7 +93,7 @@ installed and running.
|
||||
|
||||
Install Requirements for each Provider configured::
|
||||
|
||||
$ pip install -r cdn/providers/fastly/requirements.txt
|
||||
$ pip install -r poppy/providers/fastly/requirements.txt
|
||||
|
||||
Run the following so you can see the results of any changes you
|
||||
make to the code without having to reinstall the package each time::
|
||||
@ -101,14 +101,11 @@ installed and running.
|
||||
$ pip install -e .
|
||||
|
||||
|
||||
Installing the fastly client library may have issues. Copy the `README.md` file to `README` and try again.
|
||||
8. Start the Poppy server::
|
||||
|
||||
$ poppy-server
|
||||
|
||||
8. Start the CDN server::
|
||||
|
||||
$ cdn-server
|
||||
|
||||
9. Test out that CDN is working by requesting the home doc (with a sample project ID)::
|
||||
9. Test out that Poppy is working by requesting the home doc (with a sample project ID)::
|
||||
|
||||
$ curl -i -X GET http://0.0.0.0:8888/v1.0/123
|
||||
|
||||
@ -143,7 +140,7 @@ Mac OSX
|
||||
|
||||
3. Create a Keyspace with Replication::
|
||||
|
||||
CREATE KEYSPACE cdn WITH REPLICATION = { 'class' : 'SimpleStrategy', 'replication_factor' : 1 };
|
||||
CREATE KEYSPACE poppy WITH REPLICATION = { 'class' : 'SimpleStrategy', 'replication_factor' : 1 };
|
||||
|
||||
4. Import the Cassandra Schema to set up the required tables that CDN will need::
|
||||
|
||||
@ -160,7 +157,7 @@ First install the additional requirements::
|
||||
|
||||
And then run tests::
|
||||
|
||||
$ tox -e py27
|
||||
$ tox
|
||||
|
||||
|
||||
.. _`CassandraDB` : http://cassandra.apache.org
|
||||
|
@ -1,11 +1,11 @@
|
||||
##
|
||||
## CDN API
|
||||
## Poppy
|
||||
##
|
||||
##
|
||||
|
||||
# The following files should exist in this folder before running Dockerfile
|
||||
# - docker_rsa (private key) -> public key should be published to the private git repo
|
||||
# - cdn.conf (desired configuration for cdn api)
|
||||
# - poppy.conf (desired configuration for poppy api)
|
||||
# - logging.conf (desired logging configuration file)
|
||||
|
||||
|
||||
@ -43,28 +43,28 @@ RUN echo "IdentityFile ~/.ssh/id_rsa" >> /etc/ssh/ssh_config
|
||||
RUN touch /root/.ssh/known_hosts
|
||||
|
||||
# Pull project
|
||||
RUN git clone git@github.com:rackerlabs/cdn /home/cdn
|
||||
RUN git clone git@github.com:rackerlabs/cdn /home/poppy
|
||||
|
||||
# Install Requirements
|
||||
RUN sudo pip install -r /home/cdn/requirements/requirements.txt
|
||||
RUN sudo pip install -r /home/poppy/requirements/requirements.txt
|
||||
|
||||
RUN sudo pip install -e /home/cdn/.
|
||||
RUN sudo pip install -e /home/poppy/.
|
||||
|
||||
# Set up the configuration files
|
||||
ADD ./cdn.conf /etc/cdn.conf
|
||||
ADD ./poppy.conf /etc/poppy.conf
|
||||
ADD ./logging.conf /etc/logging.conf
|
||||
ADD ./uwsgi.ini /root/uwsgi.ini
|
||||
|
||||
# create uwsgi log directory
|
||||
RUN mkdir -p /var/log/cdn
|
||||
RUN chmod -R +w /var/log/cdn
|
||||
RUN mkdir -p /var/log/poppy
|
||||
RUN chmod -R +w /var/log/poppy
|
||||
|
||||
# create uwsgi pid directory
|
||||
RUN mkdir -p /var/run/cdn
|
||||
RUN chmod -R +w /var/run/cdn
|
||||
RUN mkdir -p /var/run/poppy
|
||||
RUN chmod -R +w /var/run/poppy
|
||||
|
||||
#RUN /usr/local/bin/uwsgi --ini /root/uwsgi.ini
|
||||
|
||||
# Start CDN
|
||||
# Start Poppy
|
||||
EXPOSE 80
|
||||
CMD ["/usr/local/bin/uwsgi", "--ini", "/root/uwsgi.ini"]
|
||||
|
@ -1,6 +1,6 @@
|
||||
# By default, this should live in one of:
|
||||
# ~/.cdn/cdn.conf
|
||||
# /etc/cdn/cdn.conf
|
||||
# ~/.poppy/poppy.conf
|
||||
# /etc/poppy/poppy.conf
|
||||
|
||||
[DEFAULT]
|
||||
# Show more verbose log output (sets INFO log level output)
|
||||
@ -10,7 +10,7 @@
|
||||
;debug = False
|
||||
|
||||
# Log to this file
|
||||
log_file = cdn.log
|
||||
log_file = poppy.log
|
||||
|
||||
;auth_strategy =
|
||||
|
||||
@ -40,14 +40,14 @@ port = 8888
|
||||
|
||||
[drivers:storage:mongodb]
|
||||
uri = mongodb://localhost
|
||||
database = cdn
|
||||
database = poppy
|
||||
|
||||
[drivers:storage:cassandra]
|
||||
cluster = "<your-cassandra-server-link-name>"
|
||||
keyspace = cdn
|
||||
keyspace = poppy
|
||||
|
||||
[drivers:storage:mockdb]
|
||||
database = cdn
|
||||
database = poppy
|
||||
|
||||
[drivers:provider:fastly]
|
||||
apikey = "<MYAPIKEY>"
|
||||
|
@ -14,12 +14,12 @@ handlers=devel
|
||||
[logger_server]
|
||||
level=DEBUG
|
||||
handlers=devel
|
||||
qualname=cdn-server
|
||||
qualname=poppy-server
|
||||
|
||||
[logger_combined]
|
||||
level=DEBUG
|
||||
handlers=devel
|
||||
qualname=cdn-combined
|
||||
qualname=poppy-combined
|
||||
|
||||
[handler_production]
|
||||
class=handlers.SysLogHandler
|
||||
@ -31,7 +31,7 @@ args=(('localhost', handlers.SYSLOG_UDP_PORT), handlers.SysLogHandler.LOG_USER)
|
||||
class=FileHandler
|
||||
level=DEBUG
|
||||
formatter=normal_with_name
|
||||
args=('cdn.log', 'w')
|
||||
args=('poppy.log', 'w')
|
||||
|
||||
[handler_devel]
|
||||
class=StreamHandler
|
||||
|
@ -1,14 +1,14 @@
|
||||
[uwsgi]
|
||||
master = true
|
||||
chdir = /home/cdn/
|
||||
chdir = /home/poppy/
|
||||
workers = 4
|
||||
http-socket = 0.0.0.0:80
|
||||
logger = file:/var/log/cdn/cdn.log
|
||||
pidfile = /var/run/cdn/cdn.pid
|
||||
logger = file:/var/log/poppy/poppy.log
|
||||
pidfile = /var/run/poppy/poppy.pid
|
||||
die-on-term = true
|
||||
enable-threads = true
|
||||
buffer-size = 32768
|
||||
max-requests = 15000
|
||||
no-orphans = true
|
||||
vacuum = true
|
||||
module = cdn.transport.falcon.app:app
|
||||
module = poppy.transport.falcon.app:app
|
@ -29,7 +29,7 @@ source-dir = doc/source
|
||||
|
||||
[entry_points]
|
||||
console_scripts =
|
||||
cdn-server = poppy.cmd.server:run
|
||||
poppy-server = poppy.cmd.server:run
|
||||
|
||||
cdn.transport =
|
||||
falcon = poppy.transport.falcon:Driver
|
||||
|
@ -4,7 +4,7 @@ API Tests
|
||||
The API tests
|
||||
+ test an actual API against a running environment.
|
||||
+ are black box tests
|
||||
+ can be used to test any running instance of cdn server (dev, test, prod, local
|
||||
+ can be used to test any running instance of poppy server (dev, test, prod, local
|
||||
instance, containerized instance)
|
||||
|
||||
|
||||
@ -17,13 +17,13 @@ To run the tests
|
||||
|
||||
2. Set the following environment variables::
|
||||
|
||||
export CAFE_CONFIG_FILE_PATH=~/.cdn/tests.conf
|
||||
export CAFE_ROOT_LOG_PATH=~/.cdn/logs
|
||||
export CAFE_TEST_LOG_PATH=~/.cdn/logs
|
||||
export CAFE_CONFIG_FILE_PATH=~/.poppy/tests.conf
|
||||
export CAFE_ROOT_LOG_PATH=~/.poppy/logs
|
||||
export CAFE_TEST_LOG_PATH=~/.poppy/logs
|
||||
|
||||
3. Copy the api.conf file to the path set by CAFE_CONFIG_FILE_PATH::
|
||||
|
||||
cp tests/etc/api.conf ~/.cdn/tests.conf
|
||||
cp tests/etc/api.conf ~/.poppy/tests.conf
|
||||
|
||||
4. Once you are ready to run the tests::
|
||||
|
||||
|
@ -36,7 +36,7 @@ class TestBase(fixtures.BaseTestFixture):
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
|
||||
cls.conf_file = 'cdn_mockdb.conf'
|
||||
cls.conf_file = 'poppy_mockdb.conf'
|
||||
|
||||
super(TestBase, cls).setUpClass()
|
||||
|
||||
@ -56,14 +56,14 @@ class TestBase(fixtures.BaseTestFixture):
|
||||
cls.server_config = config.CDNServerConfig()
|
||||
|
||||
if cls.server_config.run_server:
|
||||
conf_path = os.environ["CDN_TESTS_CONFIGS_DIR"]
|
||||
conf_path = os.environ["POPPY_TESTS_CONFIGS_DIR"]
|
||||
config_file = os.path.join(conf_path, cls.conf_file)
|
||||
|
||||
conf = cfg.ConfigOpts()
|
||||
conf(project='cdn', prog='cdn', args=[],
|
||||
conf(project='poppy', prog='poppy', args=[],
|
||||
default_config_files=[config_file])
|
||||
cdn_server = server.CDNServer()
|
||||
cdn_server.start(conf)
|
||||
poppy_server = server.CDNServer()
|
||||
poppy_server.start(conf)
|
||||
|
||||
def assertSchema(self, response_json, expected_schema):
|
||||
"""Verify response schema aligns with the expected schema."""
|
||||
|
@ -16,23 +16,23 @@
|
||||
from cafe.engine.models import data_interfaces
|
||||
|
||||
|
||||
class CDNConfig(data_interfaces.ConfigSectionInterface):
|
||||
"""Defines the config values for cdn."""
|
||||
SECTION_NAME = 'cdn'
|
||||
class PoppyConfig(data_interfaces.ConfigSectionInterface):
|
||||
"""Defines the config values for poppy."""
|
||||
SECTION_NAME = 'poppy'
|
||||
|
||||
@property
|
||||
def base_url(self):
|
||||
"""CDN endpoint."""
|
||||
"""poppy endpoint."""
|
||||
return self.get('base_url')
|
||||
|
||||
|
||||
class CDNServerConfig(data_interfaces.ConfigSectionInterface):
|
||||
"""Defines the config values for starting (or not) a cdn server"""
|
||||
SECTION_NAME = 'cdn_server'
|
||||
class PoppyServerConfig(data_interfaces.ConfigSectionInterface):
|
||||
"""Defines the config values for starting (or not) a poppy server"""
|
||||
SECTION_NAME = 'poppy_server'
|
||||
|
||||
@property
|
||||
def run_server(self):
|
||||
"""Boolean value indicating whether to start CDN server."""
|
||||
"""Boolean value indicating whether to start poppy server."""
|
||||
return self.get_boolean('run_server')
|
||||
|
||||
|
||||
|
@ -17,13 +17,13 @@ import abc
|
||||
import multiprocessing
|
||||
import six
|
||||
|
||||
from cdn import bootstrap
|
||||
from poppy import bootstrap
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class Server(object):
|
||||
|
||||
name = "cdn-server"
|
||||
name = "poppy-server"
|
||||
|
||||
def __init__(self):
|
||||
self.process = None
|
||||
@ -88,7 +88,7 @@ class Server(object):
|
||||
|
||||
|
||||
class CDNServer(Server):
|
||||
name = "cdn-server"
|
||||
name = "poppy-server"
|
||||
|
||||
def get_target(self, conf):
|
||||
server = bootstrap.Bootstrap(conf)
|
||||
|
@ -33,7 +33,7 @@ class TestCase(testtools.TestCase):
|
||||
def setUp(self):
|
||||
super(TestCase, self).setUp()
|
||||
|
||||
self.useFixture(fixtures.FakeLogger('cdn'))
|
||||
self.useFixture(fixtures.FakeLogger('poppy'))
|
||||
|
||||
if self.config_file:
|
||||
self.conf = self.load_conf(self.config_file)
|
||||
|
@ -7,8 +7,8 @@ username={user name of the cloud account}
|
||||
api_key={api key for this user name}
|
||||
base_url=https://identity.api.rackspacecloud.com/v2.0
|
||||
|
||||
[cdn]
|
||||
[poppy]
|
||||
base_url=https//0.0.0.0:8888
|
||||
|
||||
[cdn_server]
|
||||
[poppy_server]
|
||||
run_server=True
|
||||
|
@ -1,6 +1,6 @@
|
||||
# By default, this should live in one of:
|
||||
# ~/.cdn/cdn.conf
|
||||
# /etc/cdn/cdn.conf
|
||||
# ~/.poppy/poppy.conf
|
||||
# /etc/poppy/poppy.conf
|
||||
|
||||
[DEFAULT]
|
||||
# Show more verbose log output (sets INFO log level output)
|
||||
@ -10,7 +10,7 @@
|
||||
;debug = False
|
||||
|
||||
# Log to this file
|
||||
log_file = cdn.log
|
||||
log_file = poppy.log
|
||||
|
||||
;auth_strategy =
|
||||
|
||||
@ -42,14 +42,14 @@ port = 8888
|
||||
|
||||
[drivers:storage:mongodb]
|
||||
uri = mongodb://localhost
|
||||
database = cdn
|
||||
database = poppy
|
||||
|
||||
[drivers:storage:cassandra]
|
||||
cluster = "localhost"
|
||||
keyspace = cdn
|
||||
keyspace = poppy
|
||||
|
||||
[drivers:storage:mockdb]
|
||||
database = cdn
|
||||
database = poppy
|
||||
|
||||
[drivers:provider:fastly]
|
||||
apikey = "MYAPIKEY"
|
@ -1,6 +1,6 @@
|
||||
# By default, this should live in one of:
|
||||
# ~/.cdn/cdn.conf
|
||||
# /etc/cdn/cdn.conf
|
||||
# ~/.poppy/poppy.conf
|
||||
# /etc/poppy/poppy.conf
|
||||
|
||||
[DEFAULT]
|
||||
# Show more verbose log output (sets INFO log level output)
|
||||
@ -10,7 +10,7 @@
|
||||
;debug = False
|
||||
|
||||
# Log to this file
|
||||
log_file = cdn.log
|
||||
log_file = poppy.log
|
||||
|
||||
# ================= Syslog Options ============================
|
||||
|
||||
@ -40,14 +40,14 @@ port = 8888
|
||||
|
||||
[drivers:storage:mongodb]
|
||||
uri = mongodb://localhost
|
||||
database = cdn
|
||||
database = poppy
|
||||
|
||||
[drivers:storage:cassandra]
|
||||
cluster = "localhost"
|
||||
keyspace = cdn
|
||||
keyspace = poppy
|
||||
|
||||
[drivers:storage:mockdb]
|
||||
database = cdn
|
||||
database = poppy
|
||||
|
||||
[drivers:provider:fastly]
|
||||
apikey = "MYAPIKEY"
|
@ -18,7 +18,7 @@ import os
|
||||
from oslo.config import cfg
|
||||
import webtest
|
||||
|
||||
from cdn import bootstrap
|
||||
from poppy import bootstrap
|
||||
from tests.functional import base
|
||||
|
||||
|
||||
@ -33,9 +33,9 @@ class BaseFunctionalTest(base.TestCase):
|
||||
))))
|
||||
conf_path = os.path.join(tests_path, 'etc', 'default_functional.conf')
|
||||
cfg.CONF(args=[], default_config_files=[conf_path])
|
||||
cdn_wsgi = bootstrap.Bootstrap(cfg.CONF).transport.app
|
||||
poppy_wsgi = bootstrap.Bootstrap(cfg.CONF).transport.app
|
||||
|
||||
self.app = webtest.TestApp(cdn_wsgi)
|
||||
self.app = webtest.TestApp(poppy_wsgi)
|
||||
|
||||
|
||||
FunctionalTest = BaseFunctionalTest
|
||||
|
@ -18,7 +18,7 @@ import json
|
||||
import pecan
|
||||
from webtest import app
|
||||
|
||||
from cdn.transport.pecan.controllers import base as c_base
|
||||
from poppy.transport.pecan.controllers import base as c_base
|
||||
from tests.functional.transport.pecan import base
|
||||
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
from cdn.manager.default import v1
|
||||
from poppy.manager.default import v1
|
||||
|
||||
from tests.functional.transport.pecan import base
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
import uuid
|
||||
|
||||
from cdn.manager.default import v1
|
||||
from poppy.manager.default import v1
|
||||
from tests.functional.transport.pecan import base
|
||||
|
||||
|
||||
|
@ -22,13 +22,13 @@ import sys
|
||||
import pecan
|
||||
from webtest import app
|
||||
|
||||
from cdn.common import errors
|
||||
from cdn.transport.validators import helpers
|
||||
from cdn.transport.validators.schemas import service
|
||||
from cdn.transport.validators.stoplight import decorators
|
||||
from cdn.transport.validators.stoplight import exceptions
|
||||
from cdn.transport.validators.stoplight import helpers as stoplight_helpers
|
||||
from cdn.transport.validators.stoplight import rule
|
||||
from poppy.common import errors
|
||||
from poppy.transport.validators import helpers
|
||||
from poppy.transport.validators.schemas import service
|
||||
from poppy.transport.validators.stoplight import decorators
|
||||
from poppy.transport.validators.stoplight import exceptions
|
||||
from poppy.transport.validators.stoplight import helpers as stoplight_helpers
|
||||
from poppy.transport.validators.stoplight import rule
|
||||
from tests.functional import base
|
||||
|
||||
# for pecan testing app
|
||||
|
@ -13,9 +13,9 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
from cdn.transport.validators.stoplight import decorators
|
||||
from cdn.transport.validators.stoplight import exceptions
|
||||
from cdn.transport.validators.stoplight import rule
|
||||
from poppy.transport.validators.stoplight import decorators
|
||||
from poppy.transport.validators.stoplight import exceptions
|
||||
from poppy.transport.validators.stoplight import rule
|
||||
|
||||
from test_service_validation import BaseTestCase
|
||||
# TODO(tonytan4ever): We probably want to move this to a
|
||||
|
@ -13,7 +13,7 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
from cdn.common import decorators
|
||||
from poppy.common import decorators
|
||||
from tests.unit import base
|
||||
|
||||
|
||||
|
@ -17,14 +17,14 @@ import mock
|
||||
|
||||
from oslo.config import cfg
|
||||
|
||||
from cdn.manager.default import driver
|
||||
from cdn.manager.default import services
|
||||
from poppy.manager.default import driver
|
||||
from poppy.manager.default import services
|
||||
from tests.unit import base
|
||||
|
||||
|
||||
class DefaultManagerDriverTests(base.TestCase):
|
||||
@mock.patch('cdn.storage.base.driver.StorageDriverBase')
|
||||
@mock.patch('cdn.provider.base.driver.ProviderDriverBase')
|
||||
@mock.patch('poppy.storage.base.driver.StorageDriverBase')
|
||||
@mock.patch('poppy.provider.base.driver.ProviderDriverBase')
|
||||
def setUp(self, mock_storage, mock_provider):
|
||||
super(DefaultManagerDriverTests, self).setUp()
|
||||
|
||||
|
@ -17,14 +17,14 @@ import mock
|
||||
|
||||
from oslo.config import cfg
|
||||
|
||||
from cdn.manager.default import driver
|
||||
from cdn.manager.default import services
|
||||
from poppy.manager.default import driver
|
||||
from poppy.manager.default import services
|
||||
from tests.unit import base
|
||||
|
||||
|
||||
class DefaultManagerServiceTests(base.TestCase):
|
||||
@mock.patch('cdn.storage.base.driver.StorageDriverBase')
|
||||
@mock.patch('cdn.provider.base.driver.ProviderDriverBase')
|
||||
@mock.patch('poppy.storage.base.driver.StorageDriverBase')
|
||||
@mock.patch('poppy.provider.base.driver.ProviderDriverBase')
|
||||
def setUp(self, mock_driver, mock_provider):
|
||||
super(DefaultManagerServiceTests, self).setUp()
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
import ddt
|
||||
|
||||
from cdn.model.helpers import cachingrule
|
||||
from poppy.model.helpers import cachingrule
|
||||
from tests.unit import base
|
||||
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
import ddt
|
||||
|
||||
from cdn.model.helpers import domain
|
||||
from poppy.model.helpers import domain
|
||||
from tests.unit import base
|
||||
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
import ddt
|
||||
|
||||
from cdn.model.helpers import link
|
||||
from poppy.model.helpers import link
|
||||
from tests.unit import base
|
||||
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
import ddt
|
||||
|
||||
from cdn.model.helpers import origin
|
||||
from poppy.model.helpers import origin
|
||||
from tests.unit import base
|
||||
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
import ddt
|
||||
|
||||
from cdn.model.helpers import restriction
|
||||
from poppy.model.helpers import restriction
|
||||
from tests.unit import base
|
||||
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
import ddt
|
||||
|
||||
from cdn.model.helpers import rule
|
||||
from poppy.model.helpers import rule
|
||||
from tests.unit import base
|
||||
|
||||
|
||||
|
@ -16,9 +16,9 @@
|
||||
|
||||
import ddt
|
||||
|
||||
from cdn.model.helpers import domain
|
||||
from cdn.model.helpers import origin
|
||||
from cdn.model import service
|
||||
from poppy.model.helpers import domain
|
||||
from poppy.model.helpers import origin
|
||||
from poppy.model import service
|
||||
|
||||
from tests.unit import base
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
import fastly
|
||||
import mock
|
||||
|
||||
from cdn.provider.fastly import driver
|
||||
from poppy.provider.fastly import driver
|
||||
from oslo.config import cfg
|
||||
from tests.unit import base
|
||||
|
||||
@ -55,7 +55,7 @@ class TestDriver(base.TestCase):
|
||||
client = provider.client()
|
||||
self.assertNotEquals(client, None)
|
||||
|
||||
@mock.patch('cdn.provider.fastly.controllers.ServiceController')
|
||||
@mock.patch('poppy.provider.fastly.controllers.ServiceController')
|
||||
@mock.patch.object(driver, 'FASTLY_OPTIONS', new=FASTLY_OPTIONS)
|
||||
def test_service_controller(self, MockController):
|
||||
provider = driver.CDNProvider(self.conf)
|
||||
|
@ -18,7 +18,7 @@ import fastly
|
||||
import mock
|
||||
import random
|
||||
|
||||
from cdn.provider.fastly import services
|
||||
from poppy.provider.fastly import services
|
||||
from tests.unit import base
|
||||
|
||||
|
||||
@ -29,8 +29,8 @@ class TestServices(base.TestCase):
|
||||
@mock.patch('fastly.FastlyConnection')
|
||||
@mock.patch('fastly.FastlyService')
|
||||
@mock.patch('fastly.FastlyVersion')
|
||||
@mock.patch('cdn.provider.fastly.services.ServiceController.client')
|
||||
@mock.patch('cdn.provider.fastly.driver.CDNProvider')
|
||||
@mock.patch('poppy.provider.fastly.services.ServiceController.client')
|
||||
@mock.patch('poppy.provider.fastly.driver.CDNProvider')
|
||||
def test_create(self, service_json, mock_connection,
|
||||
mock_service, mock_version, mock_controllerclient,
|
||||
mock_driver):
|
||||
@ -122,8 +122,8 @@ class TestServices(base.TestCase):
|
||||
|
||||
@mock.patch('fastly.FastlyConnection')
|
||||
@mock.patch('fastly.FastlyService')
|
||||
@mock.patch('cdn.provider.fastly.services.ServiceController.client')
|
||||
@mock.patch('cdn.provider.fastly.driver.CDNProvider')
|
||||
@mock.patch('poppy.provider.fastly.services.ServiceController.client')
|
||||
@mock.patch('poppy.provider.fastly.driver.CDNProvider')
|
||||
def test_delete(self, mock_connection, mock_service, mock_client,
|
||||
mock_driver):
|
||||
driver = mock_driver()
|
||||
@ -155,8 +155,8 @@ class TestServices(base.TestCase):
|
||||
controller.client.delete_service.assert_called_once_with(service.id)
|
||||
self.assertIn('domain', resp[driver.provider_name])
|
||||
|
||||
@mock.patch('cdn.provider.fastly.services.ServiceController.client')
|
||||
@mock.patch('cdn.provider.fastly.driver.CDNProvider')
|
||||
@mock.patch('poppy.provider.fastly.services.ServiceController.client')
|
||||
@mock.patch('poppy.provider.fastly.driver.CDNProvider')
|
||||
@ddt.file_data('data_service.json')
|
||||
def test_update(self, mock_get_client, mock_driver, service_json):
|
||||
service_name = 'whatsitnamed'
|
||||
@ -166,7 +166,7 @@ class TestServices(base.TestCase):
|
||||
resp = controller.update(service_name, service_json)
|
||||
self.assertIn('domain', resp[driver.provider_name])
|
||||
|
||||
@mock.patch('cdn.provider.fastly.driver.CDNProvider')
|
||||
@mock.patch('poppy.provider.fastly.driver.CDNProvider')
|
||||
def test_client(self, mock_driver):
|
||||
driver = mock_driver()
|
||||
controller = services.ServiceController(driver)
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
from oslo.config import cfg
|
||||
|
||||
from cdn.provider.mock import driver
|
||||
from poppy.provider.mock import driver
|
||||
from tests.unit import base
|
||||
|
||||
|
||||
|
@ -18,15 +18,15 @@ import mock
|
||||
|
||||
from oslo.config import cfg
|
||||
|
||||
from cdn.storage.cassandra import driver
|
||||
from cdn.storage.cassandra import services
|
||||
from poppy.storage.cassandra import driver
|
||||
from poppy.storage.cassandra import services
|
||||
from tests.unit import base
|
||||
|
||||
|
||||
CASSANDRA_OPTIONS = [
|
||||
cfg.ListOpt('cluster', default='mock_ip',
|
||||
help='Cassandra Cluster contact points'),
|
||||
cfg.StrOpt('keyspace', default='mock_cdn',
|
||||
cfg.StrOpt('keyspace', default='mock_poppy',
|
||||
help='Keyspace for all queries made in session'),
|
||||
]
|
||||
|
||||
@ -44,7 +44,7 @@ class CassandraStorageServiceTests(base.TestCase):
|
||||
self.assertEquals(self.cassandra_driver.cassandra_conf['cluster'],
|
||||
['mock_ip'])
|
||||
self.assertEquals(self.cassandra_driver.cassandra_conf.keyspace,
|
||||
'mock_cdn')
|
||||
'mock_poppy')
|
||||
|
||||
def test_is_alive(self):
|
||||
self.assertEquals(self.cassandra_driver.is_alive(), True)
|
||||
@ -52,7 +52,7 @@ class CassandraStorageServiceTests(base.TestCase):
|
||||
@mock.patch.object(cassandra.cluster.Cluster, 'connect')
|
||||
def test_connection(self, mock_cluster):
|
||||
self.cassandra_driver.connection()
|
||||
mock_cluster.assert_called_with('mock_cdn')
|
||||
mock_cluster.assert_called_with('mock_poppy')
|
||||
|
||||
def test_service_controller(self):
|
||||
sc = self.cassandra_driver.service_controller
|
||||
@ -64,4 +64,4 @@ class CassandraStorageServiceTests(base.TestCase):
|
||||
@mock.patch.object(cassandra.cluster.Cluster, 'connect')
|
||||
def test_service_database(self, mock_cluster):
|
||||
self.cassandra_driver.service_database
|
||||
mock_cluster.assert_called_with('mock_cdn')
|
||||
mock_cluster.assert_called_with('mock_poppy')
|
||||
|
@ -19,8 +19,8 @@ import mock
|
||||
|
||||
from oslo.config import cfg
|
||||
|
||||
from cdn.storage.cassandra import driver
|
||||
from cdn.storage.cassandra import services
|
||||
from poppy.storage.cassandra import driver
|
||||
from poppy.storage.cassandra import services
|
||||
from tests.unit import base
|
||||
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
from oslo.config import cfg
|
||||
|
||||
from cdn.storage.mockdb import driver
|
||||
from poppy.storage.mockdb import driver
|
||||
from tests.unit import base
|
||||
|
||||
|
||||
|
@ -18,7 +18,7 @@ import os
|
||||
import mock
|
||||
from oslo.config import cfg
|
||||
|
||||
from cdn import bootstrap
|
||||
from poppy import bootstrap
|
||||
from tests.unit import base
|
||||
|
||||
|
||||
@ -32,7 +32,7 @@ class TestBootStrap(base.TestCase):
|
||||
|
||||
bootstrap_obj = bootstrap.Bootstrap(cfg.CONF)
|
||||
|
||||
mock_path = 'cdn.transport.pecan.driver.simple_server'
|
||||
mock_path = 'poppy.transport.pecan.driver.simple_server'
|
||||
with mock.patch(mock_path) as mocked_module:
|
||||
mock_server = mock.Mock()
|
||||
mocked_module.make_server = mock.Mock(return_value=mock_server)
|
||||
|
@ -18,7 +18,7 @@ import os
|
||||
import mock
|
||||
from oslo.config import cfg
|
||||
|
||||
from cdn.transport import pecan
|
||||
from poppy.transport import pecan
|
||||
from tests.unit import base
|
||||
|
||||
|
||||
@ -32,7 +32,7 @@ class PecanTransportDriverTest(base.TestCase):
|
||||
conf_path = os.path.join(tests_path, 'etc', 'default_functional.conf')
|
||||
cfg.CONF(args=[], default_config_files=[conf_path])
|
||||
|
||||
mock_path = 'cdn.transport.pecan.driver.simple_server'
|
||||
mock_path = 'poppy.transport.pecan.driver.simple_server'
|
||||
with mock.patch(mock_path) as mocked_module:
|
||||
mock_server = mock.Mock()
|
||||
mocked_module.make_server = mock.Mock(return_value=mock_server)
|
||||
|
Loading…
x
Reference in New Issue
Block a user