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)


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

def initialize(base_dir, image, tests, opts)
  @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.



43
44
45
# File 'lib/osctl/image/operations/test/image.rb', line 43

def opts
  @opts
end

#testsObject (readonly, protected)

Returns the value of attribute tests.



43
44
45
# File 'lib/osctl/image/operations/test/image.rb', line 43

def tests
  @tests
end

Instance Method Details

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

Returns:



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

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],
    )
  end
end