Class: EbDeployer::SmokeTest

Inherits:
Object
  • Object
show all
Defined in:
lib/eb_deployer/smoke_test.rb

Instance Method Summary collapse

Constructor Details

#initialize(test_body) ⇒ SmokeTest

Returns a new instance of SmokeTest.



3
4
5
# File 'lib/eb_deployer/smoke_test.rb', line 3

def initialize(test_body)
  @test_body = test_body
end

Instance Method Details

#run(host_name, logger = nil) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/eb_deployer/smoke_test.rb', line 7

def run(host_name, logger=nil)
  return unless @test_body
  logger.log("running smoke test for #{host_name}...") if logger

  case @test_body
  when Proc
    @test_body.call(host_name)
  when String
    eval(@test_body, binding)
  else
    raise "smoke test can only be a string to evaluate or a proc object such as lambda"
  end

  logger.log("smoke test succeeded.") if logger
end