Sha256: 67fbae2ef62298a5c95669d6ea463b37c96c928570b4060b2d71ea36f9c74121

Contents?: true

Size: 1.1 KB

Versions: 4

Compression:

Stored size: 1.1 KB

Contents

# Copyright (c) 2011 - 2013, SoundCloud Ltd., Rany Keddo, Tobias Bielohlawek, Tobias
# Schmidt

require File.expand_path(File.dirname(__FILE__)) + '/integration_helper'

require 'lhm/table'
require 'lhm/migration'
require 'lhm/locked_switcher'

describe Lhm::LockedSwitcher do
  include IntegrationHelper

  before(:each) { connect_master! }

  describe "switching" do
    before(:each) do
      @origin = table_create("origin")
      @destination = table_create("destination")
      @migration = Lhm::Migration.new(@origin, @destination)
    end

    it "rename origin to archive" do
      switcher = Lhm::LockedSwitcher.new(@migration, connection)
      switcher.run

      slave do
        table_exists?(@origin).must_equal true
        table_read(@migration.archive_name).columns.keys.must_include "origin"
      end
    end

    it "rename destination to origin" do
      switcher = Lhm::LockedSwitcher.new(@migration, connection)
      switcher.run

      slave do
        table_exists?(@destination).must_equal false
        table_read(@origin.name).columns.keys.must_include "destination"
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
lhm-2.1.0 spec/integration/locked_switcher_spec.rb
lhm-2.0.0 spec/integration/locked_switcher_spec.rb
lhm-1.3.0 spec/integration/locked_switcher_spec.rb
lhm-1.2.0 spec/integration/locked_switcher_spec.rb