multibinder 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 04308acfb4e6a38f2ec0d7bd53b3bf921328ece0
4
- data.tar.gz: cd6936ec293af4d11edf3d13e6e26a402c6dcb9e
3
+ metadata.gz: dabc32c60bf41a7ac5df3709688f87b62aedf037
4
+ data.tar.gz: 1353e78eb3c9ba7b1d99a2ee7006b66f90af8214
5
5
  SHA512:
6
- metadata.gz: 071505702ac618577faf5de290e3b87c6b0f52d4579fa08d259b501509d1b47a2b5e040eedabc32438e3e2b5bbe77cbbcc577269dba62b8d7fc69fb2eeac1e46
7
- data.tar.gz: 7fbf21103b70a01ad7e87768774f6fd37eef0980f4375db09e3bb6996685969068b6b57ce1711b6962040e54177437077bec8226a8bba2d9cb5dcccfd0ec949b
6
+ metadata.gz: 1f8d608341c689a49983a185d4bc24201a701a95e3351e6518148e1e5ee9e8f9863a672bb0413a94cb23899308f037ee0b54080d8d79f234ef8581823d19ec5c
7
+ data.tar.gz: 42f99726970af3eeccb0b0adcb6ecbe30fc60a9a4dab7d1e2241a1da54ab61abf411dbb6c30801da01c62f65f40b04a382d0ee3f2f503fb2de2703569fac96ae
data/.gitignore CHANGED
@@ -13,3 +13,4 @@
13
13
  *.a
14
14
  mkmf.log
15
15
  *.gem
16
+ vendor/gems
@@ -2,6 +2,7 @@
2
2
 
3
3
  require 'socket'
4
4
  require 'json'
5
+ require 'fcntl'
5
6
 
6
7
  class MultiBinderServer
7
8
  def initialize(control_file)
@@ -1,3 +1,3 @@
1
1
  module MultiBinder
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -17,6 +17,6 @@ Gem::Specification.new do |spec|
17
17
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
18
  spec.require_paths = ["lib"]
19
19
 
20
- spec.add_development_dependency "bundler", "~> 1.6"
20
+ spec.add_development_dependency "bundler", "~> 1.5"
21
21
  spec.add_development_dependency "rake", "~> 10.0"
22
22
  end
@@ -3,9 +3,9 @@
3
3
  export RUBY_VERSION=2.1.6-github
4
4
  export RBENV_VERSION=2.1.6-github
5
5
  export PATH=/usr/share/rbenv/shims:/usr/sbin:$PATH
6
- export BASE_DIR=/data/binder
6
+ export BASE_DIR=/data/multibinder
7
7
 
8
- #bundle install --local --quiet --path vendor/gems
8
+ bundle install --local --quiet --path vendor/gems
9
9
 
10
10
  REALPATH=$(cd $(dirname "$0") && pwd)
11
11
 
@@ -0,0 +1,13 @@
1
+ #!/bin/sh
2
+
3
+ export RUBY_VERSION=2.1.6-github
4
+ export RBENV_VERSION=2.1.6-github
5
+ export PATH=/usr/share/rbenv/shims:/usr/sbin:$PATH
6
+ export BASE_DIR=/data/multibinder
7
+
8
+ REALPATH=$(cd $(dirname "$0") && pwd)
9
+ cd $REALPATH/../
10
+
11
+ bundle install --local --quiet --path vendor/gems
12
+
13
+ sudo sv 1 multibinder
@@ -9,13 +9,17 @@ loop do
9
9
  request = socket.gets
10
10
  puts request
11
11
 
12
- socket.print "HTTP/1.0 200 OK\r\n"
13
- socket.print "Content-Type: text/plain\r\n"
14
- socket.print "Connection: close\r\n"
12
+ begin
13
+ socket.print "HTTP/1.0 200 OK\r\n"
14
+ socket.print "Content-Type: text/plain\r\n"
15
+ socket.print "Connection: close\r\n"
15
16
 
16
- socket.print "\r\n"
17
+ socket.print "\r\n"
17
18
 
18
- socket.print "Hello World #{ARGV[1] || ''}!\n"
19
+ socket.print "Hello World #{ARGV[1] || ''}!\n"
19
20
 
20
- socket.close
21
+ socket.close
22
+ rescue Errno::EPIPE
23
+ puts 'Client unexpectedly closed connection'
24
+ end
21
25
  end
@@ -1,4 +1,4 @@
1
- #!/bin/sh
1
+ #!/bin/bash
2
2
  #
3
3
  # test-haproxy.sh: check that we can work with haproxy (if it's installed)
4
4
 
@@ -9,7 +9,7 @@ TEST_PORT=8000
9
9
 
10
10
  tests_use_port $TEST_PORT
11
11
 
12
- if ! which -s haproxy; then
12
+ if ! which haproxy >/dev/null 2>&1; then
13
13
  echo "haproxy not available, skipping tests."
14
14
  exit 0
15
15
  fi
@@ -20,7 +20,7 @@ begin_test "haproxy runs with multibinder"
20
20
 
21
21
  export TEMPDIR
22
22
 
23
- MULTIBINDER_SOCK=${TEMPDIR}/multibinder.sock launch_service "haproxy" bundle exec ruby test/haproxy_shim.rb $(offset_port $TEST_PORT)
23
+ launch_service "haproxy" bundle exec env MULTIBINDER_SOCK=${TEMPDIR}/multibinder.sock ruby test/haproxy_shim.rb $(offset_port $TEST_PORT)
24
24
 
25
25
  wait_for_port "haproxy" $(offset_port $TEST_PORT)
26
26
 
@@ -1,4 +1,4 @@
1
- #!/bin/sh
1
+ #!/bin/bash
2
2
  #
3
3
  # test-simple.sh: simple sanity checks
4
4
 
@@ -13,7 +13,7 @@ begin_test "server binds and accepts through multibinder"
13
13
  (
14
14
  setup
15
15
 
16
- MULTIBINDER_SOCK=${TEMPDIR}/multibinder.sock launch_service "http" bundle exec ruby test/httpbinder.rb $(offset_port $TEST_PORT)
16
+ launch_service "http" bundle exec env MULTIBINDER_SOCK=${TEMPDIR}/multibinder.sock ruby test/httpbinder.rb $(offset_port $TEST_PORT)
17
17
 
18
18
  wait_for_port "binder" $(offset_port $TEST_PORT)
19
19
 
@@ -25,7 +25,7 @@ begin_test "server can restart without requests failing while down"
25
25
  (
26
26
  setup
27
27
 
28
- MULTIBINDER_SOCK=${TEMPDIR}/multibinder.sock launch_service "http" bundle exec ruby test/httpbinder.rb $(offset_port $TEST_PORT)
28
+ launch_service "http" bundle exec env MULTIBINDER_SOCK=${TEMPDIR}/multibinder.sock ruby test/httpbinder.rb $(offset_port $TEST_PORT)
29
29
 
30
30
  wait_for_port "binder" $(offset_port $TEST_PORT)
31
31
 
@@ -37,7 +37,7 @@ begin_test "server can restart without requests failing while down"
37
37
  sleep 0.5
38
38
 
39
39
  # now restart the service
40
- MULTIBINDER_SOCK=${TEMPDIR}/multibinder.sock launch_service "http" bundle exec ruby test/httpbinder.rb $(offset_port $TEST_PORT)
40
+ launch_service "http" bundle exec env MULTIBINDER_SOCK=${TEMPDIR}/multibinder.sock ruby test/httpbinder.rb $(offset_port $TEST_PORT)
41
41
 
42
42
  # curl should finish, and succeed
43
43
  wait $curl_pid
@@ -49,12 +49,12 @@ begin_test "server can load a second copy then terminate the first"
49
49
  (
50
50
  setup
51
51
 
52
- MULTIBINDER_SOCK=${TEMPDIR}/multibinder.sock launch_service "http" bundle exec ruby test/httpbinder.rb $(offset_port $TEST_PORT) "first"
52
+ launch_service "http" bundle exec env MULTIBINDER_SOCK=${TEMPDIR}/multibinder.sock ruby test/httpbinder.rb $(offset_port $TEST_PORT) "first"
53
53
  wait_for_port "binder" $(offset_port $TEST_PORT)
54
54
 
55
55
  curl --max-time 5 http://localhost:$(offset_port $TEST_PORT)/r1 | grep -q 'Hello World first'
56
56
 
57
- MULTIBINDER_SOCK=${TEMPDIR}/multibinder.sock launch_service "http2" bundle exec ruby test/httpbinder.rb $(offset_port $TEST_PORT) "second"
57
+ launch_service "http2" bundle exec env MULTIBINDER_SOCK=${TEMPDIR}/multibinder.sock ruby test/httpbinder.rb $(offset_port $TEST_PORT) "second"
58
58
 
59
59
  curl --max-time 5 http://localhost:$(offset_port $TEST_PORT)/r2 | egrep -q 'Hello World (first|second)'
60
60
 
@@ -70,7 +70,7 @@ begin_test "multibinder restarts safely on sigusr1"
70
70
  (
71
71
  setup
72
72
 
73
- MULTIBINDER_SOCK=${TEMPDIR}/multibinder.sock launch_service "http" bundle exec ruby test/httpbinder.rb $(offset_port $TEST_PORT)
73
+ launch_service "http" bundle exec env MULTIBINDER_SOCK=${TEMPDIR}/multibinder.sock ruby test/httpbinder.rb $(offset_port $TEST_PORT)
74
74
  wait_for_port "binder" $(offset_port $TEST_PORT)
75
75
 
76
76
  curl --max-time 5 http://localhost:$(offset_port $TEST_PORT)/r1 | grep -q 'Hello World'
@@ -86,7 +86,7 @@ begin_test "multibinder restarts safely on sigusr1"
86
86
  lsof -i :$(offset_port $TEST_PORT) -a -p $(service_pid "multibinder")
87
87
 
88
88
  # should be able to request the bind again
89
- MULTIBINDER_SOCK=${TEMPDIR}/multibinder.sock launch_service "http" bundle exec ruby test/httpbinder.rb $(offset_port $TEST_PORT)
89
+ launch_service "http" bundle exec env MULTIBINDER_SOCK=${TEMPDIR}/multibinder.sock ruby test/httpbinder.rb $(offset_port $TEST_PORT)
90
90
  wait_for_port "multibinder" $(offset_port $TEST_PORT)
91
91
 
92
92
  # requests should work
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: multibinder
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Theo Julienne
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-11-29 00:00:00.000000000 Z
11
+ date: 2015-12-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.6'
19
+ version: '1.5'
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
- version: '1.6'
26
+ version: '1.5'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -56,6 +56,7 @@ files:
56
56
  - lib/multibinder/version.rb
57
57
  - multibinder.gemspec
58
58
  - script/cibuild
59
+ - script/deploy
59
60
  - script/test
60
61
  - test/haproxy_shim.rb
61
62
  - test/httpbinder.rb