Class: OsCtl::Image::Operations::Test::Image

Inherits:
Base
  • Object
show all
Defined in:
lib/osctl/image/operations/test/image.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

run

Constructor Details

#initialize(base_dir, image, tests, opts) ⇒ Image

Returns a new instance of Image.

Parameters:

  • base_dir (String)
  • image (Image)
  • tests (Array<Test>)
  • opts (Hash)

Options Hash (opts):

  • :build_dataset (String)
  • :output_dir (String)
  • :vendor (String)
  • :rebuild (Boolean)
  • :keep_failed (Boolean)
  • :ip_allocator (IpAllocator)


21
22
23
24
25
26
27
# File 'lib/osctl/image/operations/test/image.rb', line 21

def initialize(base_dir, image, tests, opts)
  super()
  @base_dir = base_dir
  @image = image
  @tests = tests
  @opts = opts
end

Instance Attribute Details

#base_dirString (readonly)

Returns:

  • (String)


6
7
8
# File 'lib/osctl/image/operations/test/image.rb', line 6

def base_dir
  @base_dir
end

#imageImage (readonly)

Returns:



9
10
11
# File 'lib/osctl/image/operations/test/image.rb', line 9

def image
  @image
end

#optsObject (readonly, protected)

Returns the value of attribute opts.



47
48
49
# File 'lib/osctl/image/operations/test/image.rb', line 47

def opts
  @opts
end

#testsObject (readonly, protected)

Returns the value of attribute tests.



47
48
49
# File 'lib/osctl/image/operations/test/image.rb', line 47

def tests
  @tests
end

Instance Method Details

#executeArray<Operations::Test::Run::Status>

Returns:



30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/osctl/image/operations/test/image.rb', line 30

def execute
  build = Operations::Image::Build.new(base_dir, image, opts)
  build.execute if opts[:rebuild] || !build.cached?

  tests.map do |test|
    Operations::Test::Run.run(
      base_dir,
      build,
      test,
      keep_failed: opts[:keep_failed],
      ip_allocator: opts[:ip_allocator]
    )
  end
end