Sha256: d558dea0c1452176fa33bf4743ca67ff08e348fe7046d806f4f85834ef3242d1

Contents?: true

Size: 1.27 KB

Versions: 11

Compression:

Stored size: 1.27 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) do
    connect_master!
    @old_logger = Lhm.logger
    Lhm.logger = Logger.new('/dev/null')
  end

  after(:each) do
    Lhm.logger = @old_logger
  end

  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

      replica do
        value(data_source_exists?(@origin)).must_equal true
        value(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

      replica do
        value(data_source_exists?(@destination)).must_equal false
        value(table_read(@origin.name).columns.keys).must_include 'destination'
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
lhm-shopify-4.4.2 spec/integration/locked_switcher_spec.rb
lhm-shopify-4.4.1 spec/integration/locked_switcher_spec.rb
lhm-shopify-4.4.0 spec/integration/locked_switcher_spec.rb
lhm-shopify-4.3.0 spec/integration/locked_switcher_spec.rb
lhm-shopify-4.2.3 spec/integration/locked_switcher_spec.rb
lhm-shopify-4.2.2 spec/integration/locked_switcher_spec.rb
lhm-shopify-4.2.1 spec/integration/locked_switcher_spec.rb
lhm-shopify-4.2.0 spec/integration/locked_switcher_spec.rb
lhm-shopify-4.1.1 spec/integration/locked_switcher_spec.rb
lhm-shopify-4.1.0 spec/integration/locked_switcher_spec.rb
lhm-shopify-4.0.0 spec/integration/locked_switcher_spec.rb