Skip to content

Instantly share code, notes, and snippets.

@mostlyobvious
Created January 12, 2024 12:16
Show Gist options
  • Save mostlyobvious/35d33d34e1f89d205e81e6cacb45830e to your computer and use it in GitHub Desktop.
Save mostlyobvious/35d33d34e1f89d205e81e6cacb45830e to your computer and use it in GitHub Desktop.
Coverband: detected SimpleCov in test Env, allowing it to start Coverage
Coverband: to ensure no error logs or missing Coverage call `SimpleCov.start` prior to requiring Coverband
E, [2024-01-12T13:15:02.944498 #82333] ERROR -- : coverage failed to store
E, [2024-01-12T13:15:02.944537 #82333] ERROR -- : Coverband Error: #<RuntimeError: coverage measurement is not enabled> coverage measurement is not enabled
E, [2024-01-12T13:15:03.339597 #82333] ERROR -- : coverage failed to store
E, [2024-01-12T13:15:03.339629 #82333] ERROR -- : Coverband Error: #<RuntimeError: coverage measurement is not enabled> coverage measurement is not enabled
Module#name from: REXML::Functions raised an error: #<NoMethodError: undefined method `[]' for nil:NilClass>. Fix your lib to follow normal ruby semantics!
{Module,Class}#name should return resolvable constant name as String or nil
Class#name from: Faker::Travel::Airport raised an error: #<ArgumentError: missing keywords: :size, :region>. Fix your lib to follow normal ruby semantics!
{Module,Class}#name should return resolvable constant name as String or nil
Mutant environment:
Matcher: #<Mutant::Matcher::Config subjects: [Domains::Underwriting::Services::RoofAgeService#roof_age_info]>
Integration: rspec
Jobs: 8
Includes: ["spec"]
Requires: ["./config/environment"]
Operators: light
Subjects: 1
All-Tests: 14808
Available-Tests: 14808
Selected-Tests: 1
Tests/Subject: 1.00 avg
Mutations: 156
progress: 00/156 alive: 0 runtime: 1.07s killtime: 0.00s mutations/s: 0.00
progress: 00/156 alive: 0 runtime: 2.08s killtime: 0.00s mutations/s: 0.00
progress: 00/156 alive: 0 runtime: 3.09s killtime: 0.00s mutations/s: 0.00
progress: 00/156 alive: 0 runtime: 4.12s killtime: 0.00s mutations/s: 0.00
progress: 08/156 alive: 1 runtime: 5.12s killtime: 18.47s mutations/s: 1.56
progress: 08/156 alive: 1 runtime: 6.12s killtime: 18.47s mutations/s: 1.31
progress: 08/156 alive: 1 runtime: 7.13s killtime: 18.47s mutations/s: 1.12
progress: 08/156 alive: 1 runtime: 8.14s killtime: 18.47s mutations/s: 0.98
progress: 16/156 alive: 1 runtime: 9.15s killtime: 36.37s mutations/s: 1.75
progress: 16/156 alive: 1 runtime: 10.15s killtime: 36.37s mutations/s: 1.58
progress: 16/156 alive: 1 runtime: 11.16s killtime: 36.37s mutations/s: 1.43
progress: 16/156 alive: 1 runtime: 12.17s killtime: 36.37s mutations/s: 1.31
progress: 24/156 alive: 1 runtime: 13.17s killtime: 55.12s mutations/s: 1.82
progress: 24/156 alive: 1 runtime: 14.18s killtime: 55.12s mutations/s: 1.69
progress: 24/156 alive: 1 runtime: 15.19s killtime: 55.12s mutations/s: 1.58
progress: 24/156 alive: 1 runtime: 16.19s killtime: 55.12s mutations/s: 1.48
progress: 32/156 alive: 1 runtime: 17.20s killtime: 71.94s mutations/s: 1.86
progress: 32/156 alive: 1 runtime: 18.21s killtime: 71.94s mutations/s: 1.76
progress: 32/156 alive: 1 runtime: 19.25s killtime: 71.94s mutations/s: 1.66
progress: 32/156 alive: 1 runtime: 20.26s killtime: 71.94s mutations/s: 1.58
progress: 40/156 alive: 1 runtime: 21.26s killtime: 89.71s mutations/s: 1.88
progress: 40/156 alive: 1 runtime: 22.29s killtime: 89.71s mutations/s: 1.79
progress: 40/156 alive: 1 runtime: 23.31s killtime: 89.71s mutations/s: 1.72
progress: 40/156 alive: 1 runtime: 24.34s killtime: 89.71s mutations/s: 1.64
progress: 48/156 alive: 1 runtime: 25.34s killtime: 107.15s mutations/s: 1.89
progress: 48/156 alive: 1 runtime: 26.35s killtime: 107.15s mutations/s: 1.82
progress: 48/156 alive: 1 runtime: 27.36s killtime: 107.15s mutations/s: 1.75
progress: 48/156 alive: 1 runtime: 28.37s killtime: 107.15s mutations/s: 1.69
progress: 56/156 alive: 1 runtime: 29.37s killtime: 123.56s mutations/s: 1.91
progress: 56/156 alive: 1 runtime: 30.38s killtime: 123.56s mutations/s: 1.84
progress: 56/156 alive: 1 runtime: 31.39s killtime: 123.56s mutations/s: 1.78
progress: 56/156 alive: 1 runtime: 32.40s killtime: 123.56s mutations/s: 1.73
progress: 64/156 alive: 1 runtime: 33.43s killtime: 141.17s mutations/s: 1.91
progress: 64/156 alive: 1 runtime: 34.46s killtime: 141.17s mutations/s: 1.86
progress: 64/156 alive: 1 runtime: 35.47s killtime: 141.17s mutations/s: 1.80
progress: 64/156 alive: 1 runtime: 36.47s killtime: 141.17s mutations/s: 1.75
progress: 64/156 alive: 1 runtime: 37.48s killtime: 141.17s mutations/s: 1.71
progress: 72/156 alive: 1 runtime: 38.48s killtime: 163.54s mutations/s: 1.87
progress: 72/156 alive: 1 runtime: 39.48s killtime: 163.54s mutations/s: 1.82
progress: 72/156 alive: 1 runtime: 40.51s killtime: 163.54s mutations/s: 1.78
progress: 72/156 alive: 1 runtime: 41.52s killtime: 163.54s mutations/s: 1.73
progress: 80/156 alive: 1 runtime: 42.53s killtime: 182.43s mutations/s: 1.88
progress: 80/156 alive: 1 runtime: 43.53s killtime: 182.43s mutations/s: 1.84
progress: 80/156 alive: 1 runtime: 44.55s killtime: 182.43s mutations/s: 1.80
progress: 80/156 alive: 1 runtime: 45.56s killtime: 182.43s mutations/s: 1.76
progress: 80/156 alive: 1 runtime: 46.56s killtime: 182.43s mutations/s: 1.72
progress: 88/156 alive: 1 runtime: 47.56s killtime: 207.44s mutations/s: 1.85
progress: 88/156 alive: 1 runtime: 48.57s killtime: 207.44s mutations/s: 1.81
progress: 88/156 alive: 1 runtime: 49.57s killtime: 207.44s mutations/s: 1.78
progress: 88/156 alive: 1 runtime: 50.58s killtime: 207.44s mutations/s: 1.74
progress: 96/156 alive: 1 runtime: 51.58s killtime: 224.54s mutations/s: 1.86
progress: 96/156 alive: 1 runtime: 52.58s killtime: 224.54s mutations/s: 1.83
progress: 96/156 alive: 1 runtime: 53.59s killtime: 224.54s mutations/s: 1.79
progress: 96/156 alive: 1 runtime: 54.60s killtime: 224.54s mutations/s: 1.76
progress: 104/156 alive: 1 runtime: 55.60s killtime: 241.37s mutations/s: 1.87
progress: 104/156 alive: 1 runtime: 56.60s killtime: 241.37s mutations/s: 1.84
progress: 104/156 alive: 1 runtime: 57.61s killtime: 241.37s mutations/s: 1.81
progress: 106/156 alive: 1 runtime: 58.61s killtime: 244.88s mutations/s: 1.81
progress: 112/156 alive: 1 runtime: 59.62s killtime: 257.56s mutations/s: 1.88
progress: 112/156 alive: 1 runtime: 60.62s killtime: 257.56s mutations/s: 1.85
progress: 112/156 alive: 1 runtime: 61.62s killtime: 257.56s mutations/s: 1.82
progress: 118/156 alive: 1 runtime: 62.63s killtime: 269.05s mutations/s: 1.88
progress: 120/156 alive: 1 runtime: 63.63s killtime: 273.30s mutations/s: 1.89
progress: 120/156 alive: 1 runtime: 64.65s killtime: 273.30s mutations/s: 1.86
progress: 120/156 alive: 1 runtime: 65.65s killtime: 273.30s mutations/s: 1.83
progress: 127/156 alive: 1 runtime: 66.67s killtime: 289.36s mutations/s: 1.90
progress: 128/156 alive: 1 runtime: 67.67s killtime: 291.82s mutations/s: 1.89
progress: 128/156 alive: 1 runtime: 68.68s killtime: 291.82s mutations/s: 1.86
progress: 130/156 alive: 1 runtime: 69.69s killtime: 295.04s mutations/s: 1.87
progress: 136/156 alive: 1 runtime: 70.69s killtime: 307.02s mutations/s: 1.92
progress: 136/156 alive: 1 runtime: 71.69s killtime: 307.02s mutations/s: 1.90
progress: 138/156 alive: 1 runtime: 72.70s killtime: 310.40s mutations/s: 1.90
progress: 138/156 alive: 1 runtime: 73.70s killtime: 310.40s mutations/s: 1.87
progress: 144/156 alive: 1 runtime: 74.70s killtime: 320.95s mutations/s: 1.93
progress: 145/156 alive: 1 runtime: 75.71s killtime: 322.62s mutations/s: 1.92
progress: 146/156 alive: 1 runtime: 76.71s killtime: 324.25s mutations/s: 1.90
progress: 152/156 alive: 1 runtime: 77.72s killtime: 334.77s mutations/s: 1.96
progress: 154/156 alive: 1 runtime: 78.72s killtime: 338.31s mutations/s: 1.96
Domains::Underwriting::Services::RoofAgeService#roof_age_info:/Users/mostlyobvious/Lemonade/lemonade/lib/domains/underwriting/services/roof_age_service.rb:48
- rspec:6786:./spec/lib/domains/underwriting/services/roof_age_service_spec.rb:174/Domains::Underwriting::Services::RoofAgeService#roof_age_info returns the roof age from user input if it exists
neutral:Domains::Underwriting::Services::RoofAgeService#roof_age_info:/Users/mostlyobvious/Lemonade/lemonade/lib/domains/underwriting/services/roof_age_service.rb:48:15a4c
-----------------------
Killfork: #<Process::Status: pid 82361 exit 0>
Log messages (combined stderr and stdout):
[killfork]
[killfork] Randomized with seed 5825
[killfork] WARNING: MYSQL_OPT_RECONNECT is deprecated and will be removed in a future version.
[killfork] Version 2 of the Ruby SDK will enter maintenance mode as of November 20, 2020. To continue receiving service updates and new features, please upgrade to Version 3. More information can be found here: https://aws.amazon.com/blogs/developer/deprecation-schedule-for-aws-sdk-for-ruby-v2/
[killfork] F
[killfork]
[killfork] Failures:
[killfork]
[killfork] 1) Domains::Underwriting::Services::RoofAgeService#roof_age_info returns the roof age from user input if it exists
[killfork] Got 0 failures and 2 other errors:
[killfork]
[killfork] 1.1) Failure/Error: user_id { create(:user_email).id }
[killfork]
[killfork] ActiveRecord::StatementInvalid:
[killfork] Mysql2::Error::ConnectionError: Lost connection to MySQL server during query
[killfork] # ./spec/factories/quote.rb:3:in `block (3 levels) in <main>'
[killfork] # ./spec/lib/domains/underwriting/services/roof_age_service_spec.rb:178:in `block (3 levels) in <top (required)>'
[killfork] # ------------------
[killfork] # --- Caused by: ---
[killfork] # Mysql2::Error::ConnectionError:
[killfork] # Lost connection to MySQL server during query
[killfork] # ./spec/factories/quote.rb:3:in `block (3 levels) in <main>'
[killfork]
[killfork] 1.2) Failure/Error: DatabaseCleaner[:active_record].clean
[killfork]
[killfork] ActiveRecord::ConnectionNotEstablished:
[killfork] MySQL client is not connected
[killfork] # ./spec/rails_helper.rb:57:in `block (2 levels) in <top (required)>'
[killfork] # ------------------
[killfork] # --- Caused by: ---
[killfork] # Mysql2::Error:
[killfork] # MySQL client is not connected
[killfork] # ./spec/rails_helper.rb:57:in `block (2 levels) in <top (required)>'
[killfork]
[killfork] Finished in 1.9 seconds (files took 7.75 seconds to load)
[killfork] 1 example, 1 failure
[killfork]
[killfork] Failed examples:
[killfork]
[killfork] rspec ./spec/lib/domains/underwriting/services/roof_age_service_spec.rb:174 # Domains::Underwriting::Services::RoofAgeService#roof_age_info returns the roof age from user input if it exists
[killfork]
[killfork] Randomized with seed 5825
[killfork]
--- Neutral failure ---
Original code was inserted unmutated. And the test did NOT PASS.
Your tests do not pass initially or you found a bug in mutant / unparser.
Subject AST:
s(:def, :roof_age_info,
s(:args,
s(:arg, :quote)),
s(:begin,
s(:if,
s(:lvar, :quote), nil,
s(:return,
s(:nil))),
s(:lvasgn, :quote_uw_data,
s(:send, nil, :get_roof_age_from_uw_data,
s(:send,
s(:lvar, :quote), :uw_data_id))),
s(:lvasgn, :user_roof_age,
s(:send, nil, :user_roof_age_input,
s(:send,
s(:lvar, :quote), :created_at),
s(:send,
s(:lvar, :quote), :answers),
s(:send,
s(:lvar, :quote), :get_attribute_from_answers_or_request,
s(:sym, :roof_updated_year)),
s(:send,
s(:lvar, :quote), :has_chat_flag?,
s(:sym, :risk_roof_age_main_flow)))),
s(:lvasgn, :quote_uw_vendor_roof_age,
s(:csend,
s(:lvar, :quote_uw_data), :vendor_roof_age)),
s(:lvasgn, :quote_uw_vendor_source,
s(:begin,
s(:or,
s(:csend,
s(:lvar, :quote_uw_data), :vendor_roof_age_source),
s(:const,
s(:const, nil, :Source), :NONE)))),
s(:if,
s(:send,
s(:lvar, :user_roof_age), :present?),
s(:begin,
s(:lvasgn, :user_roof_age_int,
s(:send, nil, :transform_roof_age_from_answers_to_int,
s(:kwargs,
s(:pair,
s(:sym, :roof_age_from_answers),
s(:lvar, :user_roof_age)),
s(:pair,
s(:sym, :quote_public_id),
s(:send,
s(:lvar, :quote), :encrypted_id))))),
s(:lvasgn, :user_answer_same_as_vendor_data,
s(:begin,
s(:send,
s(:lvar, :quote_uw_vendor_roof_age), :==,
s(:lvar, :user_roof_age_int)))),
s(:lvasgn, :source,
s(:if,
s(:lvar, :user_answer_same_as_vendor_data),
s(:lvar, :quote_uw_vendor_source),
s(:const,
s(:const, nil, :Source), :USER))),
s(:return,
s(:send,
s(:const, nil, :RoofDataModel), :new,
s(:kwargs,
s(:pair,
s(:sym, :age),
s(:lvar, :user_roof_age_int)),
s(:pair,
s(:sym, :source),
s(:lvar, :source)))))), nil),
s(:if,
s(:send,
s(:lvar, :quote_uw_vendor_roof_age), :present?), nil,
s(:return,
s(:nil))),
s(:send,
s(:const, nil, :RoofDataModel), :new,
s(:kwargs,
s(:pair,
s(:sym, :age),
s(:lvar, :quote_uw_vendor_roof_age)),
s(:pair,
s(:sym, :source),
s(:lvar, :quote_uw_vendor_source))))))
Unparsed Source:
def roof_age_info(quote)
unless quote
return nil
end
quote_uw_data = get_roof_age_from_uw_data(quote.uw_data_id)
user_roof_age = user_roof_age_input(quote.created_at, quote.answers, quote.get_attribute_from_answers_or_request(:roof_updated_year), quote.has_chat_flag?(:risk_roof_age_main_flow))
quote_uw_vendor_roof_age = quote_uw_data&.vendor_roof_age
quote_uw_vendor_source = (quote_uw_data&.vendor_roof_age_source || Source::NONE)
if user_roof_age.present?
user_roof_age_int = transform_roof_age_from_answers_to_int(roof_age_from_answers: user_roof_age, quote_public_id: quote.encrypted_id)
user_answer_same_as_vendor_data = (quote_uw_vendor_roof_age == user_roof_age_int)
source = if user_answer_same_as_vendor_data
quote_uw_vendor_source
else
Source::USER
end
return RoofDataModel.new(age: user_roof_age_int, source: source)
end
unless quote_uw_vendor_roof_age.present?
return nil
end
RoofDataModel.new(age: quote_uw_vendor_roof_age, source: quote_uw_vendor_source)
end
-----------------------
Mutant environment:
Matcher: #<Mutant::Matcher::Config subjects: [Domains::Underwriting::Services::RoofAgeService#roof_age_info]>
Integration: rspec
Jobs: 8
Includes: ["spec"]
Requires: ["./config/environment"]
Operators: light
Subjects: 1
All-Tests: 14808
Available-Tests: 14808
Selected-Tests: 1
Tests/Subject: 1.00 avg
Mutations: 156
Results: 156
Kills: 155
Alive: 1
Timeouts: 0
Runtime: 79.41s
Killtime: 340.43s
Overhead: -76.67%
Mutations/s: 1.96
Coverage: 99.36%
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment