lhm-shopify 3.3.5 → 3.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -41,6 +41,7 @@ describe Lhm::Chunker do
41
41
  @connection.expects(:select_value).with(regexp_matches(/where id >= 8 order by id limit 1 offset 4/)).returns(21)
42
42
  @connection.expects(:update).with(regexp_matches(/between 1 and 7/)).returns(2)
43
43
  @connection.expects(:update).with(regexp_matches(/between 8 and 10/)).returns(2)
44
+ @connection.expects(:query).twice.with(regexp_matches(/show warnings/)).returns([])
44
45
 
45
46
  @chunker.run
46
47
  end
@@ -88,6 +89,8 @@ describe Lhm::Chunker do
88
89
  @connection.expects(:update).with(regexp_matches(/between 6 and 8/)).returns(2)
89
90
  @connection.expects(:update).with(regexp_matches(/between 9 and 10/)).returns(2)
90
91
 
92
+ @connection.expects(:query).twice.with(regexp_matches(/show warnings/)).returns([])
93
+
91
94
  @chunker.run
92
95
  end
93
96
 
@@ -136,6 +139,7 @@ describe Lhm::Chunker do
136
139
 
137
140
  @connection.expects(:select_value).with(regexp_matches(/where id >= 1 order by id limit 1 offset 1/)).returns(2)
138
141
  @connection.expects(:update).with(regexp_matches(/where \(foo.created_at > '2013-07-10' or foo.baz = 'quux'\) and `foo`/)).returns(1)
142
+ @connection.expects(:query).with(regexp_matches(/show warnings/)).returns([])
139
143
 
140
144
  def @migration.conditions
141
145
  "where foo.created_at > '2013-07-10' or foo.baz = 'quux'"
@@ -155,6 +159,7 @@ describe Lhm::Chunker do
155
159
 
156
160
  @connection.expects(:select_value).with(regexp_matches(/where id >= 1 order by id limit 1 offset 1/)).returns(2)
157
161
  @connection.expects(:update).with(regexp_matches(/inner join bar on foo.id = bar.foo_id and/)).returns(1)
162
+ @connection.expects(:query).with(regexp_matches(/show warnings/)).returns([])
158
163
 
159
164
  def @migration.conditions
160
165
  'inner join bar on foo.id = bar.foo_id'
@@ -34,7 +34,7 @@ describe Lhm::Entangler do
34
34
  values (`NEW`.`info`, `NEW`.`tags`)
35
35
  }
36
36
 
37
- @entangler.entangle.must_include strip(ddl)
37
+ value(@entangler.entangle).must_include strip(ddl)
38
38
  end
39
39
 
40
40
  it 'should create an update trigger to the destination table' do
@@ -45,7 +45,7 @@ describe Lhm::Entangler do
45
45
  values (`NEW`.`info`, `NEW`.`tags`)
46
46
  }
47
47
 
48
- @entangler.entangle.must_include strip(ddl)
48
+ value(@entangler.entangle).must_include strip(ddl)
49
49
  end
50
50
 
51
51
  it 'should create a delete trigger to the destination table' do
@@ -56,7 +56,7 @@ describe Lhm::Entangler do
56
56
  where `destination`.`id` = OLD.`id`
57
57
  }
58
58
 
59
- @entangler.entangle.must_include strip(ddl)
59
+ value(@entangler.entangle).must_include strip(ddl)
60
60
  end
61
61
 
62
62
  it 'should retry trigger creation when it hits a lock wait timeout' do
@@ -101,24 +101,24 @@ describe Lhm::Entangler do
101
101
  end
102
102
 
103
103
  it 'should use truncated names' do
104
- @entangler.trigger(:ins).length.must_be :<=, 64
105
- @entangler.trigger(:upd).length.must_be :<=, 64
106
- @entangler.trigger(:del).length.must_be :<=, 64
104
+ value(@entangler.trigger(:ins).length).must_be :<=, 64
105
+ value(@entangler.trigger(:upd).length).must_be :<=, 64
106
+ value(@entangler.trigger(:del).length).must_be :<=, 64
107
107
  end
108
108
  end
109
109
  end
110
110
 
111
111
  describe 'removal' do
112
112
  it 'should remove insert trigger' do
113
- @entangler.untangle.must_include('drop trigger if exists `lhmt_ins_origin`')
113
+ value(@entangler.untangle).must_include('drop trigger if exists `lhmt_ins_origin`')
114
114
  end
115
115
 
116
116
  it 'should remove update trigger' do
117
- @entangler.untangle.must_include('drop trigger if exists `lhmt_upd_origin`')
117
+ value(@entangler.untangle).must_include('drop trigger if exists `lhmt_upd_origin`')
118
118
  end
119
119
 
120
120
  it 'should remove delete trigger' do
121
- @entangler.untangle.must_include('drop trigger if exists `lhmt_del_origin`')
121
+ value(@entangler.untangle).must_include('drop trigger if exists `lhmt_del_origin`')
122
122
  end
123
123
  end
124
124
  end
@@ -18,7 +18,7 @@ describe Lhm::Intersection do
18
18
  destination.columns['retained'] = varchar
19
19
 
20
20
  intersection = Lhm::Intersection.new(origin, destination)
21
- intersection.destination.include?('dropped').must_equal(false)
21
+ value(intersection.destination.include?('dropped')).must_equal(false)
22
22
  end
23
23
 
24
24
  it 'should have unchanged columns' do
@@ -30,7 +30,7 @@ describe Lhm::Intersection do
30
30
  destination.columns['retained'] = varchar
31
31
 
32
32
  intersection = Lhm::Intersection.new(origin, destination)
33
- intersection.destination.must_equal(['retained'])
33
+ value(intersection.destination).must_equal(['retained'])
34
34
  end
35
35
 
36
36
  it 'should have renamed columns' do
@@ -41,8 +41,8 @@ describe Lhm::Intersection do
41
41
  destination.columns['new_name'] = varchar
42
42
 
43
43
  intersection = Lhm::Intersection.new(origin, destination, { 'old_name' => 'new_name' })
44
- intersection.origin.must_equal(['old_name'])
45
- intersection.destination.must_equal(['new_name'])
44
+ value(intersection.origin).must_equal(['old_name'])
45
+ value(intersection.destination).must_equal(['new_name'])
46
46
  end
47
47
 
48
48
  def varchar
@@ -11,9 +11,9 @@ describe Lhm do
11
11
  describe 'logger' do
12
12
 
13
13
  it 'should use the default parameters if no logger explicitly set' do
14
- Lhm.logger.must_be_kind_of Logger
15
- Lhm.logger.level.must_equal Logger::INFO
16
- Lhm.logger.instance_eval { @logdev }.dev.must_equal STDOUT
14
+ value(Lhm.logger).must_be_kind_of Logger
15
+ value(Lhm.logger.level).must_equal Logger::INFO
16
+ value(Lhm.logger.instance_eval { @logdev }.dev).must_equal STDOUT
17
17
  end
18
18
 
19
19
  it 'should use s new logger if set' do
@@ -21,9 +21,9 @@ describe Lhm do
21
21
  l.level = Logger::ERROR
22
22
  Lhm.logger = l
23
23
 
24
- Lhm.logger.level.must_equal Logger::ERROR
25
- Lhm.logger.instance_eval { @logdev }.dev.must_be_kind_of File
26
- Lhm.logger.instance_eval { @logdev }.dev.path.must_equal 'omg.ponies'
24
+ value(Lhm.logger.level).must_equal Logger::ERROR
25
+ value(Lhm.logger.instance_eval { @logdev }.dev).must_be_kind_of File
26
+ value(Lhm.logger.instance_eval { @logdev }.dev.path).must_equal 'omg.ponies'
27
27
  end
28
28
  end
29
29
  end
@@ -20,32 +20,27 @@ describe Lhm::LockedSwitcher do
20
20
 
21
21
  describe 'uncommitted' do
22
22
  it 'should disable autocommit first' do
23
- @switcher.
24
- statements[0..1].
25
- must_equal([
26
- 'set @lhm_auto_commit = @@session.autocommit',
27
- 'set session autocommit = 0'
28
- ])
23
+ value(@switcher.statements[0..1]).must_equal([
24
+ 'set @lhm_auto_commit = @@session.autocommit',
25
+ 'set session autocommit = 0'
26
+ ])
29
27
  end
30
28
 
31
29
  it 'should reapply original autocommit settings at the end' do
32
- @switcher.
33
- statements[-1].
34
- must_equal('set session autocommit = @lhm_auto_commit')
30
+ value(@switcher.statements[-1])
31
+ .must_equal('set session autocommit = @lhm_auto_commit')
35
32
  end
36
33
  end
37
34
 
38
35
  describe 'switch' do
39
36
  it 'should lock origin and destination table, switch, commit and unlock' do
40
- @switcher.
41
- switch.
42
- must_equal([
43
- 'lock table `origin` write, `destination` write',
44
- "alter table `origin` rename `#{ @migration.archive_name }`",
45
- 'alter table `destination` rename `origin`',
46
- 'commit',
47
- 'unlock tables'
48
- ])
37
+ value(@switcher.switch).must_equal([
38
+ 'lock table `origin` write, `destination` write',
39
+ "alter table `origin` rename `#{ @migration.archive_name }`",
40
+ 'alter table `destination` rename `origin`',
41
+ 'commit',
42
+ 'unlock tables'
43
+ ])
49
44
  end
50
45
  end
51
46
  end
@@ -18,7 +18,7 @@ describe Lhm::Migrator do
18
18
  it 'should add an index' do
19
19
  @creator.add_index(:a)
20
20
 
21
- @creator.statements.must_equal([
21
+ value(@creator.statements).must_equal([
22
22
  'create index `index_alt_on_a` on `lhmn_alt` (`a`)'
23
23
  ])
24
24
  end
@@ -26,7 +26,7 @@ describe Lhm::Migrator do
26
26
  it 'should add a composite index' do
27
27
  @creator.add_index([:a, :b])
28
28
 
29
- @creator.statements.must_equal([
29
+ value(@creator.statements).must_equal([
30
30
  'create index `index_alt_on_a_and_b` on `lhmn_alt` (`a`, `b`)'
31
31
  ])
32
32
  end
@@ -34,7 +34,7 @@ describe Lhm::Migrator do
34
34
  it 'should add an index with prefix length' do
35
35
  @creator.add_index(['a(10)', 'b'])
36
36
 
37
- @creator.statements.must_equal([
37
+ value(@creator.statements).must_equal([
38
38
  'create index `index_alt_on_a_and_b` on `lhmn_alt` (`a`(10), `b`)'
39
39
  ])
40
40
  end
@@ -42,7 +42,7 @@ describe Lhm::Migrator do
42
42
  it 'should add an index with a custom name' do
43
43
  @creator.add_index([:a, :b], :custom_index_name)
44
44
 
45
- @creator.statements.must_equal([
45
+ value(@creator.statements).must_equal([
46
46
  'create index `custom_index_name` on `lhmn_alt` (`a`, `b`)'
47
47
  ])
48
48
  end
@@ -56,7 +56,7 @@ describe Lhm::Migrator do
56
56
  it 'should add a unique index' do
57
57
  @creator.add_unique_index(['a(5)', :b])
58
58
 
59
- @creator.statements.must_equal([
59
+ value(@creator.statements).must_equal([
60
60
  'create unique index `index_alt_on_a_and_b` on `lhmn_alt` (`a`(5), `b`)'
61
61
  ])
62
62
  end
@@ -64,7 +64,7 @@ describe Lhm::Migrator do
64
64
  it 'should add a unique index with a custom name' do
65
65
  @creator.add_unique_index([:a, :b], :custom_index_name)
66
66
 
67
- @creator.statements.must_equal([
67
+ value(@creator.statements).must_equal([
68
68
  'create unique index `custom_index_name` on `lhmn_alt` (`a`, `b`)'
69
69
  ])
70
70
  end
@@ -78,7 +78,7 @@ describe Lhm::Migrator do
78
78
  it 'should remove an index' do
79
79
  @creator.remove_index(['b', 'a'])
80
80
 
81
- @creator.statements.must_equal([
81
+ value(@creator.statements).must_equal([
82
82
  'drop index `index_alt_on_b_and_a` on `lhmn_alt`'
83
83
  ])
84
84
  end
@@ -86,7 +86,7 @@ describe Lhm::Migrator do
86
86
  it 'should remove an index with a custom name' do
87
87
  @creator.remove_index([:a, :b], :custom_index_name)
88
88
 
89
- @creator.statements.must_equal([
89
+ value(@creator.statements).must_equal([
90
90
  'drop index `custom_index_name` on `lhmn_alt`'
91
91
  ])
92
92
  end
@@ -96,7 +96,7 @@ describe Lhm::Migrator do
96
96
  it 'should add a column' do
97
97
  @creator.add_column('logins', 'INT(12)')
98
98
 
99
- @creator.statements.must_equal([
99
+ value(@creator.statements).must_equal([
100
100
  'alter table `lhmn_alt` add column `logins` INT(12)'
101
101
  ])
102
102
  end
@@ -104,7 +104,7 @@ describe Lhm::Migrator do
104
104
  it 'should remove a column' do
105
105
  @creator.remove_column('logins')
106
106
 
107
- @creator.statements.must_equal([
107
+ value(@creator.statements).must_equal([
108
108
  'alter table `lhmn_alt` drop `logins`'
109
109
  ])
110
110
  end
@@ -112,7 +112,7 @@ describe Lhm::Migrator do
112
112
  it 'should change a column' do
113
113
  @creator.change_column('logins', 'INT(11)')
114
114
 
115
- @creator.statements.must_equal([
115
+ value(@creator.statements).must_equal([
116
116
  'alter table `lhmn_alt` modify column `logins` INT(11)'
117
117
  ])
118
118
  end
@@ -122,7 +122,7 @@ describe Lhm::Migrator do
122
122
  it 'should accept a ddl statement' do
123
123
  @creator.ddl('alter table `%s` add column `f` tinyint(1)' % @creator.name)
124
124
 
125
- @creator.statements.must_equal([
125
+ value(@creator.statements).must_equal([
126
126
  'alter table `lhmn_alt` add column `f` tinyint(1)'
127
127
  ])
128
128
  end
@@ -132,15 +132,13 @@ describe Lhm::Migrator do
132
132
  it 'should add two columns' do
133
133
  @creator.add_column('first', 'VARCHAR(64)')
134
134
  @creator.add_column('last', 'VARCHAR(64)')
135
- @creator.statements.length.must_equal(2)
135
+ value(@creator.statements.length).must_equal(2)
136
136
 
137
- @creator.
138
- statements[0].
139
- must_equal('alter table `lhmn_alt` add column `first` VARCHAR(64)')
137
+ value(@creator.statements[0])
138
+ .must_equal('alter table `lhmn_alt` add column `first` VARCHAR(64)')
140
139
 
141
- @creator.
142
- statements[1].
143
- must_equal('alter table `lhmn_alt` add column `last` VARCHAR(64)')
140
+ value(@creator.statements[1])
141
+ .must_equal('alter table `lhmn_alt` add column `last` VARCHAR(64)')
144
142
  end
145
143
  end
146
144
  end
@@ -1,6 +1,9 @@
1
1
  require File.expand_path(File.dirname(__FILE__)) + '/unit_helper'
2
2
 
3
3
  require 'lhm/printer'
4
+ require 'logger'
5
+
6
+
4
7
 
5
8
  describe Lhm::Printer do
6
9
  include UnitHelper
@@ -12,24 +15,17 @@ describe Lhm::Printer do
12
15
  end
13
16
 
14
17
  it 'prints the percentage' do
15
- mock = MiniTest::Mock.new
18
+ r, w = IO.pipe
19
+ Lhm.logger = Logger.new(w)
20
+
16
21
  10.times do |i|
17
- mock.expect(:write, :return_value) do |message|
18
- message = message.first if message.is_a?(Array)
19
- assert_match(/^\r/, message)
20
- assert_match(/#{i}\/10/, message)
21
- end
22
+ @printer.notify(i, 10)
23
+ assert_match(/#{i}\/10/, log_expression_message(r.gets))
22
24
  end
23
-
24
- @printer.instance_variable_set(:@output, mock)
25
- 10.times { |i| @printer.notify(i, 10) }
26
- mock.verify
27
25
  end
28
26
 
29
27
  it 'always prints a bigger message' do
30
28
  @length = 0
31
- printer_mock = mock()
32
- printer_mock.expects(:write).at_least_once
33
29
 
34
30
  def assert_length(printer)
35
31
  new_length = printer.instance_variable_get(:@max_length)
@@ -37,7 +33,6 @@ describe Lhm::Printer do
37
33
  @length = new_length
38
34
  end
39
35
 
40
- @printer.instance_variable_set(:@output, printer_mock)
41
36
  @printer.notify(10, 100)
42
37
  assert_length(@printer)
43
38
  @printer.notify(0, 100)
@@ -51,27 +46,20 @@ describe Lhm::Printer do
51
46
  end
52
47
 
53
48
  it 'prints the end message' do
54
- mock = MiniTest::Mock.new
55
- mock.expect(:write, :return_value, [String])
56
- mock.expect(:write, :return_value, ["\n"])
57
-
58
- @printer.instance_variable_set(:@output, mock)
49
+ r, w = IO.pipe
50
+ Lhm.logger = Logger.new(w)
59
51
  @printer.end
60
52
 
61
- mock.verify
53
+ assert_equal(log_expression_message(r.gets), "100% complete\n")
62
54
  end
63
55
 
64
56
  it 'prints the exception message' do
65
- mock = MiniTest::Mock.new
66
- mock.expect(:write, :return_value, ["\rfailed: woops"])
67
- mock.expect(:write, :return_value, ["\n"])
68
-
57
+ r, w = IO.pipe
58
+ Lhm.logger = Logger.new(w)
69
59
  e = StandardError.new('woops')
70
-
71
- @printer.instance_variable_set(:@output, mock)
72
60
  @printer.exception(e)
73
61
 
74
- mock.verify
62
+ assert_equal(log_expression_message(r.gets), "failed: #{e}\n")
75
63
  end
76
64
  end
77
65
 
@@ -7,26 +7,22 @@ require 'lhm/sql_helper'
7
7
 
8
8
  describe Lhm::SqlHelper do
9
9
  it 'should name index with a single column' do
10
- Lhm::SqlHelper.
11
- idx_name(:users, :name).
12
- must_equal('index_users_on_name')
10
+ value(Lhm::SqlHelper.idx_name(:users, :name))
11
+ .must_equal('index_users_on_name')
13
12
  end
14
13
 
15
14
  it 'should name index with multiple columns' do
16
- Lhm::SqlHelper.
17
- idx_name(:users, [:name, :firstname]).
18
- must_equal('index_users_on_name_and_firstname')
15
+ value(Lhm::SqlHelper.idx_name(:users, [:name, :firstname]))
16
+ .must_equal('index_users_on_name_and_firstname')
19
17
  end
20
18
 
21
19
  it 'should name index with prefixed column' do
22
- Lhm::SqlHelper.
23
- idx_name(:tracks, ['title(10)', 'album']).
24
- must_equal('index_tracks_on_title_and_album')
20
+ value(Lhm::SqlHelper.idx_name(:tracks, ['title(10)', 'album']))
21
+ .must_equal('index_tracks_on_title_and_album')
25
22
  end
26
23
 
27
24
  it 'should quote column names in index specification' do
28
- Lhm::SqlHelper.
29
- idx_spec(['title(10)', 'album']).
30
- must_equal('`title`(10), `album`')
25
+ value(Lhm::SqlHelper.idx_spec(['title(10)', 'album']))
26
+ .must_equal('`title`(10), `album`')
31
27
  end
32
28
  end
@@ -11,7 +11,7 @@ describe Lhm::Table do
11
11
  describe 'names' do
12
12
  it 'should name destination' do
13
13
  @table = Lhm::Table.new('users')
14
- @table.destination_name.must_equal 'lhmn_users'
14
+ value(@table.destination_name).must_equal 'lhmn_users'
15
15
  end
16
16
  end
17
17
 
@@ -23,25 +23,25 @@ describe Lhm::Table do
23
23
  it 'should be satisfied with a single column primary key called id' do
24
24
  @table = Lhm::Table.new('table', 'id')
25
25
  set_columns(@table, { 'id' => { :type => 'int(1)' } })
26
- @table.satisfies_id_column_requirement?.must_equal true
26
+ value(@table.satisfies_id_column_requirement?).must_equal true
27
27
  end
28
28
 
29
29
  it 'should be satisfied with a primary key not called id, as long as there is still an id' do
30
30
  @table = Lhm::Table.new('table', 'uuid')
31
31
  set_columns(@table, { 'id' => { :type => 'int(1)' } })
32
- @table.satisfies_id_column_requirement?.must_equal true
32
+ value(@table.satisfies_id_column_requirement?).must_equal true
33
33
  end
34
34
 
35
35
  it 'should be satisifed if display attributes are not present (deprecated in mysql 8)' do
36
36
  @table = Lhm::Table.new('table', 'id')
37
37
  set_columns(@table, { 'id' => { :type => 'int' } })
38
- @table.satisfies_id_column_requirement?.must_equal true
38
+ value(@table.satisfies_id_column_requirement?).must_equal true
39
39
  end
40
40
 
41
41
  it 'should not be satisfied if id is not numeric' do
42
42
  @table = Lhm::Table.new('table', 'id')
43
43
  set_columns(@table, { 'id' => { :type => 'varchar(255)' } })
44
- @table.satisfies_id_column_requirement?.must_equal false
44
+ value(@table.satisfies_id_column_requirement?).must_equal false
45
45
  end
46
46
  end
47
47
  end
@@ -23,11 +23,11 @@ describe Lhm::Throttler do
23
23
  end
24
24
 
25
25
  it 'instantiates the time throttle' do
26
- @mock.throttler.class.must_equal Lhm::Throttler::Time
26
+ value(@mock.throttler.class).must_equal Lhm::Throttler::Time
27
27
  end
28
28
 
29
29
  it 'returns 2 seconds as time' do
30
- @mock.throttler.timeout_seconds.must_equal 2
30
+ value(@mock.throttler.timeout_seconds).must_equal 2
31
31
  end
32
32
  end
33
33
 
@@ -37,11 +37,11 @@ describe Lhm::Throttler do
37
37
  end
38
38
 
39
39
  it 'instantiates the slave_lag throttle' do
40
- @mock.throttler.class.must_equal Lhm::Throttler::SlaveLag
40
+ value(@mock.throttler.class).must_equal Lhm::Throttler::SlaveLag
41
41
  end
42
42
 
43
43
  it 'returns 20 seconds as allowed_lag' do
44
- @mock.throttler.allowed_lag.must_equal 20
44
+ value(@mock.throttler.allowed_lag).must_equal 20
45
45
  end
46
46
  end
47
47
 
@@ -58,11 +58,11 @@ describe Lhm::Throttler do
58
58
  end
59
59
 
60
60
  it 'returns the instace given' do
61
- @mock.throttler.must_equal @instance
61
+ value(@mock.throttler).must_equal @instance
62
62
  end
63
63
 
64
64
  it 'returns 0 seconds as time' do
65
- @mock.throttler.timeout_seconds.must_equal 0
65
+ value(@mock.throttler.timeout_seconds).must_equal 0
66
66
  end
67
67
  end
68
68
 
@@ -78,11 +78,11 @@ describe Lhm::Throttler do
78
78
  end
79
79
 
80
80
  it 'returns the instace given' do
81
- @mock.throttler.must_equal @instance
81
+ value(@mock.throttler).must_equal @instance
82
82
  end
83
83
 
84
84
  it 'returns 0 seconds as time' do
85
- @mock.throttler.timeout_seconds.must_equal 0
85
+ value(@mock.throttler.timeout_seconds).must_equal 0
86
86
  end
87
87
  end
88
88
 
@@ -94,7 +94,7 @@ describe Lhm::Throttler do
94
94
  end
95
95
 
96
96
  it 'has the same class as given' do
97
- @mock.throttler.class.must_equal @klass
97
+ value(@mock.throttler.class).must_equal @klass
98
98
  end
99
99
  end
100
100
 
@@ -106,7 +106,7 @@ describe Lhm::Throttler do
106
106
  end
107
107
 
108
108
  it 'has the same class as given' do
109
- @mock.throttler.class.must_equal @klass
109
+ value(@mock.throttler.class).must_equal @klass
110
110
  end
111
111
  end
112
112
  end
@@ -114,11 +114,11 @@ describe Lhm::Throttler do
114
114
  describe '#throttler' do
115
115
 
116
116
  it 'returns the default Time based' do
117
- @mock.throttler.class.must_equal Lhm::Throttler::Time
117
+ value(@mock.throttler.class).must_equal Lhm::Throttler::Time
118
118
  end
119
119
 
120
120
  it 'should default to 100 milliseconds' do
121
- @mock.throttler.timeout_seconds.must_equal 0.1
121
+ value(@mock.throttler.timeout_seconds).must_equal 0.1
122
122
  end
123
123
  end
124
124
  end
@@ -3,6 +3,8 @@
3
3
  require 'test_helper'
4
4
 
5
5
  module UnitHelper
6
+ LOG_EXPRESSION = /([\w]+),\s+\[([^\]\s]+)\s+#([^\]]+)]\s+(\w+)\s+--\s+(\w+)?:\s+(.+)/
7
+
6
8
  def fixture(name)
7
9
  File.read $fixtures.join(name)
8
10
  end
@@ -10,4 +12,15 @@ module UnitHelper
10
12
  def strip(sql)
11
13
  sql.strip.gsub(/\n */, "\n")
12
14
  end
15
+
16
+ def log_expression_message(msg)
17
+ msg.gsub(LOG_EXPRESSION) do |match|
18
+ severity = $1
19
+ date = $2
20
+ pid = $3
21
+ label = $4
22
+ app = $5
23
+ message = $6
24
+ end
25
+ end
13
26
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lhm-shopify
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.3.5
4
+ version: 3.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - SoundCloud
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2021-07-06 00:00:00.000000000 Z
15
+ date: 2021-09-28 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: retriable
@@ -141,6 +141,7 @@ files:
141
141
  - gemfiles/ar-4.2_mysql2.gemfile
142
142
  - gemfiles/ar-5.0_mysql2.gemfile
143
143
  - lhm.gemspec
144
+ - lib/lhm-shopify.rb
144
145
  - lib/lhm.rb
145
146
  - lib/lhm/atomic_switcher.rb
146
147
  - lib/lhm/chunk_finder.rb
@@ -172,7 +173,9 @@ files:
172
173
  - spec/README.md
173
174
  - spec/fixtures/bigint_table.ddl
174
175
  - spec/fixtures/composite_primary_key.ddl
176
+ - spec/fixtures/composite_primary_key_dest.ddl
175
177
  - spec/fixtures/custom_primary_key.ddl
178
+ - spec/fixtures/custom_primary_key_dest.ddl
176
179
  - spec/fixtures/destination.ddl
177
180
  - spec/fixtures/lines.ddl
178
181
  - spec/fixtures/origin.ddl