Skip to content

Commit

Permalink
Extend tests to have better error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
driv3r committed Sep 11, 2024
1 parent 535a320 commit e6eb592
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions test/integration/interrupt_resume_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,11 @@ def test_interrupt_resume_inline_verifier_with_datawriter
end

dumped_state = ghostferry.run_expecting_interrupt
extra_message = "dumped state was: #{dumped_state.inspect}, expecting something under 'BinlogVerifyStore"
assert_basic_fields_exist_in_dumped_state(dumped_state)
refute_nil dumped_state["BinlogVerifyStore"]
refute_nil dumped_state["BinlogVerifyStore"]["gftest"]
refute_nil dumped_state["BinlogVerifyStore"]["gftest"]["test_table_1"]
refute_nil dumped_state["BinlogVerifyStore"], "#{extra_message}'"
refute_nil dumped_state["BinlogVerifyStore"]["gftest"], "#{extra_message}.gftest'"
refute_nil dumped_state["BinlogVerifyStore"]["gftest"]["test_table_1"], "#{extra_message}.gftest.test_table_1'"

# Resume Ghostferry with dumped state
ghostferry = new_ghostferry(MINIMAL_GHOSTFERRY, config: { verifier_type: "Inline" })
Expand Down Expand Up @@ -297,8 +298,11 @@ def test_interrupt_resume_inline_verifier_will_verify_additional_rows_changed_on
assert_equal 1, incorrect_tables.length
assert_equal "gftest.test_table_1", incorrect_tables.first

error_line = ghostferry.error_lines.last
assert error_line["msg"].start_with?("cutover verification failed for: gftest.test_table_1 [paginationKeys: #{chosen_id}")
error_message = ghostferry.error_lines.last["msg"]
predicate = "cutover verification failed for: gftest.test_table_1 [paginationKeys: #{chosen_id}"
expectation = error_message.start_with?(predicate)

assert expectation, "error message: #{error_message.inspect}, didn't start with #{predicate.inspect}"
end

# originally taken from @kolbitsch-lastline in https://github.com/Shopify/ghostferry/pull/160
Expand Down

0 comments on commit e6eb592

Please sign in to comment.