Skip to content

Commit

Permalink
Allow empty finders configuration, added test for it. Resolves brutas…
Browse files Browse the repository at this point in the history
  • Loading branch information
pkittenis committed Feb 28, 2017
1 parent 5d8a734 commit f560816
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 1 deletion.
2 changes: 1 addition & 1 deletion graphite_api/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def configure(app):
loaded_config['carbon'] = config.get('carbon', None)

finders = []
for finder in config['finders']:
for finder in [f for f in config['finders'] if f]:
finders.append(load_by_path(finder)(config))
loaded_config['store'] = Store(finders)
app.config['GRAPHITE'] = loaded_config
Expand Down
21 changes: 21 additions & 0 deletions tests/no_finders_conf.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
time_zone: UTC
allowed_origins:
- example.com
- foo.example.com:8888
cache:
type: simple
default_timeout: 0
logging:
version: 1
disable_existing_loggers: true
handlers:
stdout:
class: logging.StreamHandler
loggers:
graphite_api:
handlers:
- stdout
propagate: true
level: INFO
finders:
-
14 changes: 14 additions & 0 deletions tests/test_config_no_finders.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import os
import unittest

os.environ['GRAPHITE_API_CONFIG'] = os.path.join(
os.path.dirname(__file__), 'no_finders_conf.yaml') # noqa

from graphite_api.app import app
from graphite_api.config import configure

class NoFindersTest(unittest.TestCase):

def test_app_no_finders(self):
configure(app)
self.assertTrue(app is not None)

0 comments on commit f560816

Please sign in to comment.