cf 0.6.1.rc8 → 0.6.1.rc9

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.
@@ -379,23 +379,10 @@ module CF
379
379
  info = target_info(target)
380
380
  token = info[:token] && CFoundry::AuthToken.from_hash(info)
381
381
 
382
- @@client =
383
- case info[:version]
384
- when 2
385
- fail "User switching not implemented." if input[:proxy]
386
- CFoundry::V2::Client.new(target, token)
387
- when 1
388
- CFoundry::V1::Client.new(target, token)
389
- else
390
- CFoundry::Client.new(target, token)
391
- end
392
-
393
- unless @@client.is_a?(CFoundry::V2::Client)
394
- # TODO
395
- fail "V1 targets are no longer supported."
396
- end
382
+ fail "V1 targets are no longer supported." if info[:version] == 1
383
+ fail "User switching not implemented." if input[:proxy]
397
384
 
398
- @@client.proxy = input[:proxy]
385
+ @@client = CFoundry::V2::Client.new(target, token)
399
386
  @@client.trace = input[:trace]
400
387
 
401
388
  uri = URI.parse(target)
@@ -406,11 +393,11 @@ module CF
406
393
  save_target_info(info, target)
407
394
  end
408
395
 
409
- if org = info[:organization]
396
+ if (org = info[:organization])
410
397
  @@client.current_organization = @@client.organization(org)
411
398
  end
412
399
 
413
- if space = info[:space]
400
+ if (space = info[:space])
414
401
  @@client.current_space = @@client.space(space)
415
402
  end
416
403
 
@@ -94,21 +94,26 @@ module CF::App
94
94
  line "Checking #{c(app.name, :name)}..."
95
95
 
96
96
  seconds = 0
97
- while instances = app.instances
98
- indented { print_instances_summary(instances) }
99
97
 
100
- if all_instances_running?(instances)
101
- line "#{c("OK", :good)}"
102
- return
103
- end
98
+ begin
99
+ while instances = app.instances
100
+ indented { print_instances_summary(instances) }
104
101
 
105
- if any_instance_flapping?(instances) || seconds == APP_CHECK_LIMIT
106
- err "Application failed to start."
107
- return
108
- end
102
+ if all_instances_running?(instances)
103
+ line "#{c("OK", :good)}"
104
+ return
105
+ end
109
106
 
110
- sleep 1
111
- seconds += 1
107
+ if any_instance_flapping?(instances) || seconds == APP_CHECK_LIMIT
108
+ err "Application failed to start."
109
+ return
110
+ end
111
+
112
+ sleep 1
113
+ seconds += 1
114
+ end
115
+ rescue CFoundry::StagingError
116
+ err "Application failed to stage"
112
117
  end
113
118
  end
114
119
 
@@ -1,3 +1,3 @@
1
1
  module CF
2
- VERSION = "0.6.1.rc8".freeze
2
+ VERSION = "0.6.1.rc9".freeze
3
3
  end
@@ -84,6 +84,19 @@ describe CF::App::Start do
84
84
  end
85
85
  end
86
86
 
87
+ context "staging fails" do
88
+ before do
89
+ stub(app).instances { raise CFoundry::StagingError.new("Failed to stage", 170001, nil, nil) }
90
+ end
91
+
92
+ it "says the app failed to stage" do
93
+ subject
94
+ expect(output).to say("Checking #{app.name}...")
95
+ expect(error_output).to say("Application failed to stage")
96
+ expect(output).to_not say(/\d (running|down|flapping)/)
97
+ end
98
+ end
99
+
87
100
  context "when any instance becomes flapping" do
88
101
  let(:final_instances) do
89
102
  [ CFoundry::V2::App::Instance.new(nil, nil, nil, :state => "FLAPPING"),
@@ -68,7 +68,7 @@ describe CF::Start::Target do
68
68
 
69
69
  context "when the target is valid but the connection is refused" do
70
70
  it "shows a pretty error message" do
71
- any_instance_of(CFoundry::Client) do |cli|
71
+ any_instance_of(CFoundry::V2::Client) do |cli|
72
72
  stub(cli).info { raise CFoundry::TargetRefused, "foo" }
73
73
  end
74
74
 
@@ -79,7 +79,7 @@ describe CF::Start::Target do
79
79
 
80
80
  context "when the uri is malformed" do
81
81
  it "shows a pretty error message" do
82
- any_instance_of(CFoundry::Client) do |cli|
82
+ any_instance_of(CFoundry::V2::Client) do |cli|
83
83
  stub(cli).info { raise CFoundry::InvalidTarget.new(target) }
84
84
  end
85
85
 
@@ -405,19 +405,7 @@ describe CF::CLI do
405
405
  end
406
406
  end
407
407
 
408
- context "with a v1 cloud controller" do
409
- before do
410
- stub(context).target_info { { :version => 1 } }
411
- end
412
-
413
- it "fails" do
414
- expect {
415
- context.client
416
- }.to raise_error(CF::UserError, /no longer supported/)
417
- end
418
- end
419
-
420
- context "with a v2 cloud controller" do
408
+ context "with a cloud controller" do
421
409
  before do
422
410
  stub(context).target_info { { :version => 2} }
423
411
  end
@@ -6,6 +6,7 @@ if ENV['CF_V2_RUN_INTEGRATION']
6
6
  let(:target) { ENV['CF_V2_TEST_TARGET'] }
7
7
  let(:username) { ENV['CF_V2_TEST_USER'] }
8
8
  let(:password) { ENV['CF_V2_TEST_PASSWORD'] }
9
+ let(:organization) { ENV['CF_V2_TEST_ORGANIZATION'] }
9
10
 
10
11
  let(:second_username) { ENV['CF_V2_OTHER_TEST_USER'] }
11
12
  let(:second_organization) { ENV['CF_V2_OTHER_TEST_ORGANIZATION'] }
@@ -36,7 +37,7 @@ if ENV['CF_V2_RUN_INTEGRATION']
36
37
 
37
38
  expect(runner).to say(
38
39
  "Organization>" => proc {
39
- runner.send_keys "1"
40
+ runner.send_keys organization
40
41
  expect(runner).to say /Switching to organization .*\.\.\. OK/
41
42
  },
42
43
  "Switching to organization" => proc {}
@@ -10,10 +10,9 @@ if ENV['CF_V2_RUN_INTEGRATION']
10
10
  let(:password) { ENV['CF_V2_TEST_PASSWORD'] }
11
11
  let(:organization) { ENV['CF_V2_TEST_ORGANIZATION_TWO'] }
12
12
 
13
- let(:app) do
14
- fuzz = TRAVIS_BUILD_ID.to_s + Time.new.to_f.to_s.gsub(".", "_")
15
- "hello-sinatra-#{fuzz}"
16
- end
13
+ let(:run_id) { TRAVIS_BUILD_ID.to_s + Time.new.to_f.to_s.gsub(".", "_") }
14
+ let(:app) { "hello-sinatra-#{run_id}" }
15
+ let(:service_name) { "mysql-#{run_id}" }
17
16
 
18
17
  before do
19
18
  FileUtils.rm_rf File.expand_path(CF::CONFIG_DIR)
@@ -23,7 +22,8 @@ if ENV['CF_V2_RUN_INTEGRATION']
23
22
  end
24
23
 
25
24
  after do
26
- `#{cf_bin} delete #{app} -f -o --no-script`
25
+ `#{cf_bin} unbind-service -f --no-script #{service_name} #{app}`
26
+ `#{cf_bin} delete #{app} -f --routes --no-script`
27
27
  logout
28
28
  Interact::Progress::Dots.stop!
29
29
  end
@@ -67,23 +67,23 @@ if ENV['CF_V2_RUN_INTEGRATION']
67
67
  runner.send_keys "mysql"
68
68
 
69
69
  expect(runner).to say "Name?>"
70
- runner.send_keys ""
70
+ runner.send_keys service_name
71
71
 
72
72
  expect(runner).to say "Which plan?>"
73
73
  runner.send_keys "200"
74
74
 
75
- expect(runner).to say /Creating service .+ OK/
75
+ expect(runner).to say /Creating service #{service_name}.*OK/
76
76
  expect(runner).to say /Binding .+ to .+ OK/
77
77
 
78
78
  expect(runner).to say "Create another service?> n"
79
79
  runner.send_keys ""
80
80
 
81
81
  # skip this
82
- if runner.expect "Bind other services to application?> n", 1
82
+ if runner.expect "Bind other services to application?> n", 15
83
83
  runner.send_keys ""
84
84
  end
85
85
 
86
- expect(runner).to say "Save configuration?> n", 10
86
+ expect(runner).to say "Save configuration?> n", 20
87
87
  runner.send_keys ""
88
88
 
89
89
  expect(runner).to say "Uploading #{app}... OK", 180
@@ -105,14 +105,14 @@ if ENV['CF_V2_RUN_INTEGRATION']
105
105
  /x
106
106
  end
107
107
 
108
+ BlueShell::Runner.run("#{cf_bin} unbind-service #{service_name} #{app}") do |runner|
109
+ runner.wait_for_exit(20)
110
+ end
111
+
108
112
  BlueShell::Runner.run("#{cf_bin} delete #{app}") do |runner|
109
113
  expect(runner).to say "Really delete #{app}?>"
110
114
  runner.send_keys "y"
111
115
  expect(runner).to say "Deleting #{app}... OK"
112
-
113
- expect(runner).to say "Delete orphaned service"
114
- runner.send_keys "y"
115
- expect(runner).to say /Deleting .* OK/
116
116
  end
117
117
  end
118
118
  end
@@ -15,6 +15,8 @@ module FeaturesHelper
15
15
  end
16
16
 
17
17
  def set_target
18
- BlueShell::Runner.run("#{cf_bin} target #{target}")
18
+ BlueShell::Runner.run("#{cf_bin} target #{target}") do |runner|
19
+ runner.wait_for_exit(20)
20
+ end
19
21
  end
20
22
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cf
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.1.rc8
4
+ version: 0.6.1.rc9
5
5
  prerelease: 6
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-04-12 00:00:00.000000000 Z
13
+ date: 2013-04-17 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: json_pure
@@ -67,10 +67,10 @@ dependencies:
67
67
  requirements:
68
68
  - - ! '>='
69
69
  - !ruby/object:Gem::Version
70
- version: 0.6.1.rc3
70
+ version: 0.7.0.rc3
71
71
  - - <
72
72
  - !ruby/object:Gem::Version
73
- version: '0.7'
73
+ version: '0.8'
74
74
  type: :runtime
75
75
  prerelease: false
76
76
  version_requirements: !ruby/object:Gem::Requirement
@@ -78,10 +78,10 @@ dependencies:
78
78
  requirements:
79
79
  - - ! '>='
80
80
  - !ruby/object:Gem::Version
81
- version: 0.6.1.rc3
81
+ version: 0.7.0.rc3
82
82
  - - <
83
83
  - !ruby/object:Gem::Version
84
- version: '0.7'
84
+ version: '0.8'
85
85
  - !ruby/object:Gem::Dependency
86
86
  name: mothership
87
87
  requirement: !ruby/object:Gem::Requirement
@@ -377,7 +377,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
377
377
  version: '0'
378
378
  segments:
379
379
  - 0
380
- hash: -2077676923754035420
380
+ hash: 3627403370497925760
381
381
  required_rubygems_version: !ruby/object:Gem::Requirement
382
382
  none: false
383
383
  requirements: