shipit-engine 0.2.3 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/stylesheets/_pages/_stacks.scss +3 -3
  3. data/app/controllers/rollbacks_controller.rb +2 -2
  4. data/app/helpers/shipit_helper.rb +2 -2
  5. data/app/jobs/background_job/unique.rb +1 -8
  6. data/app/jobs/perform_task_job.rb +24 -14
  7. data/app/models/commit.rb +1 -1
  8. data/app/models/deploy.rb +4 -3
  9. data/app/views/deploys/rollback.html.erb +19 -4
  10. data/app/views/stacks/index.html.erb +2 -0
  11. data/lib/shipit/version.rb +1 -1
  12. data/test/controllers/api/deploys_controller_test.rb +2 -2
  13. data/test/controllers/api/hooks_controller_test.rb +1 -1
  14. data/test/controllers/deploys_controller_test.rb +3 -3
  15. data/test/controllers/github_authentication_controller_test.rb +1 -1
  16. data/test/controllers/rollbacks_controller_test.rb +15 -2
  17. data/test/controllers/tasks_controller_test.rb +1 -1
  18. data/test/controllers/webhooks_controller_test.rb +4 -4
  19. data/test/dummy/db/development.sqlite3 +0 -0
  20. data/test/dummy/db/test.sqlite3 +0 -0
  21. data/test/dummy/log/development.log +191 -0
  22. data/test/dummy/log/test.log +38716 -0
  23. data/test/dummy/tmp/cache/48D/660/task%3A73%3Apid +2 -0
  24. data/test/dummy/tmp/cache/5F5/7B0/task%3A644540443%3Apid +1 -1
  25. data/test/dummy/tmp/cache/5F7/AA0/task%3A496901070%3Apid +1 -1
  26. data/test/dummy/tmp/cache/5FD/BF0/task%3A616453971%3Apid +1 -1
  27. data/test/dummy/tmp/cache/98C/C60/stacks%3A616453971%3Aci_enabled +1 -1
  28. data/test/helpers/queries_helper.rb +1 -1
  29. data/test/jobs/emit_event_job_test.rb +1 -1
  30. data/test/jobs/unique_job_test.rb +6 -0
  31. data/test/models/commits_test.rb +1 -1
  32. data/test/models/deploys_test.rb +7 -7
  33. data/test/models/hook_test.rb +1 -1
  34. data/test/models/output_chunk_test.rb +1 -1
  35. data/test/models/stacks_test.rb +2 -2
  36. data/test/models/status_test.rb +1 -1
  37. data/test/models/team_test.rb +2 -2
  38. data/test/models/users_test.rb +1 -1
  39. data/test/test_helper.rb +1 -1
  40. data/test/unit/github_url_helper_test.rb +1 -1
  41. metadata +4 -2
@@ -0,0 +1,2 @@
1
+ o: ActiveSupport::Cache::Entry: @valueio�:@created_atf1440538336.8985999:@expires_inf
2
+ 3.6e3
@@ -1,2 +1,2 @@
1
- o: ActiveSupport::Cache::Entry: @valuei/:@created_atf1440287501.490551:@expires_inf
1
+ o: ActiveSupport::Cache::Entry: @valuei/:@created_atf1441985184.249957:@expires_inf
2
2
  3.6e3
@@ -1,2 +1,2 @@
1
- o: ActiveSupport::Cache::Entry: @valueix�:@created_atf1440287496.052917:@expires_inf
1
+ o: ActiveSupport::Cache::Entry: @valueiD:@created_atf1441985492.542173:@expires_inf
2
2
  3.6e3
@@ -1,2 +1,2 @@
1
- o: ActiveSupport::Cache::Entry: @valuei/:@created_atf1440287497.7865229:@expires_inf
1
+ o: ActiveSupport::Cache::Entry: @valuei/:@created_atf1441985184.291611:@expires_inf
2
2
  3.6e3
@@ -1 +1 @@
1
- o: ActiveSupport::Cache::Entry: @valueT:@created_atf1440287498.936449:@expires_in0
1
+ o: ActiveSupport::Cache::Entry: @valueT:@created_atf1441985186.357144:@expires_in0
@@ -41,7 +41,7 @@ module QueriesHelper
41
41
  attr_reader :log
42
42
 
43
43
  def initialize(ignore = nil)
44
- @ignore = ignore || self.class.ignored_sql
44
+ @ignore = ignore || self.class.ignored_sql
45
45
  @log = []
46
46
  end
47
47
 
@@ -7,7 +7,7 @@ class EmitEventJobTest < ActiveSupport::TestCase
7
7
  end
8
8
 
9
9
  test "#perform schedule deliveries" do
10
- assert_difference -> { Delivery.scheduled.count }, +2 do
10
+ assert_difference -> { Delivery.scheduled.count }, 2 do
11
11
  @job.perform(event: :deploy, stack_id: @stack.id, payload: {foo: 42}.to_json)
12
12
  end
13
13
  end
@@ -14,4 +14,10 @@ class UniqueJobTest < ActiveSupport::TestCase
14
14
  end
15
15
  assert called
16
16
  end
17
+
18
+ test "the lock key is serialized" do
19
+ task = tasks(:shipit_restart)
20
+ job = ChunkRollupJob.new(task)
21
+ assert_equal %(ChunkRollupJob-{"_aj_globalid"=>"gid://shipit/Task/#{task.id}"}), job.lock_key(*job.arguments)
22
+ end
17
23
  end
@@ -156,7 +156,7 @@ class CommitsTest < ActiveSupport::TestCase
156
156
  rels = {target: mock(href: 'http://example.com')}
157
157
  status = mock(state: 'success', description: nil, context: 'default', rels: rels, created_at: 1.day.ago)
158
158
  Shipit.github_api.expects(:statuses).with(@stack.github_repo_name, @commit.sha).returns([status])
159
- assert_difference '@commit.statuses.count', +1 do
159
+ assert_difference '@commit.statuses.count', 1 do
160
160
  @commit.refresh_statuses!
161
161
  end
162
162
  assert_equal 'success', @commit.statuses.first.state
@@ -37,9 +37,9 @@ class DeploysTest < ActiveSupport::TestCase
37
37
  end
38
38
 
39
39
  test "#since_commit_id returns a default value if stack_id is set" do
40
- stack = stacks(:shipit)
40
+ stack = stacks(:shipit)
41
41
  deploy = stack.deploys.new
42
- last = stack.deploys.success.last.until_commit_id
42
+ last = stack.deploys.success.last.until_commit_id
43
43
  assert_equal last, deploy.since_commit_id
44
44
  end
45
45
 
@@ -51,7 +51,7 @@ class DeploysTest < ActiveSupport::TestCase
51
51
  test "additions and deletions are denormalized on before create" do
52
52
  stack = stacks(:shipit)
53
53
  first = commits(:first)
54
- third = commits(:third)
54
+ third = commits(:third)
55
55
 
56
56
  deploy = stack.deploys.create!(
57
57
  since_commit: first,
@@ -65,7 +65,7 @@ class DeploysTest < ActiveSupport::TestCase
65
65
  test "#commits returns the commits in the id range" do
66
66
  stack = stacks(:shipit)
67
67
  first = commits(:first)
68
- last = commits(:third)
68
+ last = commits(:third)
69
69
 
70
70
  deploy = stack.deploys.new(
71
71
  since_commit: first,
@@ -82,7 +82,7 @@ class DeploysTest < ActiveSupport::TestCase
82
82
  test "#commits returns commits from newer to older" do
83
83
  stack = stacks(:shipit)
84
84
  first = commits(:first)
85
- last = commits(:fourth)
85
+ last = commits(:fourth)
86
86
 
87
87
  deploy = stack.deploys.new(
88
88
  since_commit: first,
@@ -195,7 +195,7 @@ class DeploysTest < ActiveSupport::TestCase
195
195
  @deploy.pid = 42
196
196
  @deploy.abort!(rollback_once_aborted: true)
197
197
 
198
- assert_difference -> { @stack.rollbacks.count }, +1 do
198
+ assert_difference -> { @stack.rollbacks.count }, 1 do
199
199
  assert_enqueued_with(job: PerformTaskJob) do
200
200
  @deploy.aborted!
201
201
  end
@@ -237,7 +237,7 @@ class DeploysTest < ActiveSupport::TestCase
237
237
  end
238
238
 
239
239
  test "#trigger_rollback creates a new Rollback" do
240
- assert_difference -> { Rollback.count }, +1 do
240
+ assert_difference -> { Rollback.count }, 1 do
241
241
  @deploy.trigger_rollback(@user)
242
242
  end
243
243
  end
@@ -29,7 +29,7 @@ class HookTest < ActiveSupport::TestCase
29
29
  end
30
30
 
31
31
  test ".deliver schedule a delivery for each matching hook" do
32
- assert_difference -> { Delivery.count }, +2 do
32
+ assert_difference -> { Delivery.count }, 2 do
33
33
  Hook.deliver(:deploy, @stack, 'foo' => 42)
34
34
  end
35
35
 
@@ -8,7 +8,7 @@ class OutputChunkTest < ActiveSupport::TestCase
8
8
 
9
9
  test "tail" do
10
10
  start = @chunks.first
11
- rest = @chunks - [start]
11
+ rest = @chunks - [start]
12
12
  assert_equal rest, @deploy.chunks.tail(start.id)
13
13
  end
14
14
 
@@ -126,7 +126,7 @@ class StacksTest < ActiveSupport::TestCase
126
126
  Deploy.active.update_all(status: 'error')
127
127
 
128
128
  assert_equal commits(:fourth), @stack.last_deployed_commit
129
- assert_difference 'Deploy.count', +1 do
129
+ assert_difference 'Deploy.count', 1 do
130
130
  deploy = @stack.update_deployed_revision(commits(:fifth).sha)
131
131
  assert_not_nil deploy
132
132
  assert_equal commits(:fourth), deploy.since_commit
@@ -139,7 +139,7 @@ class StacksTest < ActiveSupport::TestCase
139
139
  Deploy.active.update_all(status: 'error')
140
140
 
141
141
  assert_equal commits(:fourth), @stack.last_deployed_commit
142
- assert_difference 'Deploy.count', +1 do
142
+ assert_difference 'Deploy.count', 1 do
143
143
  deploy = @stack.update_deployed_revision(commits(:fifth).sha[0..5])
144
144
  assert_not_nil deploy
145
145
  assert_equal commits(:fourth), deploy.since_commit
@@ -7,7 +7,7 @@ class StatusTest < ActiveSupport::TestCase
7
7
  end
8
8
 
9
9
  test ".replicate_from_github! is idempotent" do
10
- assert_difference '@commit.statuses.count', +1 do
10
+ assert_difference '@commit.statuses.count', 1 do
11
11
  @commit.statuses.replicate_from_github!(github_status)
12
12
  end
13
13
 
@@ -13,7 +13,7 @@ class TeamTest < ActiveSupport::TestCase
13
13
  Shipit.github_api.expects(:org_teams).with('shopify', per_page: 100)
14
14
  response = stub(rels: {}, data: [new_team])
15
15
  Shipit.github_api.expects(:last_response).returns(response)
16
- assert_difference -> { Team.count }, +1 do
16
+ assert_difference -> { Team.count }, 1 do
17
17
  Team.find_or_create_by_handle('Shopify/new-team')
18
18
  end
19
19
  end
@@ -21,7 +21,7 @@ class TeamTest < ActiveSupport::TestCase
21
21
  test "#refresh_members! fetch all the team members from github" do
22
22
  response = stub(rels: {members: members_resource})
23
23
  Shipit.github_api.expects(:get).with(@team.api_url).returns(response)
24
- assert_difference -> { User.count }, +1 do
24
+ assert_difference -> { User.count }, 1 do
25
25
  @team.refresh_members!
26
26
  end
27
27
  end
@@ -8,7 +8,7 @@ class UsersTest < ActiveSupport::TestCase
8
8
  end
9
9
 
10
10
  test "find_or_create_from_github persist a new user if he is unknown" do
11
- assert_difference 'User.count', +1 do
11
+ assert_difference 'User.count', 1 do
12
12
  fetch_user
13
13
  end
14
14
  end
data/test/test_helper.rb CHANGED
@@ -6,7 +6,7 @@ SimpleCov.start 'rails'
6
6
  require 'fakeweb'
7
7
  FakeWeb.allow_net_connect = false
8
8
 
9
- require File.expand_path("../../test/dummy/config/environment.rb", __FILE__)
9
+ require File.expand_path("../../test/dummy/config/environment.rb", __FILE__)
10
10
  ActiveRecord::Migrator.migrations_paths = [File.expand_path("../../test/dummy/db/migrate", __FILE__)]
11
11
  ActiveRecord::Migrator.migrations_paths << File.expand_path('../../db/migrate', __FILE__)
12
12
  require "rails/test_help"
@@ -18,7 +18,7 @@ class GithubUrlHelperTest < ActiveSupport::TestCase
18
18
 
19
19
  test "#github_diff_url returns a diff url" do
20
20
  from_sha = SecureRandom.hex
21
- to_sha = SecureRandom.hex
21
+ to_sha = SecureRandom.hex
22
22
  expected = "https://github.com/rails/rails/compare/#{from_sha}...#{to_sha}"
23
23
 
24
24
  assert_equal expected, github_diff_url("rails", "rails", from_sha, to_sha)
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.2.3
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jean Boussier
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-22 00:00:00.000000000 Z
11
+ date: 2015-09-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -600,6 +600,7 @@ files:
600
600
  - test/dummy/public/favicon.ico
601
601
  - test/dummy/tmp/cache/48B/590/task%3A80%3Apid
602
602
  - test/dummy/tmp/cache/48C/600/task%3A81%3Apid
603
+ - test/dummy/tmp/cache/48D/660/task%3A73%3Apid
603
604
  - test/dummy/tmp/cache/48D/670/task%3A82%3Apid
604
605
  - test/dummy/tmp/cache/48E/6E0/task%3A83%3Apid
605
606
  - test/dummy/tmp/cache/48F/750/task%3A84%3Apid
@@ -2608,6 +2609,7 @@ test_files:
2608
2609
  - test/dummy/README.rdoc
2609
2610
  - test/dummy/tmp/cache/48B/590/task%3A80%3Apid
2610
2611
  - test/dummy/tmp/cache/48C/600/task%3A81%3Apid
2612
+ - test/dummy/tmp/cache/48D/660/task%3A73%3Apid
2611
2613
  - test/dummy/tmp/cache/48D/670/task%3A82%3Apid
2612
2614
  - test/dummy/tmp/cache/48E/6E0/task%3A83%3Apid
2613
2615
  - test/dummy/tmp/cache/48F/750/task%3A84%3Apid