simmer 2.0.0 → 2.1.0.pre.alpha
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +7 -1
- data/CHANGELOG.md +8 -0
- data/lib/simmer/database/fixture_set.rb +3 -1
- data/lib/simmer/judge/result.rb +1 -1
- data/lib/simmer/runner/result.rb +28 -6
- data/lib/simmer/runner.rb +44 -9
- data/lib/simmer/suite/reporter.rb +1 -1
- data/lib/simmer/suite/result.rb +1 -0
- data/lib/simmer/version.rb +1 -1
- metadata +4 -4
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: f8469413b339324e3aaf45eea56f7245bed4624bd9979e238d1c8538eb1137df
         | 
| 4 | 
            +
              data.tar.gz: cb99f6ececbf91facf3383487455c2beda0739d71c3869755f38ac2f9cbc5fd4
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: b77ab5434f1f1ba2ec7ad7871f988cc5b637fe7488599f445aa5c41a685053542656aeaab68188c700aa576b7dd2539bf53c9842574dee6592b5762949767988
         | 
| 7 | 
            +
              data.tar.gz: bb69b280fa06cb96c3e7582596191fff239250cae05fb76d36c6156ee4f65b7995a5eb4f7632f70e4d115626f60b48c9222ed82dc21de2569c92564ad9cb24bd
         | 
    
        data/.rubocop.yml
    CHANGED
    
    | @@ -13,7 +13,7 @@ Metrics/BlockLength: | |
| 13 13 | 
             
                - define
         | 
| 14 14 |  | 
| 15 15 | 
             
            Metrics/MethodLength:
         | 
| 16 | 
            -
              Max:  | 
| 16 | 
            +
              Max: 30
         | 
| 17 17 |  | 
| 18 18 | 
             
            AllCops:
         | 
| 19 19 | 
             
              TargetRubyVersion: 2.5
         | 
| @@ -23,3 +23,9 @@ Metrics/AbcSize: | |
| 23 23 |  | 
| 24 24 | 
             
            Metrics/ClassLength:
         | 
| 25 25 | 
             
              Max: 125
         | 
| 26 | 
            +
             | 
| 27 | 
            +
            Style/TrailingCommaInHashLiteral:
         | 
| 28 | 
            +
              Enabled: false
         | 
| 29 | 
            +
             | 
| 30 | 
            +
            Style/TrailingCommaInArrayLiteral:
         | 
| 31 | 
            +
              Enabled: false
         | 
    
        data/CHANGELOG.md
    CHANGED
    
    | @@ -1,3 +1,11 @@ | |
| 1 | 
            +
            # 2.1.0 (May 12th, 2020)
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            Additions:
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            * Do not make missing fixtures short-circuit the rest of the test suite.
         | 
| 6 | 
            +
            * Do not make PDI timeouts short-circuit the rest of the test suite.
         | 
| 7 | 
            +
            * Report PDI's exit code and execution time to the console.
         | 
| 8 | 
            +
             | 
| 1 9 | 
             
            # 2.0.0 (May 11th, 2020)
         | 
| 2 10 |  | 
| 3 11 | 
             
            Breaking Changes:
         | 
| @@ -13,6 +13,8 @@ module Simmer | |
| 13 13 | 
             
              module Database
         | 
| 14 14 | 
             
                # Hydrate a collection of Fixture instances from configuration.
         | 
| 15 15 | 
             
                class FixtureSet
         | 
| 16 | 
            +
                  class FixtureMissingError < StandardError; end
         | 
| 17 | 
            +
             | 
| 16 18 | 
             
                  def initialize(config = {})
         | 
| 17 19 | 
             
                    @fixtures_by_name = config_to_fixures_by_name(config)
         | 
| 18 20 |  | 
| @@ -22,7 +24,7 @@ module Simmer | |
| 22 24 | 
             
                  def get!(name)
         | 
| 23 25 | 
             
                    key = name.to_s
         | 
| 24 26 |  | 
| 25 | 
            -
                    raise  | 
| 27 | 
            +
                    raise FixtureMissingError, "fixture missing: #{name}" unless fixtures_by_name.key?(key)
         | 
| 26 28 |  | 
| 27 29 | 
             
                    fixtures_by_name[key]
         | 
| 28 30 | 
             
                  end
         | 
    
        data/lib/simmer/judge/result.rb
    CHANGED
    
    
    
        data/lib/simmer/runner/result.rb
    CHANGED
    
    | @@ -13,23 +13,36 @@ module Simmer | |
| 13 13 | 
             
                class Result
         | 
| 14 14 | 
             
                  extend Forwardable
         | 
| 15 15 |  | 
| 16 | 
            -
                  attr_reader :id, :judge_result, :specification, :spoon_client_result
         | 
| 17 | 
            -
             | 
| 18 | 
            -
                  def_delegators :spoon_client_result, :time_in_seconds
         | 
| 16 | 
            +
                  attr_reader :errors, :id, :judge_result, :specification, :spoon_client_result
         | 
| 19 17 |  | 
| 20 18 | 
             
                  def_delegators :specification, :name
         | 
| 21 19 |  | 
| 22 | 
            -
                  def initialize( | 
| 20 | 
            +
                  def initialize(
         | 
| 21 | 
            +
                    id:,
         | 
| 22 | 
            +
                    specification:,
         | 
| 23 | 
            +
                    judge_result: nil,
         | 
| 24 | 
            +
                    spoon_client_result: nil,
         | 
| 25 | 
            +
                    errors: []
         | 
| 26 | 
            +
                  )
         | 
| 23 27 | 
             
                    @id                  = id.to_s
         | 
| 24 28 | 
             
                    @judge_result        = judge_result
         | 
| 25 29 | 
             
                    @specification       = specification
         | 
| 26 30 | 
             
                    @spoon_client_result = spoon_client_result
         | 
| 31 | 
            +
                    @errors              = Array(errors)
         | 
| 27 32 |  | 
| 28 33 | 
             
                    freeze
         | 
| 29 34 | 
             
                  end
         | 
| 30 35 |  | 
| 36 | 
            +
                  def time_in_seconds
         | 
| 37 | 
            +
                    spoon_client_result&.time_in_seconds || 0
         | 
| 38 | 
            +
                  end
         | 
| 39 | 
            +
             | 
| 31 40 | 
             
                  def pass?
         | 
| 32 | 
            -
                     | 
| 41 | 
            +
                    [
         | 
| 42 | 
            +
                      judge_result&.pass?,
         | 
| 43 | 
            +
                      spoon_client_result&.pass?,
         | 
| 44 | 
            +
                      errors.empty?,
         | 
| 45 | 
            +
                    ].all?
         | 
| 33 46 | 
             
                  end
         | 
| 34 47 |  | 
| 35 48 | 
             
                  def fail?
         | 
| @@ -44,9 +57,18 @@ module Simmer | |
| 44 57 | 
             
                      'time_in_seconds' => time_in_seconds,
         | 
| 45 58 | 
             
                      'pass' => pass?,
         | 
| 46 59 | 
             
                      'spoon_client_result' => spoon_client_result.to_h,
         | 
| 47 | 
            -
                      'judge_result' => judge_result.to_h
         | 
| 60 | 
            +
                      'judge_result' => judge_result.to_h,
         | 
| 61 | 
            +
                      'errors' => errors,
         | 
| 48 62 | 
             
                    }
         | 
| 49 63 | 
             
                  end
         | 
| 64 | 
            +
             | 
| 65 | 
            +
                  def execution_output
         | 
| 66 | 
            +
                    execution_result&.out
         | 
| 67 | 
            +
                  end
         | 
| 68 | 
            +
             | 
| 69 | 
            +
                  def execution_result
         | 
| 70 | 
            +
                    spoon_client_result&.execution_result
         | 
| 71 | 
            +
                  end
         | 
| 50 72 | 
             
                end
         | 
| 51 73 | 
             
              end
         | 
| 52 74 | 
             
            end
         | 
    
        data/lib/simmer/runner.rb
    CHANGED
    
    | @@ -30,18 +30,26 @@ module Simmer | |
| 30 30 | 
             
                  print("Name: #{specification.name}")
         | 
| 31 31 | 
             
                  print("Path: #{specification.path}")
         | 
| 32 32 |  | 
| 33 | 
            -
                   | 
| 34 | 
            -
                  seed_db(specification)
         | 
| 35 | 
            -
                  clean_file_system
         | 
| 36 | 
            -
                  seed_file_system(specification)
         | 
| 33 | 
            +
                  clean_and_seed(specification)
         | 
| 37 34 |  | 
| 38 35 | 
             
                  spoon_client_result = execute_spoon(specification, config)
         | 
| 39 36 | 
             
                  judge_result        = assert(specification, spoon_client_result)
         | 
| 40 37 |  | 
| 41 | 
            -
                  Result.new( | 
| 42 | 
            -
                     | 
| 43 | 
            -
                     | 
| 44 | 
            -
                     | 
| 38 | 
            +
                  Result.new(
         | 
| 39 | 
            +
                    id: id,
         | 
| 40 | 
            +
                    judge_result: judge_result,
         | 
| 41 | 
            +
                    specification: specification,
         | 
| 42 | 
            +
                    spoon_client_result: spoon_client_result
         | 
| 43 | 
            +
                  ).tap do |result|
         | 
| 44 | 
            +
                    print_result(result)
         | 
| 45 | 
            +
                  end
         | 
| 46 | 
            +
                rescue Database::FixtureSet::FixtureMissingError, Timeout::Error => e
         | 
| 47 | 
            +
                  Result.new(
         | 
| 48 | 
            +
                    id: id,
         | 
| 49 | 
            +
                    specification: specification,
         | 
| 50 | 
            +
                    errors: e.message
         | 
| 51 | 
            +
                  ).tap do |result|
         | 
| 52 | 
            +
                    print_result(result)
         | 
| 45 53 | 
             
                  end
         | 
| 46 54 | 
             
                end
         | 
| 47 55 |  | 
| @@ -49,6 +57,19 @@ module Simmer | |
| 49 57 |  | 
| 50 58 | 
             
                attr_reader :database, :file_system, :fixture_set, :judge, :out
         | 
| 51 59 |  | 
| 60 | 
            +
                def print_result(result)
         | 
| 61 | 
            +
                  msg = pass_message(result)
         | 
| 62 | 
            +
                  print_waiting('Done', 'Final verdict')
         | 
| 63 | 
            +
                  print(msg)
         | 
| 64 | 
            +
                end
         | 
| 65 | 
            +
             | 
| 66 | 
            +
                def clean_and_seed(specification)
         | 
| 67 | 
            +
                  clean_db
         | 
| 68 | 
            +
                  seed_db(specification)
         | 
| 69 | 
            +
                  clean_file_system
         | 
| 70 | 
            +
                  seed_file_system(specification)
         | 
| 71 | 
            +
                end
         | 
| 72 | 
            +
             | 
| 52 73 | 
             
                def clean_db
         | 
| 53 74 | 
             
                  print_waiting('Stage', 'Cleaning database')
         | 
| 54 75 | 
             
                  count = database.clean!
         | 
| @@ -66,6 +87,9 @@ module Simmer | |
| 66 87 | 
             
                  print("#{count} record(s) inserted")
         | 
| 67 88 |  | 
| 68 89 | 
             
                  count
         | 
| 90 | 
            +
                rescue Database::FixtureSet::FixtureMissingError => e
         | 
| 91 | 
            +
                  print('Missing Fixture(s)')
         | 
| 92 | 
            +
                  raise e
         | 
| 69 93 | 
             
                end
         | 
| 70 94 |  | 
| 71 95 | 
             
                def clean_file_system
         | 
| @@ -86,11 +110,22 @@ module Simmer | |
| 86 110 |  | 
| 87 111 | 
             
                def execute_spoon(specification, config)
         | 
| 88 112 | 
             
                  print_waiting('Act', 'Executing Spoon')
         | 
| 113 | 
            +
             | 
| 89 114 | 
             
                  spoon_client_result = spoon_client.run(specification, config)
         | 
| 90 | 
            -
                   | 
| 115 | 
            +
                  time_in_seconds     = spoon_client_result.time_in_seconds
         | 
| 116 | 
            +
                  code                = spoon_client_result.execution_result.status.code
         | 
| 117 | 
            +
             | 
| 118 | 
            +
                  msg = [
         | 
| 119 | 
            +
                    pass_message(spoon_client_result),
         | 
| 120 | 
            +
                    "(Exited with code #{code} after #{time_in_seconds} seconds)"
         | 
| 121 | 
            +
                  ].join(' ')
         | 
| 122 | 
            +
             | 
| 91 123 | 
             
                  print(msg)
         | 
| 92 124 |  | 
| 93 125 | 
             
                  spoon_client_result
         | 
| 126 | 
            +
                rescue Timeout::Error => e
         | 
| 127 | 
            +
                  print('Timed out')
         | 
| 128 | 
            +
                  raise e
         | 
| 94 129 | 
             
                end
         | 
| 95 130 |  | 
| 96 131 | 
             
                def assert(specification, spoon_client_result)
         | 
| @@ -58,7 +58,7 @@ module Simmer | |
| 58 58 | 
             
                    runner_results.each do |runner_result|
         | 
| 59 59 | 
             
                      name         = runner_result.name
         | 
| 60 60 | 
             
                      runner_id    = runner_result.id
         | 
| 61 | 
            -
                      out_contents = runner_result. | 
| 61 | 
            +
                      out_contents = runner_result.execution_output
         | 
| 62 62 |  | 
| 63 63 | 
             
                      write_block(pdi_out_file, name, runner_id, out_contents)
         | 
| 64 64 | 
             
                    end
         | 
    
        data/lib/simmer/suite/result.rb
    CHANGED
    
    
    
        data/lib/simmer/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: simmer
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 2.0. | 
| 4 | 
            +
              version: 2.1.0.pre.alpha
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Matthew Ruggio
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: exe
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2020-05- | 
| 11 | 
            +
            date: 2020-05-13 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: acts_as_hashable
         | 
| @@ -275,9 +275,9 @@ required_ruby_version: !ruby/object:Gem::Requirement | |
| 275 275 | 
             
                  version: '2.5'
         | 
| 276 276 | 
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         | 
| 277 277 | 
             
              requirements:
         | 
| 278 | 
            -
              - - " | 
| 278 | 
            +
              - - ">"
         | 
| 279 279 | 
             
                - !ruby/object:Gem::Version
         | 
| 280 | 
            -
                  version:  | 
| 280 | 
            +
                  version: 1.3.1
         | 
| 281 281 | 
             
            requirements: []
         | 
| 282 282 | 
             
            rubygems_version: 3.0.3
         | 
| 283 283 | 
             
            signing_key: 
         |