Sha256: 0c70dc6034186759862adb04474db4b69d0a2341ac23b2b50d517cc851e8521f

Contents?: true

Size: 1.43 KB

Versions: 3

Compression:

Stored size: 1.43 KB

Contents

require 'rubygems'
require 'net/http'
require 'json'
require 'log4r'
require_relative '../lib/depengine/helper/validations'
require_relative '../lib/depengine/provider/cdb'
require_relative '../lib/depengine/log/log'

$exec_file_path = __FILE__
$log       = Log::DeploymentLogger.new
$log.writer.level = Log4r::DEBUG

describe 'the cdb backend' do
  include Provider
  path_to_cdb = File.join(File.dirname(__FILE__), '../../cdb/')

  before(:all) do
    $log.writer.debug 'starting a CDB webserver on port 4567'
    $pid = spawn("rackup #{path_to_cdb}/config.ru -p 4567")
    $log.writer.debug "CDB running as pid #{$pid}"
    sleep(2) # waiting for CDB to come properly
  end

  it 'should deliver a parameter from the cdb by path' do
    worker = Provider::CDB.new
    worker.protocol = 'http'
    worker.host     = 'localhost:4567'
    worker.context  = ''
    worker.env      = 'INT'

    result = worker.get_parameter('module/app/this_is', 0)
    result.should include('INT_module_app')
  end

  it 'should set a parameter in the cdb' do
    worker = Provider::CDB.new
    worker.protocol = 'http'
    worker.host     = 'localhost:4567'
    worker.context  = ''
    worker.env      = 'INT'

    worker.set_parameter('module/app', 'this_is', 'INT_module_app')
    result = worker.get_parameter('module/app/this_is', 0)

    result.should include('INT_module_app')
  end

  after(:all) do
    $log.writer.debug 'killing CDB webserver'
    `kill #{$pid}`
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
depengine-3.0.23 spec/cdb_spec.rb
depengine-3.0.22 spec/cdb_spec.rb
depengine-3.0.21 spec/cdb_spec.rb