Class: BarkingIguana::Compound::AnsibleSpec

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Includes:
Benchmark, Logging::Helper
Defined in:
lib/barking_iguana/compound/ansible_spec.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(stage) ⇒ AnsibleSpec

Returns a new instance of AnsibleSpec.



7
8
9
# File 'lib/barking_iguana/compound/ansible_spec.rb', line 7

def initialize stage
  self.stage = stage
end

Instance Attribute Details

#stageObject

Returns the value of attribute stage.



5
6
7
# File 'lib/barking_iguana/compound/ansible_spec.rb', line 5

def stage
  @stage
end

Instance Method Details

#runObject



14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/barking_iguana/compound/ansible_spec.rb', line 14

def run
  unless File.exists? ansible_test_directory
    logger.debug { "#{ansible_test_directory} doesn't exist, assuming no ansible tests for this stage" }
    return
  end

  command = "bundle exec ruby -S rspec -r #{spec_helper} #{test_files.join(' ')}"
  c = Mixlib::ShellOut.new command, live_stream: logger, cwd: control_repo_dir, env: env
  benchmark command do
    c.run_command
  end
  logger.info { "ansible tests exited with status #{c.exitstatus}" }
  c.error!
end