[DRE-commits] [ruby-em-proxy] 01/01: add rake testsuite

Philippe Thierry pthierry-guest at moszumanska.debian.org
Sun Jul 16 10:50:23 UTC 2017


This is an automated email from the git hooks/post-receive script.

pthierry-guest pushed a commit to branch master
in repository ruby-em-proxy.

commit 934849533d38a71fa01c80e1889fec6058d9a35a
Author: Philippe Thierry <phil at reseau-libre.net>
Date:   Sun Jul 16 11:56:12 2017 +0200

    add rake testsuite
---
 debian/control                            |   6 +-
 debian/patches/failing_tests.patch        | 161 ++++++++++++++++++++++++++++++
 debian/patches/series                     |   2 +
 debian/patches/updated-deps-version.patch |  58 +++++++++++
 debian/ruby-tests.rake                    |   5 +
 5 files changed, 231 insertions(+), 1 deletion(-)

diff --git a/debian/control b/debian/control
index 1cd2ac8..72535ec 100644
--- a/debian/control
+++ b/debian/control
@@ -10,8 +10,12 @@ Build-Depends:
  rake,
  ruby-eventmachine,
  ruby-rspec,
+ ruby-bundler,
+ ruby-ansi,
+ ruby-posix-spawn,
+ ruby-em-http-request,
  go-md2man
-Standards-Version: 3.9.8
+Standards-Version: 4.0.0
 Homepage: https://github.com/igrigorik/em-proxy
 Vcs-Git: https://anonscm.debian.org/git/pkg-ruby-extras/ruby-em-proxy.git
 Vcs-Browser: https://anonscm.debian.org/cgit/pkg-ruby-extras/ruby-em-proxy.git
diff --git a/debian/patches/failing_tests.patch b/debian/patches/failing_tests.patch
new file mode 100644
index 0000000..3b435da
--- /dev/null
+++ b/debian/patches/failing_tests.patch
@@ -0,0 +1,161 @@
+Description: deacrivated failing patches that requests external access
+Author: Philippe Thierry
+Last-Update: 2017-07-16
+--- a/spec/proxy_spec.rb
++++ b/spec/proxy_spec.rb
+@@ -23,155 +23,6 @@
+     end
+   end
+ 
+-  it "should call the on_connect callback" do
+-    connected = false
+-    EM.run do
+-      EventMachine.add_timer(0.1) do
+-        EventMachine::HttpRequest.new('http://127.0.0.1:8080/').get({:timeout => 1})
+-      end
+-
+-      Proxy.start(:host => "0.0.0.0", :port => 8080) do |conn|
+-        conn.server :goog, :host => "google.com", :port => 80
+-
+-        conn.on_connect do |name|
+-          connected = true
+-          EventMachine.stop
+-        end
+-      end
+-    end
+-    connected.should == true
+-  end
+-
+-
+-  it "should transparently redirect TCP traffic to google" do
+-    EM.run do
+-      EventMachine.add_timer(0.1) do
+-        EventMachine::HttpRequest.new('http://127.0.0.1:8080/').get({:timeout => 1})
+-      end
+-
+-      Proxy.start(:host => "0.0.0.0", :port => 8080) do |conn|
+-        conn.server :goog, :host => "google.com", :port => 80
+-        conn.on_data { |data| data }
+-
+-        conn.on_response do |backend, resp|
+-          backend.should == :goog
+-          resp.size.should >= 0
+-          EventMachine.stop
+-        end
+-      end
+-    end
+-  end
+-
+-  it "should duplex TCP traffic to two backends" do
+-    EM.run do
+-      EventMachine.add_timer(0.1) do
+-        EventMachine::HttpRequest.new('http://127.0.0.1:8080/test').get({:timeout => 1})
+-      end
+-
+-      Proxy.start(:host => "0.0.0.0", :port => 8080) do |conn|
+-        conn.server :goog1, :host => "google.com", :port => 80
+-        conn.server :goog2, :host => "google.com", :port => 80
+-        conn.on_data { |data| data }
+-
+-        seen = []
+-        conn.on_response do |backend, resp|
+-          case backend
+-          when :goog1 then
+-            resp.should =~ /404/
+-            seen.push backend
+-          when :goog2
+-            resp.should =~ /404/
+-            seen.push backend
+-          end
+-          seen.uniq!
+-
+-          EventMachine.stop if seen.size == 2
+-        end
+-
+-        conn.on_finish do |name|
+-          # keep the connection open if we're still expecting a response
+-          seen.count == 2 ? :close : :keep
+-        end
+-
+-      end
+-    end
+-  end
+-
+-  it "should intercept & alter response from Google" do
+-    EM.run do
+-      EventMachine.add_timer(0.1) do
+-        http = EventMachine::HttpRequest.new('http://127.0.0.1:8080/').get({:timeout => 1})
+-        http.errback { failed }
+-        http.callback {
+-          http.response_header.status.should == 404
+-          EventMachine.stop
+-        }
+-      end
+-
+-      Proxy.start(:host => "0.0.0.0", :port => 8080) do |conn|
+-        conn.server :goog, :host => "google.com", :port => 80
+-        conn.on_data { |data| data }
+-        conn.on_response do |backend, data|
+-          data.gsub(/^HTTP\/1.1 301/, 'HTTP/1.1 404')
+-        end
+-      end
+-    end
+-  end
+-
+-  it "should invoke on_finish callback when connection is terminated" do
+-    EM.run do
+-      EventMachine.add_timer(0.1) do
+-        EventMachine::HttpRequest.new('http://127.0.0.1:8080/').get({:timeout => 1})
+-      end
+-
+-      Proxy.start(:host => "0.0.0.0", :port => 8080) do |conn|
+-        conn.server :goog, :host => "google.com", :port => 80
+-        conn.on_data { |data| data }
+-        conn.on_response { |backend, resp| resp }
+-        conn.on_finish do |backend|
+-          backend.should == :goog
+-          EventMachine.stop
+-        end
+-      end
+-    end
+-  end
+-
+-  it "should not invoke on_data when :relay_client is passed as server option" do
+-    lambda {
+-      EM.run do
+-        EventMachine.add_timer(0.1) do
+-          http = EventMachine::HttpRequest.new('http://127.0.0.1:8080/').get({:timeout => 1})
+-          http.callback { EventMachine.stop }
+-        end
+-
+-        Proxy.start(:host => "0.0.0.0", :port => 8080) do |conn|
+-          conn.server :goog, :host => "google.com", :port => 80, :relay_client => true
+-          conn.on_data { |data| raise "Should not be here"; data }
+-          conn.on_response { |backend, resp| resp }
+-
+-        end
+-      end
+-    }.should_not raise_error
+-  end
+-
+-  it "should not invoke on_response when :relay_server is passed as server option" do
+-    lambda {
+-      EM.run do
+-        EventMachine.add_timer(0.1) do
+-          http = EventMachine::HttpRequest.new('http://127.0.0.1:8080/').get({:timeout => 1})
+-          http.callback { EventMachine.stop }
+-        end
+-
+-        Proxy.start(:host => "0.0.0.0", :port => 8080) do |conn|
+-          conn.server :goog, :host => "google.com", :port => 80, :relay_server => true
+-          conn.on_data { |data| data }
+-          conn.on_response { |backend, resp| raise "Should not be here"; }
+-
+-        end
+-      end
+-    }.should_not raise_error
+-  end
+-
+   context "echo server" do
+     before :each do
+       @echo_server = File.expand_path("../../spec/support/echo_server.rb", __FILE__)
diff --git a/debian/patches/series b/debian/patches/series
index b6c9316..e631e66 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1 +1,3 @@
+failing_tests.patch
+updated-deps-version.patch
 drop-git-ls-files.patch
diff --git a/debian/patches/updated-deps-version.patch b/debian/patches/updated-deps-version.patch
new file mode 100644
index 0000000..8b39f61
--- /dev/null
+++ b/debian/patches/updated-deps-version.patch
@@ -0,0 +1,58 @@
+Description: updated dependencies versions
+Author: Philippe Thierry
+Last-Update: 2017-07-16
+--- a/Gemfile.lock
++++ /dev/null
+@@ -1,52 +0,0 @@
+-PATH
+-  remote: .
+-  specs:
+-    em-proxy (0.1.8)
+-      eventmachine
+-
+-GEM
+-  remote: http://rubygems.org/
+-  specs:
+-    addressable (2.4.0)
+-    ansi (1.5.0)
+-    cookiejar (0.3.3)
+-    diff-lcs (1.2.5)
+-    em-http-request (1.1.4)
+-      addressable (>= 2.3.4)
+-      cookiejar (!= 0.3.1)
+-      em-socksify (>= 0.3)
+-      eventmachine (>= 1.0.3)
+-      http_parser.rb (>= 0.6.0)
+-    em-socksify (0.3.1)
+-      eventmachine (>= 1.0.0.beta.4)
+-    eventmachine (1.2.0.1)
+-    http_parser.rb (0.6.0)
+-    posix-spawn (0.3.11)
+-    rake (11.2.2)
+-    rspec (3.4.0)
+-      rspec-core (~> 3.4.0)
+-      rspec-expectations (~> 3.4.0)
+-      rspec-mocks (~> 3.4.0)
+-    rspec-core (3.4.4)
+-      rspec-support (~> 3.4.0)
+-    rspec-expectations (3.4.0)
+-      diff-lcs (>= 1.2.0, < 2.0)
+-      rspec-support (~> 3.4.0)
+-    rspec-mocks (3.4.1)
+-      diff-lcs (>= 1.2.0, < 2.0)
+-      rspec-support (~> 3.4.0)
+-    rspec-support (3.4.1)
+-
+-PLATFORMS
+-  ruby
+-
+-DEPENDENCIES
+-  ansi
+-  em-http-request
+-  em-proxy!
+-  posix-spawn
+-  rake
+-  rspec
+-
+-BUNDLED WITH
+-   1.12.5
diff --git a/debian/ruby-tests.rake b/debian/ruby-tests.rake
new file mode 100644
index 0000000..6c7a4e6
--- /dev/null
+++ b/debian/ruby-tests.rake
@@ -0,0 +1,5 @@
+require 'gem2deb/rake/spectask'
+
+Gem2Deb::Rake::RSpecTask.new do |spec|
+    spec.pattern = './spec/**/*_spec.rb'
+end

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/ruby-em-proxy.git



More information about the Pkg-ruby-extras-commits mailing list