Sha256: bd975325222b196ba34c6941e5a52660bdb58306864eef25510a84efb6a30790

Contents?: true

Size: 1.56 KB

Versions: 1

Compression:

Stored size: 1.56 KB

Contents

require 'YAML'
require 'test/unit'

class TC_Config < Test::Unit::TestCase
  def test_hosts_cinfig
    hosts = ([{
      :ip => 'http://10.2.226.20:9876'
      },{
      :ip => 'http://10.2.226.37',
      :pids => %w[123,456,789]
    }])

    File.open( File.join(File.dirname(__FILE__),'config','hosts.yaml'), 'w' ) do |out|
      YAML.dump( hosts, out )
    end

    p IO.read(File.join(File.dirname(__FILE__),'config','hosts.yaml'))

    hostsx = nil

    File.open( File.join(File.dirname(__FILE__),'config','hosts.yaml') ) { |yf| hostsx = YAML::load( yf ) }

    assert(hostsx === hosts)
  end

  def test_memcache_config
    caches = ['http://10.2.226.20:10001','http://10.2.226.20:10002','http://10.2.226.20:10003','http://10.2.226.20:10004']

    File.open( File.join(File.dirname(__FILE__),'config','memcache.yaml'), 'w' ) do |out|
      YAML.dump( caches, out )
    end

    p IO.read(File.join(File.dirname(__FILE__),'config','memcache.yaml'))

    cachesx = nil

    File.open( File.join(File.dirname(__FILE__),'config','memcache.yaml') ) { |yf| cachesx = YAML::load( yf ) }

    assert(cachesx === caches)
  end
  
  def test_log_config
    # require "rubygems"
    # require "log4r"
    # include Log4r
    
    level = 4
    
    File.open( File.join(File.dirname(__FILE__),'config','log.yaml'), 'w' ) do |out|
      YAML.dump( level, out )
    end

    p IO.read(File.join(File.dirname(__FILE__),'config','log.yaml'))

    levelx = nil

    File.open( File.join(File.dirname(__FILE__),'config','log.yaml') ) { |yf| levelx = YAML::load( yf ) }

    assert(levelx === level)
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
lpmp-1.0.0 test/config.rb