SAAS-560: Deploy separate cloud storage config files for each development environment
Default to production config files if dev env specific files are not found. Fix analyzer unit tests.
This commit is contained in:
parent
e2ff452b8a
commit
cee0ff4881
|
@ -43,6 +43,11 @@ class Config {
|
|||
|
||||
// Parse separate conf file for cloud storage values
|
||||
$cloudStorageConfig = "/etc/airtime-saas/".$CC_CONFIG['dev_env']."/cloud_storage.conf";
|
||||
if (!file_exists($cloudStorageConfig)) {
|
||||
// If the dev env specific cloud_storage.conf doesn't exist default
|
||||
// to the production cloud_storage.conf
|
||||
$cloudStorageConfig = "/etc/airtime-saas/production/cloud_storage.conf";
|
||||
}
|
||||
$cloudStorageValues = parse_ini_file($cloudStorageConfig, true);
|
||||
|
||||
$CC_CONFIG["supportedStorageBackends"] = array('amazon_S3');
|
||||
|
|
|
@ -89,7 +89,13 @@ class Application_Model_RabbitMq
|
|||
if (array_key_exists("dev_env", $CC_CONFIG)) {
|
||||
$devEnv = $CC_CONFIG["dev_env"];
|
||||
}
|
||||
$config = parse_ini_file("/etc/airtime-saas/".$devEnv."/rabbitmq-analyzer.ini", true);
|
||||
$rmq_config_path = "/etc/airtime-saas/".$devEnv."/rabbitmq-analyzer.ini";
|
||||
if (!file_exists($rmq_config_path)) {
|
||||
// If the dev env specific rabbitmq-analyzer.ini doesn't exist default
|
||||
// to the production rabbitmq-analyzer.ini
|
||||
$rmq_config_path = "/etc/airtime-saas/production/rabbitmq-analyzer.ini";
|
||||
}
|
||||
$config = parse_ini_file($rmq_config_path, true);
|
||||
$conn = new AMQPConnection($config["rabbitmq"]["host"],
|
||||
$config["rabbitmq"]["port"],
|
||||
$config["rabbitmq"]["user"],
|
||||
|
|
|
@ -5,6 +5,7 @@ import multiprocessing
|
|||
import Queue
|
||||
import datetime
|
||||
from airtime_analyzer.analyzer_pipeline import AnalyzerPipeline
|
||||
from airtime_analyzer import config_file
|
||||
|
||||
DEFAULT_AUDIO_FILE = u'tests/test_data/44100Hz-16bit-mono.mp3'
|
||||
DEFAULT_IMPORT_DEST = u'Test Artist/Test Album/44100Hz-16bit-mono.mp3'
|
||||
|
@ -20,10 +21,11 @@ def teardown():
|
|||
def test_basic():
|
||||
filename = os.path.basename(DEFAULT_AUDIO_FILE)
|
||||
q = multiprocessing.Queue()
|
||||
cloud_storage_enabled = False
|
||||
cloud_storage_config_path = '/etc/airtime-saas/production/cloud_storage.conf'
|
||||
cloud_storage_config = config_file.read_config_file(cloud_storage_config_path)
|
||||
file_prefix = u''
|
||||
#This actually imports the file into the "./Test Artist" directory.
|
||||
AnalyzerPipeline.run_analysis(q, DEFAULT_AUDIO_FILE, u'.', filename, file_prefix, cloud_storage_enabled)
|
||||
AnalyzerPipeline.run_analysis(q, DEFAULT_AUDIO_FILE, u'.', filename, file_prefix, cloud_storage_config)
|
||||
metadata = q.get()
|
||||
assert metadata['track_title'] == u'Test Title'
|
||||
assert metadata['artist_name'] == u'Test Artist'
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
from nose.tools import *
|
||||
from airtime_analyzer.cloud_storage_uploader import CloudStorageUploader
|
||||
from airtime_analyzer.airtime_analyzer import AirtimeAnalyzerServer
|
||||
from airtime_analyzer import config_file
|
||||
|
||||
def setup():
|
||||
pass
|
||||
|
@ -9,5 +10,7 @@ def teardown():
|
|||
pass
|
||||
|
||||
def test_analyze():
|
||||
cl = CloudStorageUploader()
|
||||
cloud_storage_config_path = '/etc/airtime-saas/production/cloud_storage.conf'
|
||||
cloud_storage_config = config_file.read_config_file(cloud_storage_config_path)
|
||||
cl = CloudStorageUploader(cloud_storage_config)
|
||||
cl._storage_backend = "file"
|
Loading…
Reference in New Issue