einhorn 0.6.0 → 0.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -13
- data/.travis.yml +2 -0
- data/lib/einhorn.rb +7 -0
- data/lib/einhorn/command.rb +0 -5
- data/lib/einhorn/version.rb +1 -1
- data/test/integration/_lib/helpers/einhorn_helpers.rb +5 -1
- data/test/integration/upgrading.rb +4 -4
- data/test/unit/einhorn/client.rb +24 -4
- metadata +19 -19
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
NTdmZGE0ZDVjMjYyODdlODIyZWM0Y2ExYWE1MWViNmQ3MjEzNWFlMQ==
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 308e0777b30c0d943079572f431fa7892c5bd36e
|
4
|
+
data.tar.gz: 39992f0151df4f7c2c6d9c9455466a9ed0359c5e
|
7
5
|
SHA512:
|
8
|
-
metadata.gz:
|
9
|
-
|
10
|
-
Mzc0NjY0MGQ1NWYxMzVkMjI4Nzg0MWNkZGI4MmEwMmIzZWI1MDk5ZDRkZmRh
|
11
|
-
YzBkYTAxMWU1MTVhZWU1ZTM1NDMzMGJlOTgyY2U0MTI5OTM3ZGI=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
MjQyZTI4NjI0Njg4NDJmMDBlMWQwYTY4MDU3OWRiZTFhOGJlNDg1YmNkZGJl
|
14
|
-
Y2EzNWMzYjk5NTA3NzU1NzhiN2JmYzUwZjgzYjUxOWU2NTBhM2U0MDA4OTdm
|
15
|
-
Njc4NzQ1MDI0ZWY5Zjk4MDk1NzllODk2NWYzMDE3MTllODM5Njk=
|
6
|
+
metadata.gz: da802c21aa7331fd2dd6597d3940a33622b13a2d4febc2736604ceb5c0b457e6f61930ad705d9f33e99477325b6c5cf2ee08006f5b688b36dc13ad040c5c0112
|
7
|
+
data.tar.gz: b5560a45b9f4de82ae2a9ac424333d63c0aafb93c578421ff100eb51eedac8652ac5cf0191c2189d30fcb8085b898e49d1433a51130f2dacf4103abf5be3f613
|
data/.travis.yml
CHANGED
data/lib/einhorn.rb
CHANGED
@@ -129,6 +129,13 @@ module Einhorn
|
|
129
129
|
updated_state[:reloading_for_upgrade] = updated_state.delete(:reloading_for_preload_upgrade)
|
130
130
|
message << "upgraded :reloading_for_preload_upgrade to :reloading_for_upgrade"
|
131
131
|
end
|
132
|
+
|
133
|
+
# For a period, we created children entries for state_passers,
|
134
|
+
# but we don't want that (in particular, it probably died before
|
135
|
+
# we could setup our SIGCHLD handler
|
136
|
+
if updated_state[:children]
|
137
|
+
updated_state[:children].delete_if {|k, v| v[:type] == :state_passer}
|
138
|
+
end
|
132
139
|
end
|
133
140
|
|
134
141
|
default = store.default_state
|
data/lib/einhorn/command.rb
CHANGED
@@ -40,8 +40,6 @@ module Einhorn
|
|
40
40
|
case type = spec[:type]
|
41
41
|
when :worker
|
42
42
|
Einhorn.log_info("===> Exited worker #{pid.inspect}#{extra}", :upgrade)
|
43
|
-
when :state_passer
|
44
|
-
Einhorn.log_debug("===> Exited state passing process #{pid.inspect}", :upgrade)
|
45
43
|
else
|
46
44
|
Einhorn.log_error("===> Exited process #{pid.inspect} has unrecgonized type #{type.inspect}: #{spec.inspect}", :upgrade)
|
47
45
|
end
|
@@ -204,9 +202,6 @@ module Einhorn
|
|
204
202
|
fork do
|
205
203
|
Einhorn::TransientState.whatami = :state_passer
|
206
204
|
Einhorn::State.generation += 1
|
207
|
-
Einhorn::State.children[$$] = {
|
208
|
-
:type => :state_passer
|
209
|
-
}
|
210
205
|
read.close
|
211
206
|
|
212
207
|
begin
|
data/lib/einhorn/version.rb
CHANGED
@@ -9,7 +9,11 @@ module Helpers
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def default_einhorn_command
|
12
|
-
['bundle', 'exec'
|
12
|
+
cmd = ['bundle', 'exec']
|
13
|
+
cmd << '--keep-file-descriptors' if RUBY_VERSION >= '2.0'
|
14
|
+
cmd << File.expand_path('bin/einhorn', einhorn_code_dir)
|
15
|
+
|
16
|
+
cmd
|
13
17
|
end
|
14
18
|
|
15
19
|
def with_running_einhorn(cmdline, options = {})
|
@@ -40,7 +40,7 @@ class UpgradeTests < EinhornIntegrationTestCase
|
|
40
40
|
describe 'when running with --reexec-as' do
|
41
41
|
it 'preserves environment variables across restarts' do
|
42
42
|
# exec the new einhorn with the same environment:
|
43
|
-
reexec_cmdline = 'env VAR=a bundle exec einhorn'
|
43
|
+
reexec_cmdline = 'env VAR=a bundle exec --keep-file-descriptors einhorn'
|
44
44
|
|
45
45
|
with_running_einhorn(%W{einhorn -m manual -b 127.0.0.1:#{@port} --reexec-as=#{reexec_cmdline} -d #{@socket_path} -- ruby #{@server_program} VAR},
|
46
46
|
:env => ENV.to_hash.merge({'VAR' => 'a'})) do |process|
|
@@ -56,7 +56,7 @@ class UpgradeTests < EinhornIntegrationTestCase
|
|
56
56
|
describe 'without preloading' do
|
57
57
|
it 'can update environment variables when the reexec command line says to' do
|
58
58
|
# exec the new einhorn with the same environment:
|
59
|
-
reexec_cmdline = 'env VAR=b OINK=b bundle exec einhorn'
|
59
|
+
reexec_cmdline = 'env VAR=b OINK=b bundle exec --keep-file-descriptors einhorn'
|
60
60
|
|
61
61
|
with_running_einhorn(%W{einhorn -m manual -b 127.0.0.1:#{@port} --reexec-as=#{reexec_cmdline} -d #{@socket_path} -- ruby #{@server_program} VAR},
|
62
62
|
:env => ENV.to_hash.merge({'VAR' => 'a'})) do |process|
|
@@ -73,7 +73,7 @@ class UpgradeTests < EinhornIntegrationTestCase
|
|
73
73
|
describe 'with preloading' do
|
74
74
|
it 'can update environment variables on preloaded code when the reexec command line says to' do
|
75
75
|
# exec the new einhorn with the same environment:
|
76
|
-
reexec_cmdline = 'env VAR=b OINK=b bundle exec einhorn'
|
76
|
+
reexec_cmdline = 'env VAR=b OINK=b bundle exec --keep-file-descriptors einhorn'
|
77
77
|
|
78
78
|
with_running_einhorn(%W{einhorn -m manual -p #{@server_program} -b 127.0.0.1:#{@port} --reexec-as=#{reexec_cmdline} -d #{@socket_path} -- ruby #{@server_program} VAR},
|
79
79
|
:env => ENV.to_hash.merge({'VAR' => 'a'})) do |process|
|
@@ -112,7 +112,7 @@ class UpgradeTests < EinhornIntegrationTestCase
|
|
112
112
|
end
|
113
113
|
|
114
114
|
it %{causes an upgrade with --reexec-as to not clobber the new environment} do
|
115
|
-
reexec_cmdline = 'env VAR2=b bundle exec einhorn'
|
115
|
+
reexec_cmdline = 'env VAR2=b bundle exec --keep-file-descriptors einhorn'
|
116
116
|
with_running_einhorn(%W{einhorn -m manual -b 127.0.0.1:#{@port} --drop-env-var=VAR1 --drop-env-var=VAR2 -d #{@socket_path} --reexec-as=#{reexec_cmdline} -- ruby #{@server_program} VAR1 VAR2},
|
117
117
|
:env => ENV.to_hash.merge({'VAR1' => 'a', 'VAR2' => 'a'})) do |process|
|
118
118
|
wait_for_open_port
|
data/test/unit/einhorn/client.rb
CHANGED
@@ -15,12 +15,22 @@ class ClientTest < EinhornTestCase
|
|
15
15
|
"---%0A:foo:%0A- ! '%25bar'%0A- ! '%25baz'%0A\n"
|
16
16
|
end
|
17
17
|
|
18
|
+
def serialized_2_0
|
19
|
+
"---%0A:foo:%0A- '%25bar'%0A- '%25baz'%0A\n"
|
20
|
+
end
|
21
|
+
|
22
|
+
def serialized_2_1
|
23
|
+
"---%0A:foo:%0A- \"%25bar\"%0A- \"%25baz\"%0A\n"
|
24
|
+
end
|
25
|
+
|
26
|
+
def serialized_options
|
27
|
+
[serialized_1_8, serialized_1_9, serialized_2_0, serialized_2_1]
|
28
|
+
end
|
29
|
+
|
18
30
|
describe "when sending a message" do
|
19
31
|
it "writes a serialized line" do
|
20
32
|
socket = mock
|
21
|
-
socket.expects(:write).with
|
22
|
-
write == serialized_1_8 || write == serialized_1_9
|
23
|
-
end
|
33
|
+
socket.expects(:write).with {|write| serialized_options.include?(write)}
|
24
34
|
Einhorn::Client::Transport.send_message(socket, unserialized_message)
|
25
35
|
end
|
26
36
|
end
|
@@ -44,7 +54,7 @@ class ClientTest < EinhornTestCase
|
|
44
54
|
describe "when {de,}serializing a message" do
|
45
55
|
it "serializes and escape a message as expected" do
|
46
56
|
actual = Einhorn::Client::Transport.serialize_message(unserialized_message)
|
47
|
-
assert(actual
|
57
|
+
assert(serialized_options.include?(actual), "Actual message is #{actual.inspect}")
|
48
58
|
end
|
49
59
|
|
50
60
|
it "deserializes and unescape a 1.8-style message as expected" do
|
@@ -57,6 +67,16 @@ class ClientTest < EinhornTestCase
|
|
57
67
|
assert_equal(unserialized_message, actual)
|
58
68
|
end
|
59
69
|
|
70
|
+
it "deserializes and unescapes a 2.0-style message as expected" do
|
71
|
+
actual = Einhorn::Client::Transport.deserialize_message(serialized_2_0)
|
72
|
+
assert_equal(unserialized_message, actual)
|
73
|
+
end
|
74
|
+
|
75
|
+
it "deserializes and unescapes a 2.1-style message as expected" do
|
76
|
+
actual = Einhorn::Client::Transport.deserialize_message(serialized_2_1)
|
77
|
+
assert_equal(unserialized_message, actual)
|
78
|
+
end
|
79
|
+
|
60
80
|
it "raises an error when deserializing invalid YAML" do
|
61
81
|
invalid_serialized = "-%0A\t-"
|
62
82
|
begin
|
metadata
CHANGED
@@ -1,97 +1,97 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: einhorn
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Greg Brockman
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-08-
|
11
|
+
date: 2014-08-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: pry
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: minitest
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - <
|
45
|
+
- - "<"
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '5.0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - <
|
52
|
+
- - "<"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '5.0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: mocha
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - ~>
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0.13'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - ~>
|
66
|
+
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0.13'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: chalk-rake
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '0'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: subprocess
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- -
|
87
|
+
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '0'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- -
|
94
|
+
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
97
|
description: Einhorn makes it easy to run multiple instances of an application server,
|
@@ -106,8 +106,8 @@ executables:
|
|
106
106
|
extensions: []
|
107
107
|
extra_rdoc_files: []
|
108
108
|
files:
|
109
|
-
- .gitignore
|
110
|
-
- .travis.yml
|
109
|
+
- ".gitignore"
|
110
|
+
- ".travis.yml"
|
111
111
|
- CONTRIBUTORS
|
112
112
|
- Gemfile
|
113
113
|
- History.txt
|
@@ -171,12 +171,12 @@ require_paths:
|
|
171
171
|
- lib
|
172
172
|
required_ruby_version: !ruby/object:Gem::Requirement
|
173
173
|
requirements:
|
174
|
-
- -
|
174
|
+
- - ">="
|
175
175
|
- !ruby/object:Gem::Version
|
176
176
|
version: '0'
|
177
177
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
178
178
|
requirements:
|
179
|
-
- -
|
179
|
+
- - ">="
|
180
180
|
- !ruby/object:Gem::Version
|
181
181
|
version: '0'
|
182
182
|
requirements: []
|
@@ -184,7 +184,7 @@ rubyforge_project:
|
|
184
184
|
rubygems_version: 2.2.2
|
185
185
|
signing_key:
|
186
186
|
specification_version: 4
|
187
|
-
summary:
|
187
|
+
summary: 'Einhorn: the language-independent shared socket manager'
|
188
188
|
test_files:
|
189
189
|
- test/_lib.rb
|
190
190
|
- test/integration/_lib.rb
|