Sha256: b3821f0ef653b8b43be50749b1d2183846417f46274dbf99021473c2ba77f70f

Contents?: true

Size: 1.9 KB

Versions: 13

Compression:

Stored size: 1.9 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    = '/INT/dbde/dboverallsearch/port'
  path_to_cdb = File.join(File.dirname(__FILE__), '../../cdb/')
  version = 0

  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 deliver all parameters for an app from the cdb by path" do
    worker = Provider::CDB.new
    worker.protocol = 'http'
    worker.host     = 'localhost:4567'
    worker.context  = ''
    worker.env      = 'STAGE'

    result = worker.get_parameters('testing/helloworld', 0)

    result['env'].should include("STAGE")
    result['patch_config_helloworld']['URL'].should include("www.neue-url.de")
  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

13 entries across 13 versions & 1 rubygems

Version Path
depengine-3.0.12 spec/cdb_spec.rb
depengine-3.0.11 spec/cdb_spec.rb
depengine-3.0.10 spec/cdb_spec.rb
depengine-3.0.9 spec/cdb_spec.rb
depengine-3.0.8 spec/cdb_spec.rb
depengine-3.0.7 spec/cdb_spec.rb
depengine-3.0.6 spec/cdb_spec.rb
depengine-3.0.5 spec/cdb_spec.rb
depengine-3.0.4 spec/cdb_spec.rb
depengine-3.0.3 spec/cdb_spec.rb
depengine-3.0.2 spec/cdb_spec.rb
depengine-3.0.1 spec/cdb_spec.rb
depengine-3.0.0 spec/cdb_spec.rb