Sha256: 59f0a793b974002a47dcae3c20ea4b2115c76b438aeabb1db5c44251f0d2f36f

Contents?: true

Size: 1.27 KB

Versions: 13

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

      slave 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

      slave 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

13 entries across 13 versions & 2 rubygems

Version Path
lhm-teak-3.6.4 spec/integration/locked_switcher_spec.rb
lhm-teak-3.6.3 spec/integration/locked_switcher_spec.rb
lhm-teak-3.6.2 spec/integration/locked_switcher_spec.rb
lhm-teak-3.6.1 spec/integration/locked_switcher_spec.rb
lhm-teak-3.6.0 spec/integration/locked_switcher_spec.rb
lhm-shopify-3.5.5 spec/integration/locked_switcher_spec.rb
lhm-shopify-3.5.4 spec/integration/locked_switcher_spec.rb
lhm-shopify-3.5.3 spec/integration/locked_switcher_spec.rb
lhm-shopify-3.5.2 spec/integration/locked_switcher_spec.rb
lhm-shopify-3.5.0 spec/integration/locked_switcher_spec.rb
lhm-shopify-3.5.1 spec/integration/locked_switcher_spec.rb
lhm-shopify-3.4.2 spec/integration/locked_switcher_spec.rb
lhm-shopify-3.4.1 spec/integration/locked_switcher_spec.rb