shipit-engine 0.20.0 → 0.20.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 32c15d6ba8aee487f4738a05b978cb87ce525c51
4
- data.tar.gz: 4652419bd067b12dc0e8689f1bc76befdfa96657
3
+ metadata.gz: 32d85f27b707a0fd01fd1772e5803af8663d195b
4
+ data.tar.gz: 3f5df442e05fc1048307226080695c438fce46aa
5
5
  SHA512:
6
- metadata.gz: 3d815536be09f672e39a8eaa61347321765a884707720f22d88985908b6eb0065426c0252d6906e8a9485fd2e178aa5aa64401eb1f92c054e57a5a93e58cb048
7
- data.tar.gz: c4ab143452da7c46d36374cc4b778bed710d1fe8144a043d22af140dda730e37610350c18787e20a635eb91e1f6d2421de754facc1fccbf61caf4ac0931d1381
6
+ metadata.gz: d7a9dbec229ef543d4e4b884c75539abf59f143d67fd068cee822c609a4fcd5232dae511215d54674064a52a912645036ed7f4bdcfeb2263343a4e57d5559965
7
+ data.tar.gz: 3a02db736fb43949135fdada6d039c32f1a810204a20152c049c775d9bc17d5de526bf783bee98d9f2f892e753cf6bd329994881282344b40079329b6aaac809
@@ -81,7 +81,7 @@ module Shipit
81
81
 
82
82
  def purge_old_deliveries!(keep: DELIVERIES_LOG_SIZE)
83
83
  if cut_off_time = deliveries.order(created_at: :desc).limit(1).offset(keep).pluck(:created_at).first
84
- deliveries.where('created_at > ?', cut_off_time).delete_all
84
+ deliveries.where('created_at <= ?', cut_off_time).delete_all
85
85
  end
86
86
  end
87
87
 
@@ -102,7 +102,7 @@ module Shipit
102
102
  end
103
103
 
104
104
  def self.schedule_merges
105
- Shipit::Stack.where(id: pending.uniq.pluck(:stack_id)).find_each(&:schedule_merges)
105
+ Shipit::Stack.where(merge_queue_enabled: true).find_each(&:schedule_merges)
106
106
  end
107
107
 
108
108
  def self.extract_number(stack, number_or_url)
@@ -198,14 +198,14 @@ module Shipit
198
198
  commits.reachable.first.try!(:sha)
199
199
  end
200
200
 
201
- def merge_status(backlog_leniency_factor: 1.5)
201
+ def merge_status(backlog_leniency_factor: 2.0)
202
202
  return 'locked' if locked?
203
203
  return 'failure' if %w(failure error).freeze.include?(branch_status)
204
204
  return 'backlogged' if backlogged?(backlog_leniency_factor: backlog_leniency_factor)
205
205
  'success'
206
206
  end
207
207
 
208
- def backlogged?(backlog_leniency_factor: 1.5)
208
+ def backlogged?(backlog_leniency_factor: 2.0)
209
209
  maximum_commits_per_deploy && (undeployed_commits_count > maximum_commits_per_deploy * backlog_leniency_factor)
210
210
  end
211
211
 
@@ -1,3 +1,3 @@
1
1
  module Shipit
2
- VERSION = '0.20.0'.freeze
2
+ VERSION = '0.20.1'.freeze
3
3
  end
Binary file
@@ -59,9 +59,14 @@ module Shipit
59
59
  test "#purge_old_deliveries!" do
60
60
  Hook.deliver(:deploy, @stack, 'foo' => 42)
61
61
 
62
- assert_difference -> { Delivery.count }, -1 do
62
+ previous_ids = @hook.deliveries.order(created_at: :desc).pluck(:id)
63
+
64
+ assert_difference -> { @hook.deliveries.count }, -1 do
63
65
  @hook.purge_old_deliveries!(keep: 1)
64
66
  end
67
+
68
+ after_ids = @hook.deliveries.order(created_at: :desc).pluck(:id)
69
+ assert_equal previous_ids[0..-2], after_ids
65
70
  end
66
71
  end
67
72
  end
@@ -441,14 +441,14 @@ module Shipit
441
441
  @stack.deploys_and_rollbacks.destroy_all
442
442
  @stack.update_undeployed_commits_count
443
443
  @stack.reload
444
- assert_equal 'backlogged', @stack.merge_status
444
+ assert_equal 'backlogged', @stack.merge_status(backlog_leniency_factor: 1.5)
445
445
  end
446
446
 
447
447
  test "#merge_status returns success with a higher leniency factor" do
448
448
  @stack.deploys_and_rollbacks.destroy_all
449
449
  @stack.update_undeployed_commits_count
450
450
  @stack.reload
451
- assert_equal 'success', @stack.merge_status(backlog_leniency_factor: 2.0)
451
+ assert_equal 'success', @stack.merge_status(backlog_leniency_factor: 3.0)
452
452
  end
453
453
 
454
454
  test "#handle_github_redirections update the stack if the repository was renamed" do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shipit-engine
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.20.0
4
+ version: 0.20.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jean Boussier
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-08-24 00:00:00.000000000 Z
11
+ date: 2017-08-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -782,7 +782,6 @@ files:
782
782
  - test/dummy/db/schema.rb
783
783
  - test/dummy/db/seeds.rb
784
784
  - test/dummy/db/test.sqlite3
785
- - test/dummy/db/test.sqlite3-journal
786
785
  - test/dummy/public/404.html
787
786
  - test/dummy/public/422.html
788
787
  - test/dummy/public/500.html
@@ -963,7 +962,6 @@ test_files:
963
962
  - test/dummy/db/schema.rb
964
963
  - test/dummy/db/seeds.rb
965
964
  - test/dummy/db/test.sqlite3
966
- - test/dummy/db/test.sqlite3-journal
967
965
  - test/dummy/public/404.html
968
966
  - test/dummy/public/422.html
969
967
  - test/dummy/public/500.html
Binary file