rhc 1.13.6 → 1.14.7

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.
@@ -160,7 +160,7 @@ describe RHC::Commands::Domain do
160
160
  expect { run }.to exit_with_code(0)
161
161
  rest_client.domains[0].id.should == 'alterednamespace'
162
162
  end
163
- it { run_output.should match(/Changing namespace 'olddomain' to 'alterednamespace'.*success.*?Applications.*in their URL./m) }
163
+ it { run_output.should match(/Renaming domain 'olddomain' to 'alterednamespace'.*done.*?Applications in this domain will use the new name in their URL./m) }
164
164
  end
165
165
 
166
166
  context 'when there is no domain' do
@@ -182,7 +182,7 @@ describe RHC::Commands::Domain do
182
182
  expect { run }.to exit_with_code(0)
183
183
  rest_client.domains[0].id.should == 'alterednamespace'
184
184
  end
185
- it { run_output.should match(/Changing namespace 'olddomain' to 'alterednamespace'.*success.*?Applications.*in their URL./m) }
185
+ it { run_output.should match(/Renaming domain 'olddomain' to 'alterednamespace'.*done.*?Applications in this domain will use the new name in their URL./m) }
186
186
  end
187
187
  end
188
188
 
@@ -80,7 +80,7 @@ describe RHC::Commands::Snapshot do
80
80
  File.stub(:exists?).and_return(true)
81
81
  RHC::TarGz.stub(:contains).and_return(true)
82
82
  `(exit 0)`
83
- Kernel.should_receive(:`).with("cat #{@app.name}.tar.gz | ssh #{@ssh_uri.user}@#{@ssh_uri.host} 'restore INCLUDE_GIT'")
83
+ Kernel.should_receive(:`).with("cat '#{@app.name}.tar.gz' | ssh #{@ssh_uri.user}@#{@ssh_uri.host} 'restore INCLUDE_GIT'")
84
84
  end
85
85
  it { expect { run }.to exit_with_code(0) }
86
86
  end
@@ -89,7 +89,7 @@ describe RHC::Commands::Snapshot do
89
89
  before(:each) do
90
90
  File.stub(:exists?).and_return(true)
91
91
  RHC::TarGz.stub(:contains).and_return(true)
92
- Kernel.should_receive(:`).with("cat #{@app.name}.tar.gz | ssh #{@ssh_uri.user}@#{@ssh_uri.host} 'restore INCLUDE_GIT'")
92
+ Kernel.should_receive(:`).with("cat '#{@app.name}.tar.gz' | ssh #{@ssh_uri.user}@#{@ssh_uri.host} 'restore INCLUDE_GIT'")
93
93
  $?.stub(:exitstatus) { 1 }
94
94
  end
95
95
  it { expect { run }.to exit_with_code(130) }
@@ -434,11 +434,14 @@ describe AllRhcHelpers do
434
434
  it{ subject.send(:match_cart, cart, 'foo').should be_false }
435
435
  end
436
436
  context 'with simple strings' do
437
- let(:cart){ OpenStruct.new(:name => 'FOO-more_max any', :description => 'bar', :tags => [:baz]) }
437
+ let(:cart){ OpenStruct.new(:name => 'FOO-more_max any', :description => 'bar word', :tags => [:baz]) }
438
438
  it{ subject.send(:match_cart, cart, 'foo').should be_true }
439
439
  it{ subject.send(:match_cart, cart, 'fo').should be_true }
440
440
  it{ subject.send(:match_cart, cart, 'oo').should be_true }
441
441
  it{ subject.send(:match_cart, cart, 'bar').should be_true }
442
+ it{ subject.send(:match_cart, cart, 'word').should be_true }
443
+ it{ subject.send(:match_cart, cart, 'bar word').should be_true }
444
+ it{ subject.send(:match_cart, cart, 'wor').should be_false }
442
445
  it{ subject.send(:match_cart, cart, 'baz').should be_true }
443
446
  it{ subject.send(:match_cart, cart, 'more max').should be_true }
444
447
  it{ subject.send(:match_cart, cart, 'foo more max any').should be_true }
@@ -70,8 +70,8 @@ module RHC
70
70
  cart = app_obj.add_cartridge(:name => 'mock_cart_0')
71
71
  cart.should be_an_instance_of RHC::Rest::Cartridge
72
72
  cart.name.should == 'mock_cart_0'
73
- end
74
- end
73
+ end
74
+ end
75
75
 
76
76
  context "with a URL cart" do
77
77
  before{ stub_api_request(:any, app_links['ADD_CARTRIDGE']['relative'], false).with(:body => {:url => 'http://foo.com'}.to_json).to_return(mock_cartridge_response(1, true)) }
@@ -100,7 +100,7 @@ module RHC
100
100
  cart.display_name.should == 'mock_cart_0'
101
101
  cart.only_in_new?.should be_true
102
102
  cart.only_in_existing?.should be_false
103
- end
103
+ end
104
104
  end
105
105
  end
106
106
 
@@ -202,7 +202,7 @@ module RHC
202
202
  end
203
203
 
204
204
  context "#find_domain" do
205
- context "when server does not support SHOW_DOMAIN" do
205
+ context "when server does not support SHOW_DOMAIN" do
206
206
  before do
207
207
  stub_api_request(:any, api_links['LIST_DOMAINS']['relative']).
208
208
  to_return({ :body => {
@@ -237,7 +237,7 @@ module RHC
237
237
 
238
238
  context "when server supports SHOW_DOMAIN" do
239
239
  let(:api_links){ client_links.merge!(mock_response_links([['SHOW_DOMAIN', 'domains/:name', 'get']])) }
240
- before do
240
+ before do
241
241
  stub_api_request(:any, api_links['SHOW_DOMAIN']['relative'].gsub(/:name/, 'mock_domain_0')).
242
242
  to_return({ :body => {
243
243
  :type => 'domain',
@@ -257,11 +257,11 @@ module RHC
257
257
  }
258
258
  }.to_json,
259
259
  :status => 200
260
- })
260
+ })
261
261
  stub_api_request(:any, api_links['SHOW_DOMAIN']['relative'].gsub(/:name/, 'mock_domain_2')).
262
262
  to_return({ :body => {:messages => [{:exit_code => 127}]}.to_json,
263
263
  :status => 404
264
- })
264
+ })
265
265
  end
266
266
  it "returns a domain object for matching domain IDs" do
267
267
  match = nil
@@ -274,7 +274,7 @@ module RHC
274
274
  expect { match = client.find_domain('mock_domain_%^&') }.to_not raise_error
275
275
  match.id.should == 'mock_domain_%^&'
276
276
  match.class.should == RHC::Rest::Domain
277
- end
277
+ end
278
278
  it "raise an error when no matching domain IDs can be found" do
279
279
  expect { client.find_domain('mock_domain_2') }.to raise_error(RHC::Rest::DomainNotFoundException)
280
280
  end
@@ -283,11 +283,11 @@ module RHC
283
283
 
284
284
  context "when server supports LIST_DOMAINS_BY_OWNER" do
285
285
  let(:api_links){ client_links.merge!(mock_response_links([['LIST_DOMAINS_BY_OWNER', 'domains', 'get']])) }
286
- before do
286
+ before do
287
287
  stub_api_request(:any, "#{api_links['LIST_DOMAINS_BY_OWNER']['relative']}?owner=@self").
288
288
  to_return({ :body => {
289
289
  :type => 'domains',
290
- :data => [{
290
+ :data => [{
291
291
  :id => 'mock_domain_0',
292
292
  :links => mock_response_links(mock_domain_links('mock_domain_0')),
293
293
  }]
@@ -674,7 +674,7 @@ module RHC
674
674
  its(:user){ should == username.call }
675
675
  its(:passwd){ should == password.call }
676
676
  its(:to_str){ should == ["#{username.call}:#{password.call}"].pack('m').tr("\n", '') }
677
- end
677
+ end
678
678
  end
679
679
  end
680
680
  end
@@ -301,6 +301,7 @@ module RHC
301
301
  end
302
302
 
303
303
  it "copies all non-warning and non-info messages to the object" do
304
+ subject.stub(:debug?).and_return(false)
304
305
  subject.send(:parse_response, response).messages.should == ['Result field', 'Result severity']
305
306
  end
306
307
 
@@ -498,7 +499,7 @@ module RHC
498
499
  it{ response.should raise_error(RHC::Rest::ConnectionException, "An unexpected error occured: Generic Error") }
499
500
  end
500
501
 
501
- context "with a an unauthorized request" do
502
+ context "with an unauthorized request" do
502
503
  before do
503
504
  return_data = {
504
505
  :body => nil,
@@ -508,6 +509,13 @@ module RHC
508
509
  stub_request(:get, mock_href).to_return(return_data)
509
510
  end
510
511
  it("raises not authenticated"){ response.should raise_error(RHC::Rest::UnAuthorizedException, 'Not authenticated') }
512
+
513
+ context "when auth will retry forever" do
514
+ let(:auth){ stub('auth', :to_request => nil) }
515
+ before{ subject.stub(:auth).and_return(auth); auth.should_receive(:retry_auth?).exactly(4).times.and_return(true) }
516
+ it("raises not authenticated"){ response.should raise_error(RHC::Rest::UnAuthorizedException, 'Not authenticated') }
517
+ after{ WebMock.should have_requested(:get, mock_href).times(RHC::Rest::Client::MAX_RETRIES) }
518
+ end
511
519
  end
512
520
  end
513
521
 
@@ -63,8 +63,8 @@ describe RHC::Wizard do
63
63
  subject{ described_class.new(config, options) }
64
64
  let(:app) do
65
65
  app = Object.new
66
- app.should_receive(:host).at_least(1).and_return('foo.com')
67
- app.should_receive(:uuid).at_least(1).and_return('uuid')
66
+ app.should_receive(:ssh_url).at_least(1).and_return('ssh://uuid@foo.com')
67
+ app.stub(:host).and_return('foo.com')
68
68
  app
69
69
  end
70
70
  let(:ssh) do
@@ -82,7 +82,7 @@ describe RHC::Wizard do
82
82
  it "should attempt an SSH connection to the first app" do
83
83
  subject.should_receive(:ssh_key_uploaded?).and_return(true)
84
84
  subject.should_receive(:applications).and_return([app])
85
- Net::SSH.should_receive(:start).with(app.host, app.uuid, {:timeout => 60}).and_return(ssh)
85
+ Net::SSH.should_receive(:start).with("foo.com", "uuid", {:timeout => 60}).and_return(ssh)
86
86
  subject.send(:test_ssh_connectivity).should be_true
87
87
  end
88
88
  it "should handle a failed connection" do
@@ -523,7 +523,7 @@ describe RHC::Wizard do
523
523
 
524
524
  wizard.send(:upload_ssh_key_stage).should be_false
525
525
 
526
- last_output.should match("Your ssh public key at .* is invalid or unreadable\.")
526
+ last_output.should match("Your public SSH key at .* is invalid or unreadable\.")
527
527
  end
528
528
 
529
529
  it "should cause upload_ssh_key to catch NotImplementedError and return false" do
@@ -535,7 +535,7 @@ describe RHC::Wizard do
535
535
  wizard.send(:upload_ssh_key_stage).should be_false
536
536
 
537
537
  output = last_output
538
- output.should match("Your ssh public key at .* is invalid or unreadable\.")
538
+ output.should match("Your public SSH key at .* is invalid or unreadable\.")
539
539
  end
540
540
 
541
541
  it "should find a unique name" do
@@ -74,7 +74,7 @@ module WizardStepsHelper
74
74
 
75
75
  next_stage.should_not be_nil
76
76
 
77
- last_output.should match('You can upload your SSH key at a later time using ')
77
+ last_output.should match('You can upload your public SSH key at a later time using ')
78
78
  end
79
79
 
80
80
  def should_find_matching_server_key
@@ -158,7 +158,7 @@ module WizardStepsHelper
158
158
  next_stage.should_not be_nil
159
159
 
160
160
  last_output do |s|
161
- s.should match(/Checking your namespace .*none/)
161
+ s.should match(/Checking for a domain .*none/)
162
162
  s.should match(/(?:Too long.*?){2}/m)
163
163
  end
164
164
  subject.send(:options).__hash__[:namespace].should == 'testnamespace'
@@ -170,9 +170,9 @@ module WizardStepsHelper
170
170
  next_stage.should_not be_nil
171
171
 
172
172
  last_output do |s|
173
- s.should match(/Checking your namespace .*none/)
174
- s.should match("You will not be able to create applications without first creating a namespace")
175
- s.should match("You may create a namespace later through 'rhc create-domain'")
173
+ s.should match(/Checking for a domain .*none/)
174
+ s.should match("You will not be able to create an application without completing this step.")
175
+ s.should match("You may create a domain later through 'rhc create-domain'")
176
176
  end
177
177
  subject.send(:options).__hash__[:namespace].should be_nil
178
178
  end
@@ -180,7 +180,7 @@ module WizardStepsHelper
180
180
  def should_find_a_namespace(namespace)
181
181
  next_stage.should_not be_nil
182
182
 
183
- last_output.should match(/Checking your namespace .*#{namespace}/)
183
+ last_output.should match(/Checking for a domain .*#{namespace}/)
184
184
  subject.send(:options).__hash__[:namespace].should be_nil
185
185
  end
186
186
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rhc
3
3
  version: !ruby/object:Gem::Version
4
- hash: 47
4
+ hash: 33
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
- - 13
9
- - 6
10
- version: 1.13.6
8
+ - 14
9
+ - 7
10
+ version: 1.14.7
11
11
  platform: ruby
12
12
  authors:
13
13
  - Red Hat
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2013-08-27 00:00:00 Z
18
+ date: 2013-09-17 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: net-ssh
@@ -378,6 +378,7 @@ files:
378
378
  - features/lib/rhc_helper/sshkey.rb
379
379
  - features/lib/rhc_helper/loggable.rb
380
380
  - features/lib/rhc_helper/app.rb
381
+ - features/lib/rhc_helper/env.rb
381
382
  - features/lib/rhc_helper.rb
382
383
  - features/domain.feature
383
384
  - bin/rhc
@@ -501,5 +502,6 @@ test_files:
501
502
  - features/lib/rhc_helper/sshkey.rb
502
503
  - features/lib/rhc_helper/loggable.rb
503
504
  - features/lib/rhc_helper/app.rb
505
+ - features/lib/rhc_helper/env.rb
504
506
  - features/lib/rhc_helper.rb
505
507
  - features/domain.feature