Skip to content

Commit

Permalink
add integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Manan007224 committed Jul 8, 2021
1 parent df0c644 commit d83ec42
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 22 deletions.
22 changes: 0 additions & 22 deletions test/integration/inline_verifier_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -536,28 +536,6 @@ def test_null_in_different_order
assert_equal "cutover verification failed for: gftest.test_table_1 [paginationKeys: 1 ] ", ghostferry.error_lines.last["msg"]
end

def test_inline_verifier_fails_if_database_schema_is_changed_during_data_copy
seed_simple_database_with_single_table

ghostferry = new_ghostferry(MINIMAL_GHOSTFERRY, config: { verifier_type: "Inline" })

verification_ran = false
batches_written = 0
ghostferry.on_status(Ghostferry::Status::AFTER_ROW_COPY) do
batches_written += 1
if batches_written == 1
source_db.query("ALTER TABLE #{DEFAULT_FULL_TABLE_NAME} ADD COLUMN extracolumn VARCHAR(15);")
end
end

error_occured = false
ghostferry.on_callback("error") do |err|
raise "ghostferry error ocurred - #{err}"
end

ghostferry.run
end

###################
# Collation Tests #
###################
Expand Down
13 changes: 13 additions & 0 deletions test/integration/interrupt_resume_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -518,6 +518,19 @@ def test_interrupt_resume_idempotence_with_failure_and_writes_to_source
assert_ghostferry_completed(ghostferry, times: 1)
end

def test_interrupt_resume_failure_with_database_schema_changed_during_interrupt
ghostferry = new_ghostferry(MINIMAL_GHOSTFERRY)

ghostferry.on_status(Ghostferry::Status::AFTER_ROW_COPY) do
ghostferry.term_and_wait_for_exit
end

dumped_state = ghostferry.run_expecting_interrupt
source_db.query("ALTER TABLE #{DEFAULT_FULL_TABLE_NAME} ADD COLUMN extracolumn VARCHAR(15);")

ghostferry.run_expecting_failure(dumped_state)
end

def test_resume_from_failure_with_state_callback
ghostferry = new_ghostferry(MINIMAL_GHOSTFERRY)

Expand Down
15 changes: 15 additions & 0 deletions test/integration/trivial_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,19 @@ def test_logged_query_omits_columns
end
end
end

def test_fails_if_database_schema_is_changed_during_data_copy
seed_simple_database_with_single_table
ghostferry = new_ghostferry(MINIMAL_GHOSTFERRY)

batches_written = 0
ghostferry.on_status(Ghostferry::Status::AFTER_ROW_COPY) do
batches_written += 1
if batches_written == 1
source_db.query("ALTER TABLE #{DEFAULT_FULL_TABLE_NAME} ADD COLUMN extracolumn VARCHAR(15);")
end
end

ghostferry.run_expecting_failure
end
end

0 comments on commit d83ec42

Please sign in to comment.