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.
- checksums.yaml +4 -4
- data/app/assets/stylesheets/_pages/_stacks.scss +3 -3
- data/app/controllers/rollbacks_controller.rb +2 -2
- data/app/helpers/shipit_helper.rb +2 -2
- data/app/jobs/background_job/unique.rb +1 -8
- data/app/jobs/perform_task_job.rb +24 -14
- data/app/models/commit.rb +1 -1
- data/app/models/deploy.rb +4 -3
- data/app/views/deploys/rollback.html.erb +19 -4
- data/app/views/stacks/index.html.erb +2 -0
- data/lib/shipit/version.rb +1 -1
- data/test/controllers/api/deploys_controller_test.rb +2 -2
- data/test/controllers/api/hooks_controller_test.rb +1 -1
- data/test/controllers/deploys_controller_test.rb +3 -3
- data/test/controllers/github_authentication_controller_test.rb +1 -1
- data/test/controllers/rollbacks_controller_test.rb +15 -2
- data/test/controllers/tasks_controller_test.rb +1 -1
- data/test/controllers/webhooks_controller_test.rb +4 -4
- data/test/dummy/db/development.sqlite3 +0 -0
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/log/development.log +191 -0
- data/test/dummy/log/test.log +38716 -0
- data/test/dummy/tmp/cache/48D/660/task%3A73%3Apid +2 -0
- data/test/dummy/tmp/cache/5F5/7B0/task%3A644540443%3Apid +1 -1
- data/test/dummy/tmp/cache/5F7/AA0/task%3A496901070%3Apid +1 -1
- data/test/dummy/tmp/cache/5FD/BF0/task%3A616453971%3Apid +1 -1
- data/test/dummy/tmp/cache/98C/C60/stacks%3A616453971%3Aci_enabled +1 -1
- data/test/helpers/queries_helper.rb +1 -1
- data/test/jobs/emit_event_job_test.rb +1 -1
- data/test/jobs/unique_job_test.rb +6 -0
- data/test/models/commits_test.rb +1 -1
- data/test/models/deploys_test.rb +7 -7
- data/test/models/hook_test.rb +1 -1
- data/test/models/output_chunk_test.rb +1 -1
- data/test/models/stacks_test.rb +2 -2
- data/test/models/status_test.rb +1 -1
- data/test/models/team_test.rb +2 -2
- data/test/models/users_test.rb +1 -1
- data/test/test_helper.rb +1 -1
- data/test/unit/github_url_helper_test.rb +1 -1
- metadata +4 -2
@@ -1,2 +1,2 @@
|
|
1
|
-
o: ActiveSupport::Cache::Entry:@valuei/:@created_atf
|
1
|
+
o: ActiveSupport::Cache::Entry:@valuei/:@created_atf1441985184.249957:@expires_inf
|
2
2
|
3.6e3
|
@@ -1,2 +1,2 @@
|
|
1
|
-
o: ActiveSupport::Cache::Entry:@valuei
|
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_atf
|
1
|
+
o: ActiveSupport::Cache::Entry:@valuei/:@created_atf1441985184.291611:@expires_inf
|
2
2
|
3.6e3
|
@@ -1 +1 @@
|
|
1
|
-
o: ActiveSupport::Cache::Entry:@valueT:@created_atf
|
1
|
+
o: ActiveSupport::Cache::Entry:@valueT:@created_atf1441985186.357144:@expires_in0
|
@@ -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 },
|
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
|
data/test/models/commits_test.rb
CHANGED
@@ -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',
|
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
|
data/test/models/deploys_test.rb
CHANGED
@@ -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
|
40
|
+
stack = stacks(:shipit)
|
41
41
|
deploy = stack.deploys.new
|
42
|
-
last
|
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
|
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
|
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
|
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 },
|
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 },
|
240
|
+
assert_difference -> { Rollback.count }, 1 do
|
241
241
|
@deploy.trigger_rollback(@user)
|
242
242
|
end
|
243
243
|
end
|
data/test/models/hook_test.rb
CHANGED
@@ -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 },
|
32
|
+
assert_difference -> { Delivery.count }, 2 do
|
33
33
|
Hook.deliver(:deploy, @stack, 'foo' => 42)
|
34
34
|
end
|
35
35
|
|
data/test/models/stacks_test.rb
CHANGED
@@ -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',
|
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',
|
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
|
data/test/models/status_test.rb
CHANGED
@@ -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',
|
10
|
+
assert_difference '@commit.statuses.count', 1 do
|
11
11
|
@commit.statuses.replicate_from_github!(github_status)
|
12
12
|
end
|
13
13
|
|
data/test/models/team_test.rb
CHANGED
@@ -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 },
|
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 },
|
24
|
+
assert_difference -> { User.count }, 1 do
|
25
25
|
@team.refresh_members!
|
26
26
|
end
|
27
27
|
end
|
data/test/models/users_test.rb
CHANGED
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",
|
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
|
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.
|
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-
|
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
|