lbspec 0.2.3 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -17,40 +17,40 @@ RSpec::Matchers.define :respond do |expect|
17
17
  chain :tcp do
18
18
  @protocol = :tcp
19
19
  @application = nil
20
- Lbspec::Util.add_string(@chain_str, ' tcp')
20
+ @chain_str = Lbspec::Util.add_string(@chain_str, ' tcp')
21
21
  end
22
22
 
23
23
  chain :udp do
24
24
  @protocol = :udp
25
25
  @application = nil
26
- Lbspec::Util.add_string(@chain_str, ' udp')
26
+ @chain_str = Lbspec::Util.add_string(@chain_str, ' udp')
27
27
  end
28
28
 
29
29
  chain :http do
30
30
  @protocol = :tcp
31
31
  @application = :http
32
- Lbspec::Util.add_string(@chain_str, ' http')
32
+ @chain_str = Lbspec::Util.add_string(@chain_str, ' http')
33
33
  end
34
34
 
35
35
  chain :https do
36
36
  @protocol = :tcp
37
37
  @application = :https
38
- Lbspec::Util.add_string(@chain_str, ' https')
38
+ @chain_str = Lbspec::Util.add_string(@chain_str, ' https')
39
39
  end
40
40
 
41
41
  chain :from do |from|
42
42
  @from = from
43
- Lbspec::Util.add_string(@chain_str, " from #{from}")
43
+ @chain_str = Lbspec::Util.add_string(@chain_str, " from #{from}")
44
44
  end
45
45
 
46
46
  chain :path do |path|
47
47
  @path = path
48
- Lbspec::Util.add_string(@chain_str, " via #{path}")
48
+ @chain_str = Lbspec::Util.add_string(@chain_str, " via #{path}")
49
49
  end
50
50
 
51
51
  chain :with do |string|
52
52
  @string = string
53
- Lbspec::Util.add_string(@chain_str, " via #{string}")
53
+ @chain_str = Lbspec::Util.add_string(@chain_str, " via #{string}")
54
54
  end
55
55
 
56
56
  chain :options do |options|
@@ -22,44 +22,44 @@ RSpec::Matchers.define :transfer do |nodes|
22
22
 
23
23
  chain :port do |port|
24
24
  @port = port
25
- Lbspec::Util.add_string(@chain_str, " port #{port}")
25
+ @chain_str = Lbspec::Util.add_string(@chain_str, " port #{port}")
26
26
  end
27
27
 
28
28
  chain :tcp do
29
29
  @protocol = :tcp
30
- Lbspec::Util.add_string(@chain_str, ' tcp')
30
+ @chain_str = Lbspec::Util.add_string(@chain_str, ' tcp')
31
31
  end
32
32
 
33
33
  chain :udp do
34
34
  @protocol = :udp
35
- Lbspec::Util.add_string(@chain_str, ' udp')
35
+ @chain_str = Lbspec::Util.add_string(@chain_str, ' udp')
36
36
  end
37
37
 
38
38
  chain :http do
39
39
  @protocol = :tcp
40
40
  @application = :http
41
- Lbspec::Util.add_string(@chain_str, ' http')
41
+ @chain_str = Lbspec::Util.add_string(@chain_str, ' http')
42
42
  end
43
43
 
44
44
  chain :https do
45
45
  @protocol = :tcp
46
46
  @application = :https
47
- Lbspec::Util.add_string(@chain_str, ' https')
47
+ @chain_str = Lbspec::Util.add_string(@chain_str, ' https')
48
48
  end
49
49
 
50
50
  chain :from do |from|
51
51
  @from = from
52
- Lbspec::Util.add_string(@chain_str, " from #{from}")
52
+ @chain_str = Lbspec::Util.add_string(@chain_str, " from #{from}")
53
53
  end
54
54
 
55
55
  chain :include do |str|
56
56
  @include_str = str
57
- Lbspec::Util.add_string(@chain_str, " including #{str}")
57
+ @chain_str = Lbspec::Util.add_string(@chain_str, " including #{str}")
58
58
  end
59
59
 
60
60
  chain :path do |path|
61
61
  @path = path
62
- Lbspec::Util.add_string(@chain_str, " via #{path}")
62
+ @chain_str = Lbspec::Util.add_string(@chain_str, " via #{path}")
63
63
  end
64
64
 
65
65
  chain :options do |options|
data/lib/lbspec/util.rb CHANGED
@@ -27,7 +27,11 @@ module Lbspec
27
27
  def self.exec_command(command, node = nil)
28
28
  output = command + "\n"
29
29
  if node
30
- Net::SSH.start(node, nil, config: true) do |ssh|
30
+ # if there is no user for the node in .~/ssh/ssh_config
31
+ # use current user name for login
32
+ user = Net::SSH::Config.for(node)[:user]
33
+ user = `whoami`.chomp unless user
34
+ Net::SSH.start(node, user, config: true) do |ssh|
31
35
  output << ssh.exec!(command).to_s
32
36
  end
33
37
  else
@@ -1,5 +1,5 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
  # Lbspec is an RSpec plugin for easy Loadbalancer testing.
3
3
  module Lbspec
4
- VERSION = '0.2.3'
4
+ VERSION = '0.2.4'
5
5
  end
@@ -19,8 +19,7 @@ describe '#transfer' do
19
19
  ssh_connected.stub(:close)
20
20
  ssh_connected.stub(:exec!).and_return(true)
21
21
  Net::SSH.stub(:start).and_yield(ssh_connected).and_return(ssh_connected)
22
- Kernel.stub(:system).and_return true
23
- Kernel.stub(:`).and_return(key + include_str) # `
22
+ Lbspec::Util.stub(:`).and_return(key + include_str) # `
24
23
  end
25
24
 
26
25
  it 'should test transfer a node' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lbspec
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-04-04 00:00:00.000000000 Z
12
+ date: 2014-04-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -188,7 +188,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
188
188
  version: '0'
189
189
  segments:
190
190
  - 0
191
- hash: -1779935330635841208
191
+ hash: 3959163301746247762
192
192
  required_rubygems_version: !ruby/object:Gem::Requirement
193
193
  none: false
194
194
  requirements:
@@ -197,7 +197,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
197
197
  version: '0'
198
198
  segments:
199
199
  - 0
200
- hash: -1779935330635841208
200
+ hash: 3959163301746247762
201
201
  requirements: []
202
202
  rubyforge_project:
203
203
  rubygems_version: 1.8.21