heroku_hatchet 4.0.12 → 4.0.13

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
  SHA256:
3
- metadata.gz: 721106d8d9d4a9bcbad680de78cf4d71fe1f35091a23170801df815e79dd465a
4
- data.tar.gz: d617e9d31847ff2aa30129f338a967b6c621853e8298c6e488fc473a1d2793c3
3
+ metadata.gz: 895d00a42bbb18d86b4bf075a16ab8e536ef6ef67f353c630acaeb5f79b4fd94
4
+ data.tar.gz: d3549371277c1e76b9f6c6448de2957fd31d7a41fd9fd5fb6d0fddf4c0967b79
5
5
  SHA512:
6
- metadata.gz: 1a6410e04d8a3f585f12e7ed067191314cdb208a5b6a0916ce0ac79595dbaf75d1522c74c8621ac27aa7571945400aded90fc1640737a5a23dbc4880ea283d23
7
- data.tar.gz: 39812cdaa659c3759b53fea93afb1bd4b3a893c8945f4d8804774510043433fed8d4204def577e2930d13e22bfd332864b51ab2fba214fe02ab80fcfa2f10557
6
+ metadata.gz: 0157e99984e519299ce19ac65b885598ee27cd8c062898a138acddd74b57b2f08c2dc7f6d72e3e256b9d12bfe3fdd2287a65ff6b4109bbf68f4dbdcc1d9f2126
7
+ data.tar.gz: 1302a1147e81c625a3b517748a65b366db90158c75bd7de79e746bbc72f0857d90b2709c3645bfae512c79076fcef7cab02ba60d7d8beb696ff46549a032fecd
data/.travis.yml CHANGED
@@ -3,7 +3,7 @@ rvm:
3
3
  - 2.3.1
4
4
  before_script:
5
5
  - bundle exec hatchet ci:setup
6
- script: bundle exec parallel_test test/hatchet -n 9
6
+ script: bundle exec parallel_test test/hatchet -n 11
7
7
  after_script: bundle exec rake hatchet:teardown_travis
8
8
  env:
9
9
  global:
data/CHANGELOG.md CHANGED
@@ -1,9 +1,13 @@
1
1
  ## HEAD
2
2
 
3
+ ## 4.0.13
4
+
5
+ - Introduce `App#in_directory_fork` for safe execution of code that might mutate the process env vars (https://github.com/heroku/hatchet/pull/65)
6
+
3
7
  ## 4.0.12
4
8
 
5
9
  - Fix deadlock when a single process kills the same app twice (https://github.com/heroku/hatchet/pull/63)
6
- - Add ability to debug deadlock with HATCHET_DEBUG_DEADLOCK env var.
10
+ - Add ability to debug deadlock with `HATCHET_DEBUG_DEADLOCK` env var.
7
11
 
8
12
  ## 4.0.11
9
13
 
data/hatchet.gemspec CHANGED
@@ -29,6 +29,6 @@ Gem::Specification.new do |gem|
29
29
  gem.add_development_dependency "minitest", "~> 5.1"
30
30
  gem.add_development_dependency "rake", "~> 10"
31
31
  gem.add_development_dependency "mocha", "~> 1"
32
- gem.add_development_dependency "parallel_tests", "~> 0"
32
+ gem.add_development_dependency "parallel_tests", "~> 2"
33
33
  gem.add_development_dependency "travis", "~> 1"
34
34
  end
data/lib/hatchet/app.rb CHANGED
@@ -218,6 +218,32 @@ module Hatchet
218
218
  end
219
219
  end
220
220
 
221
+ # A safer alternative to in_directory
222
+ # this method is used to run code that may mutate the
223
+ # current process anything run in this block is executed
224
+ # in a different fork
225
+ def in_directory_fork(&block)
226
+ Tempfile.create("stdout") do |tmp_file|
227
+ pid = fork do
228
+ $stdout.reopen(tmp_file, "w")
229
+ $stderr.reopen(tmp_file, "w")
230
+ $stdout.sync = true
231
+ $stderr.sync = true
232
+ in_directory do |dir|
233
+ yield dir
234
+ end
235
+ Kernel.exit!(0) # needed for https://github.com/seattlerb/minitest/pull/683
236
+ end
237
+ Process.waitpid(pid)
238
+
239
+ if $?.success?
240
+ puts File.read(tmp_file)
241
+ else
242
+ raise File.read(tmp_file)
243
+ end
244
+ end
245
+ end
246
+
221
247
  # creates a new app on heroku, "pushes" via anvil or git
222
248
  # then yields to self so you can call self.run or
223
249
  # self.deployed?
@@ -1,3 +1,3 @@
1
1
  module Hatchet
2
- VERSION = "4.0.12"
2
+ VERSION = "4.0.13"
3
3
  end
@@ -1,23 +1,11 @@
1
1
  require 'test_helper'
2
2
 
3
3
  class CITest < Minitest::Test
4
-
5
- def test_ci_create_app_with_stack
6
- Hatchet::GitApp.new("rails5_ruby_schema_format").run_ci do |test_run|
7
- assert_match "Ruby buildpack tests completed successfully", test_run.output
8
- assert_equal :succeeded, test_run.status
9
- end
10
- end
11
-
12
4
  def test_error_with_bad_app
13
5
  error = assert_raise(Hatchet::FailedTestError) do
14
6
  Hatchet::GitApp.new("rails5_ci_fails_no_database").run_ci {}
15
7
  end
16
8
 
17
- assert_match "PG::ConnectionBad: could not connect to server" ,error.message
18
-
19
- Hatchet::GitApp.new("rails5_ci_fails_no_database", allow_failure: true).run_ci do |test_run|
20
- assert_equal :errored, test_run.status
21
- end
9
+ assert_match "PG::ConnectionBad: could not connect to server", error.message
22
10
  end
23
11
  end
@@ -0,0 +1,9 @@
1
+ require 'test_helper'
2
+
3
+ class CIThreeTest < Minitest::Test
4
+ def test_error_with_bad_app
5
+ Hatchet::GitApp.new("rails5_ci_fails_no_database", allow_failure: true).run_ci do |test_run|
6
+ assert_equal :errored, test_run.status
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,11 @@
1
+ require 'test_helper'
2
+
3
+ # Split out to be faster
4
+ class CITestToo < Minitest::Test
5
+ def test_ci_create_app_with_stack
6
+ Hatchet::GitApp.new("rails5_ruby_schema_format").run_ci do |test_run|
7
+ assert_match "Ruby buildpack tests completed successfully", test_run.output
8
+ assert_equal :succeeded, test_run.status
9
+ end
10
+ end
11
+ end
@@ -1,6 +1,18 @@
1
1
  require 'test_helper'
2
2
 
3
- class AppTest < Minitest::Test
3
+ class LocalRepoTest < Minitest::Test
4
+ def test_in_directory_fork
5
+ env_name = SecureRandom.hex
6
+ ENV[env_name] = env_name
7
+
8
+ Hatchet::App.new("default_ruby").in_directory_fork do
9
+ ENV.delete(env_name)
10
+ assert_nil ENV[env_name]
11
+ end
12
+
13
+ assert_equal env_name, ENV[env_name]
14
+ end
15
+
4
16
  def test_repos_checked_into_git
5
17
  app = Hatchet::App.new("test/different-folder-for-checked-in-repos/default_ruby")
6
18
  app.in_directory do
data/test/test_helper.rb CHANGED
@@ -23,3 +23,5 @@ end
23
23
 
24
24
 
25
25
  ENV['HATCHET_BUILDPACK_BRANCH'] = "master"
26
+
27
+ require 'parallel_tests/test/runtime_logger' if ENV['RECORD_RUNTIME']
@@ -0,0 +1,3 @@
1
+ test/hatchet/edit_repo_test.rb:5.40
2
+ test/hatchet/local_repo_test.rb:9.60
3
+ test/hatchet/heroku_api_test.rb:21.88
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: heroku_hatchet
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.12
4
+ version: 4.0.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Richard Schneeman
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-05-31 00:00:00.000000000 Z
11
+ date: 2019-09-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: platform-api
@@ -156,14 +156,14 @@ dependencies:
156
156
  requirements:
157
157
  - - "~>"
158
158
  - !ruby/object:Gem::Version
159
- version: '0'
159
+ version: '2'
160
160
  type: :development
161
161
  prerelease: false
162
162
  version_requirements: !ruby/object:Gem::Requirement
163
163
  requirements:
164
164
  - - "~>"
165
165
  - !ruby/object:Gem::Version
166
- version: '0'
166
+ version: '2'
167
167
  - !ruby/object:Gem::Dependency
168
168
  name: travis
169
169
  requirement: !ruby/object:Gem::Requirement
@@ -219,6 +219,8 @@ files:
219
219
  - test/hatchet/allow_failure_git_test.rb
220
220
  - test/hatchet/app_test.rb
221
221
  - test/hatchet/ci_test.rb
222
+ - test/hatchet/ci_three_test.rb
223
+ - test/hatchet/ci_too_test.rb
222
224
  - test/hatchet/config_test.rb
223
225
  - test/hatchet/edit_repo_test.rb
224
226
  - test/hatchet/git_test.rb
@@ -228,6 +230,7 @@ files:
228
230
  - test/hatchet/lock_test.rb
229
231
  - test/hatchet/multi_cmd_runner_test.rb
230
232
  - test/test_helper.rb
233
+ - tmp/parallel_runtime_test.log
231
234
  homepage: https://github.com/heroku/hatchet
232
235
  licenses:
233
236
  - MIT
@@ -262,6 +265,8 @@ test_files:
262
265
  - test/hatchet/allow_failure_git_test.rb
263
266
  - test/hatchet/app_test.rb
264
267
  - test/hatchet/ci_test.rb
268
+ - test/hatchet/ci_three_test.rb
269
+ - test/hatchet/ci_too_test.rb
265
270
  - test/hatchet/config_test.rb
266
271
  - test/hatchet/edit_repo_test.rb
267
272
  - test/hatchet/git_test.rb