cf 0.6.1.rc13 → 0.6.1.rc14
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.
- data/lib/cf/cli/organization/delete.rb +5 -1
- data/lib/cf/cli/space/delete.rb +6 -1
- data/lib/cf/version.rb +1 -1
- data/spec/cf/cli/organization/delete_spec.rb +9 -0
- data/spec/cf/cli/space/delete_spec.rb +13 -0
- data/spec/features/org_spec.rb +66 -0
- data/spec/features/push_flow_spec.rb +6 -6
- data/spec/features/space_spec.rb +30 -0
- data/spec/spec_helper.rb +7 -0
- data/spec/support/features_helper.rb +39 -0
- metadata +23 -5
|
@@ -21,7 +21,11 @@ module CF::Organization
|
|
|
21
21
|
|
|
22
22
|
begin
|
|
23
23
|
with_progress("Deleting organization #{c(org.name, :name)}") do
|
|
24
|
-
|
|
24
|
+
if input[:recursive]
|
|
25
|
+
org.delete!(:recursive => true)
|
|
26
|
+
else
|
|
27
|
+
org.delete!
|
|
28
|
+
end
|
|
25
29
|
end
|
|
26
30
|
rescue CFoundry::AssociationNotEmpty => boom
|
|
27
31
|
line
|
data/lib/cf/cli/space/delete.rb
CHANGED
|
@@ -28,12 +28,17 @@ module CF::Space
|
|
|
28
28
|
|
|
29
29
|
begin
|
|
30
30
|
with_progress("Deleting space #{c(space.name, :name)}") do
|
|
31
|
-
|
|
31
|
+
if input[:recursive]
|
|
32
|
+
space.delete!(:recursive => true)
|
|
33
|
+
else
|
|
34
|
+
space.delete!
|
|
35
|
+
end
|
|
32
36
|
end
|
|
33
37
|
rescue CFoundry::APIError => boom
|
|
34
38
|
line
|
|
35
39
|
line c(boom.description, :bad)
|
|
36
40
|
line c("If you want to delete the space along with all dependent objects, rerun the command with the #{b("'--recursive'")} flag.", :bad)
|
|
41
|
+
exit_status(1)
|
|
37
42
|
end
|
|
38
43
|
end
|
|
39
44
|
|
data/lib/cf/version.rb
CHANGED
|
@@ -76,5 +76,14 @@ describe CF::Organization::Delete do
|
|
|
76
76
|
expect(output).to say "If you want to delete the organization along with all dependent objects, rerun the command with the '--recursive' flag."
|
|
77
77
|
end
|
|
78
78
|
end
|
|
79
|
+
|
|
80
|
+
context "when deleting with --recursive" do
|
|
81
|
+
subject { cf %W[delete-org MyOrg --recursive --force] }
|
|
82
|
+
|
|
83
|
+
it "sends recursive true in its delete request" do
|
|
84
|
+
mock(organization).delete!(:recursive => true)
|
|
85
|
+
subject
|
|
86
|
+
end
|
|
87
|
+
end
|
|
79
88
|
end
|
|
80
89
|
end
|
|
@@ -86,6 +86,19 @@ describe CF::Space::Delete do
|
|
|
86
86
|
it "informs the user of how to recursively delete" do
|
|
87
87
|
expect(output).to say "If you want to delete the space along with all dependent objects, rerun the command with the '--recursive' flag."
|
|
88
88
|
end
|
|
89
|
+
|
|
90
|
+
it "returns a non-zero exit code" do
|
|
91
|
+
@status.should_not == 0
|
|
92
|
+
end
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
context "when deleting with --recursive" do
|
|
96
|
+
subject { cf %W[delete-space some_space_name --recursive --force] }
|
|
97
|
+
|
|
98
|
+
it "sends recursive true in its delete request" do
|
|
99
|
+
mock(space).delete!(:recursive => true)
|
|
100
|
+
subject
|
|
101
|
+
end
|
|
89
102
|
end
|
|
90
103
|
end
|
|
91
104
|
end
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
if ENV['CF_V2_RUN_INTEGRATION']
|
|
5
|
+
describe "creating and deleting orgs", :ruby19 => true do
|
|
6
|
+
before(:all) do
|
|
7
|
+
WebMock.allow_net_connect!
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
after(:all) do
|
|
11
|
+
WebMock.disable_net_connect!
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
let(:target) { ENV['CF_V2_TEST_TARGET'] }
|
|
15
|
+
let(:organization) { ENV['CF_V2_TEST_ORGANIZATION'] }
|
|
16
|
+
let(:space) { ENV['CF_V2_TEST_SPACE'] }
|
|
17
|
+
let(:admin_username) { ENV['CF_V2_ADMIN_USERNAME'] }
|
|
18
|
+
let(:admin_password) { ENV['CF_V2_ADMIN_PW'] }
|
|
19
|
+
|
|
20
|
+
let(:run_id) { TRAVIS_BUILD_ID.to_s + Time.new.to_f.to_s.gsub(".", "_") }
|
|
21
|
+
let(:new_org_name) { "new-org-#{run_id}" }
|
|
22
|
+
|
|
23
|
+
let(:client) do
|
|
24
|
+
client = CFoundry::V2::Client.new("https://#{target}")
|
|
25
|
+
client.login(admin_username, admin_password)
|
|
26
|
+
client
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
before do
|
|
30
|
+
Interact::Progress::Dots.start!
|
|
31
|
+
"cf login #{admin_username} --password #{admin_password} -o #{organization} -s #{space}"
|
|
32
|
+
BlueShell::Runner.run("cf login #{admin_username} --password #{admin_password} -o #{organization} -s #{space}") do |runner|
|
|
33
|
+
runner.wait_for_exit(60)
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
after do
|
|
38
|
+
logout
|
|
39
|
+
Interact::Progress::Dots.stop!
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
it "can create and recursively delete an org" do
|
|
43
|
+
BlueShell::Runner.run("cf create-org #{new_org_name}") do |runner|
|
|
44
|
+
runner.should say "Creating organization #{new_org_name}... OK"
|
|
45
|
+
runner.should say "Switching to organization #{new_org_name}... OK"
|
|
46
|
+
runner.should say "There are no spaces. You may want to create one with create-space."
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
BlueShell::Runner.run("cf create-space new-space") do |runner|
|
|
50
|
+
runner.should say "Creating space new-space... OK"
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
BlueShell::Runner.run("cf delete-org #{new_org_name} --force") do |runner|
|
|
54
|
+
runner.should say "If you want to delete the organization along with all dependent objects, rerun the command with the '--recursive' flag."
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
BlueShell::Runner.run("cf delete-org #{new_org_name} --force --recursive") do |runner|
|
|
58
|
+
runner.should say("Deleting organization #{new_org_name}... OK")
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
BlueShell::Runner.run("cf orgs") do |runner|
|
|
62
|
+
runner.should_not say("#{new_org_name}")
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
end
|
|
@@ -39,10 +39,10 @@ if ENV['CF_V2_RUN_INTEGRATION']
|
|
|
39
39
|
runner.send_keys app
|
|
40
40
|
|
|
41
41
|
expect(runner).to say "Instances> 1"
|
|
42
|
-
runner.
|
|
42
|
+
runner.send_return
|
|
43
43
|
|
|
44
44
|
expect(runner).to say "Custom startup command> "
|
|
45
|
-
runner.
|
|
45
|
+
runner.send_return
|
|
46
46
|
|
|
47
47
|
expect(runner).to say "Memory Limit>"
|
|
48
48
|
runner.send_keys "128M"
|
|
@@ -50,7 +50,7 @@ if ENV['CF_V2_RUN_INTEGRATION']
|
|
|
50
50
|
expect(runner).to say "Creating #{app}... OK"
|
|
51
51
|
|
|
52
52
|
expect(runner).to say "Subdomain> #{app}"
|
|
53
|
-
runner.
|
|
53
|
+
runner.send_return
|
|
54
54
|
|
|
55
55
|
expect(runner).to say "1:"
|
|
56
56
|
expect(runner).to say "Domain>"
|
|
@@ -76,15 +76,15 @@ if ENV['CF_V2_RUN_INTEGRATION']
|
|
|
76
76
|
expect(runner).to say /Binding .+ to .+ OK/
|
|
77
77
|
|
|
78
78
|
expect(runner).to say "Create another service?> n"
|
|
79
|
-
runner.
|
|
79
|
+
runner.send_return
|
|
80
80
|
|
|
81
81
|
# skip this
|
|
82
82
|
if runner.expect "Bind other services to application?> n", 15
|
|
83
|
-
runner.
|
|
83
|
+
runner.send_return
|
|
84
84
|
end
|
|
85
85
|
|
|
86
86
|
expect(runner).to say "Save configuration?> n", 20
|
|
87
|
-
runner.
|
|
87
|
+
runner.send_return
|
|
88
88
|
|
|
89
89
|
expect(runner).to say "Uploading #{app}... OK", 180
|
|
90
90
|
expect(runner).to say "Starting #{app}... OK", 180
|
data/spec/features/space_spec.rb
CHANGED
|
@@ -69,5 +69,35 @@ if ENV['CF_V2_RUN_INTEGRATION']
|
|
|
69
69
|
expect(runner).to say(space)
|
|
70
70
|
end
|
|
71
71
|
end
|
|
72
|
+
|
|
73
|
+
let(:run_id) { TRAVIS_BUILD_ID.to_s + Time.new.to_f.to_s.gsub(".", "_") }
|
|
74
|
+
let(:app) { "hello-sinatra-recursive-#{run_id}" }
|
|
75
|
+
|
|
76
|
+
it "can create an app in a space, then delete it recursively" do
|
|
77
|
+
new_space = "test-space-#{rand(10000)}"
|
|
78
|
+
BlueShell::Runner.run("#{cf_bin} create-space #{new_space}") { |runner| runner.wait_for_exit(30) }
|
|
79
|
+
BlueShell::Runner.run("#{cf_bin} switch-space #{new_space}") { |runner| runner.wait_for_exit(30) }
|
|
80
|
+
|
|
81
|
+
push_app("hello-sinatra", app)
|
|
82
|
+
|
|
83
|
+
BlueShell::Runner.run("#{cf_bin} delete-space #{new_space} --force") do |runner|
|
|
84
|
+
expect(runner).to say("If you want to delete the space along with all dependent objects, rerun the command with the '--recursive' flag.")
|
|
85
|
+
runner.wait_for_exit(30)
|
|
86
|
+
end.should_not be_successful
|
|
87
|
+
|
|
88
|
+
BlueShell::Runner.run("#{cf_bin} spaces") do |runner|
|
|
89
|
+
expect(runner).to say(new_space)
|
|
90
|
+
expect(runner).to say(app)
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
BlueShell::Runner.run("#{cf_bin} delete-space #{new_space} --recursive --force") do |runner|
|
|
94
|
+
expect(runner).to say("Deleting space #{new_space}... OK")
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
BlueShell::Runner.run("#{cf_bin} spaces") do |runner|
|
|
98
|
+
expect(runner).to_not say(new_space)
|
|
99
|
+
expect(runner).to_not say(app)
|
|
100
|
+
end
|
|
101
|
+
end
|
|
72
102
|
end
|
|
73
103
|
end
|
data/spec/spec_helper.rb
CHANGED
|
@@ -57,6 +57,13 @@ RSpec.configure do |c|
|
|
|
57
57
|
c.before do
|
|
58
58
|
CF::CLI.send(:class_variable_set, :@@client, nil)
|
|
59
59
|
end
|
|
60
|
+
|
|
61
|
+
c.after do
|
|
62
|
+
if example.exception != nil && example.exception.message.include?("~/.cf/crash")
|
|
63
|
+
puts '~/.cf/crash output for failed spec:'
|
|
64
|
+
puts `cat ~/.cf/crash`
|
|
65
|
+
end
|
|
66
|
+
end
|
|
60
67
|
end
|
|
61
68
|
|
|
62
69
|
def name_list(xs)
|
|
@@ -21,4 +21,43 @@ module FeaturesHelper
|
|
|
21
21
|
runner.wait_for_exit(20)
|
|
22
22
|
end
|
|
23
23
|
end
|
|
24
|
+
|
|
25
|
+
def push_app(app_folder, deployed_app_name)
|
|
26
|
+
Dir.chdir("#{SPEC_ROOT}/assets/#{app_folder}") do
|
|
27
|
+
BlueShell::Runner.run("#{cf_bin} push --no-manifest") do |runner|
|
|
28
|
+
expect(runner).to say "Name>"
|
|
29
|
+
runner.send_keys deployed_app_name
|
|
30
|
+
|
|
31
|
+
expect(runner).to say "Instances> 1", 15
|
|
32
|
+
runner.send_return
|
|
33
|
+
|
|
34
|
+
expect(runner).to say "Custom startup command> "
|
|
35
|
+
runner.send_return
|
|
36
|
+
|
|
37
|
+
expect(runner).to say "Memory Limit>"
|
|
38
|
+
runner.send_keys "128M"
|
|
39
|
+
|
|
40
|
+
expect(runner).to say "Creating #{deployed_app_name}... OK"
|
|
41
|
+
|
|
42
|
+
expect(runner).to say "Subdomain> #{deployed_app_name}"
|
|
43
|
+
runner.send_return
|
|
44
|
+
|
|
45
|
+
expect(runner).to say "1:"
|
|
46
|
+
expect(runner).to say "Domain>"
|
|
47
|
+
runner.send_keys "1"
|
|
48
|
+
|
|
49
|
+
expect(runner).to say(/Creating route #{deployed_app_name}\..*\.\.\. OK/)
|
|
50
|
+
expect(runner).to say(/Binding #{deployed_app_name}\..* to #{deployed_app_name}\.\.\. OK/)
|
|
51
|
+
|
|
52
|
+
expect(runner).to say "Create services for application?> n"
|
|
53
|
+
runner.send_return
|
|
54
|
+
|
|
55
|
+
if runner.expect "Bind other services to application?> n", 15
|
|
56
|
+
runner.send_return
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
runner.wait_for_exit
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
end
|
|
24
63
|
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.
|
|
4
|
+
version: 0.6.1.rc14
|
|
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-
|
|
13
|
+
date: 2013-04-23 00:00:00.000000000 Z
|
|
14
14
|
dependencies:
|
|
15
15
|
- !ruby/object:Gem::Dependency
|
|
16
16
|
name: addressable
|
|
@@ -51,7 +51,7 @@ dependencies:
|
|
|
51
51
|
requirements:
|
|
52
52
|
- - ! '>='
|
|
53
53
|
- !ruby/object:Gem::Version
|
|
54
|
-
version: 0.7.0.
|
|
54
|
+
version: 0.7.0.rc8
|
|
55
55
|
- - <
|
|
56
56
|
- !ruby/object:Gem::Version
|
|
57
57
|
version: '0.8'
|
|
@@ -62,7 +62,7 @@ dependencies:
|
|
|
62
62
|
requirements:
|
|
63
63
|
- - ! '>='
|
|
64
64
|
- !ruby/object:Gem::Version
|
|
65
|
-
version: 0.7.0.
|
|
65
|
+
version: 0.7.0.rc8
|
|
66
66
|
- - <
|
|
67
67
|
- !ruby/object:Gem::Version
|
|
68
68
|
version: '0.8'
|
|
@@ -280,6 +280,22 @@ dependencies:
|
|
|
280
280
|
- - ~>
|
|
281
281
|
- !ruby/object:Gem::Version
|
|
282
282
|
version: '1.9'
|
|
283
|
+
- !ruby/object:Gem::Dependency
|
|
284
|
+
name: rspec-instafail
|
|
285
|
+
requirement: !ruby/object:Gem::Requirement
|
|
286
|
+
none: false
|
|
287
|
+
requirements:
|
|
288
|
+
- - ~>
|
|
289
|
+
- !ruby/object:Gem::Version
|
|
290
|
+
version: 0.2.4
|
|
291
|
+
type: :development
|
|
292
|
+
prerelease: false
|
|
293
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
294
|
+
none: false
|
|
295
|
+
requirements:
|
|
296
|
+
- - ~>
|
|
297
|
+
- !ruby/object:Gem::Version
|
|
298
|
+
version: 0.2.4
|
|
283
299
|
description:
|
|
284
300
|
email:
|
|
285
301
|
- vcap-dev@googlegroups.com
|
|
@@ -482,6 +498,7 @@ files:
|
|
|
482
498
|
- spec/features/account_lifecycle_spec.rb
|
|
483
499
|
- spec/features/create_user_spec.rb
|
|
484
500
|
- spec/features/login_spec.rb
|
|
501
|
+
- spec/features/org_spec.rb
|
|
485
502
|
- spec/features/push_flow_spec.rb
|
|
486
503
|
- spec/features/space_spec.rb
|
|
487
504
|
- spec/features/switching_targets_spec.rb
|
|
@@ -514,7 +531,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
514
531
|
version: '0'
|
|
515
532
|
segments:
|
|
516
533
|
- 0
|
|
517
|
-
hash:
|
|
534
|
+
hash: 255382247514781003
|
|
518
535
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
519
536
|
none: false
|
|
520
537
|
requirements:
|
|
@@ -625,6 +642,7 @@ test_files:
|
|
|
625
642
|
- spec/features/account_lifecycle_spec.rb
|
|
626
643
|
- spec/features/create_user_spec.rb
|
|
627
644
|
- spec/features/login_spec.rb
|
|
645
|
+
- spec/features/org_spec.rb
|
|
628
646
|
- spec/features/push_flow_spec.rb
|
|
629
647
|
- spec/features/space_spec.rb
|
|
630
648
|
- spec/features/switching_targets_spec.rb
|