cf 1.1.3.rc1 → 1.1.4
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.rb +2 -7
- data/lib/cf/cli/organization/delete.rb +4 -6
- data/lib/cf/cli/service/create.rb +23 -17
- data/lib/cf/cli/space/create.rb +43 -41
- data/lib/cf/cli/space/space.rb +49 -46
- data/lib/cf/version.rb +1 -1
- data/lib/console/console.rb +1 -1
- data/spec/cf/cli/app/delete_spec.rb +16 -28
- data/spec/cf/cli/app/instances_spec.rb +4 -5
- data/spec/cf/cli/app/push/create_spec.rb +362 -373
- data/spec/cf/cli/app/push_spec.rb +216 -215
- data/spec/cf/cli/app/rename_spec.rb +28 -31
- data/spec/cf/cli/app/scale_spec.rb +44 -41
- data/spec/cf/cli/app/start_spec.rb +194 -193
- data/spec/cf/cli/app/stats_spec.rb +55 -56
- data/spec/cf/cli/domain/map_spec.rb +105 -102
- data/spec/cf/cli/domain/unmap_spec.rb +60 -56
- data/spec/cf/cli/organization/delete_spec.rb +85 -84
- data/spec/cf/cli/organization/orgs_spec.rb +80 -83
- data/spec/cf/cli/organization/rename_spec.rb +90 -89
- data/spec/cf/cli/populators/organization_spec.rb +117 -119
- data/spec/cf/cli/populators/space_spec.rb +107 -108
- data/spec/cf/cli/populators/target_spec.rb +17 -12
- data/spec/cf/cli/route/delete_spec.rb +4 -4
- data/spec/cf/cli/route/map_spec.rb +106 -102
- data/spec/cf/cli/route/unmap_spec.rb +5 -5
- data/spec/cf/cli/service/create_spec.rb +74 -46
- data/spec/cf/cli/service/rename_spec.rb +29 -33
- data/spec/cf/cli/service/services_spec.rb +48 -48
- data/spec/cf/cli/space/base_spec.rb +39 -32
- data/spec/cf/cli/space/create_spec.rb +52 -53
- data/spec/cf/cli/space/delete_spec.rb +84 -85
- data/spec/cf/cli/space/rename_spec.rb +93 -94
- data/spec/cf/cli/space/space_spec.rb +60 -60
- data/spec/cf/cli/space/spaces_spec.rb +75 -80
- data/spec/cf/cli/space/switch_space_spec.rb +45 -48
- data/spec/cf/cli/start/info_spec.rb +4 -6
- data/spec/cf/cli/start/login_spec.rb +18 -20
- data/spec/cf/cli/start/logout_spec.rb +36 -37
- data/spec/cf/cli/start/target_spec.rb +86 -89
- data/spec/cf/cli/user/create_spec.rb +83 -84
- data/spec/cf/cli/user/passwd_spec.rb +87 -86
- data/spec/cf/cli/user/register_spec.rb +109 -108
- data/spec/cf/cli_spec.rb +305 -310
- data/spec/console/console_spec.rb +58 -58
- data/spec/factories/cfoundry/v2/domain_factory.rb +8 -0
- data/spec/factories/cfoundry/v2/route_factory.rb +8 -0
- data/spec/factories/cfoundry/v2/user_factory.rb +7 -0
- data/spec/features/org_spec.rb +11 -11
- data/spec/manifests/manifests_spec.rb +21 -21
- data/spec/manifests/plugin_spec.rb +34 -34
- data/spec/spec_helper.rb +1 -2
- data/spec/support/cli_helper.rb +5 -14
- data/spec/support/factory_girl.rb +6 -0
- data/spec/support/interact_helper.rb +5 -15
- data/spec/support/shared_examples/errors.rb +1 -1
- data/spec/tunnel/plugin_spec.rb +2 -2
- data/spec/tunnel/tunnel_spec.rb +5 -5
- metadata +36 -28
@@ -1,68 +1,67 @@
|
|
1
|
-
require
|
2
|
-
require 'stringio'
|
1
|
+
require "spec_helper"
|
3
2
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
3
|
+
module CF
|
4
|
+
module App
|
5
|
+
describe Stats do
|
6
|
+
let(:global) { {:color => false} }
|
7
|
+
let(:inputs) { {:app => apps[0]} }
|
8
|
+
let(:given) { {} }
|
9
|
+
let(:client) { fake_client(:apps => apps) }
|
10
|
+
let(:apps) { [fake(:app, :name => "basic_app")] }
|
10
11
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
:mem => 31395840,
|
32
|
-
:disk => 15638528
|
12
|
+
before do
|
13
|
+
inputs[:app].stub(:stats) do
|
14
|
+
{"0" => {
|
15
|
+
:state => "RUNNING",
|
16
|
+
:stats => {
|
17
|
+
:name => "basic_app",
|
18
|
+
:uris => ["basic_app.p01.rbconsvcs.com"],
|
19
|
+
:host => "172.20.183.93",
|
20
|
+
:port => 61006,
|
21
|
+
:uptime => 3250,
|
22
|
+
:mem_quota => 301989888,
|
23
|
+
:disk_quota => 268435456,
|
24
|
+
:fds_quota => 256,
|
25
|
+
:usage => {
|
26
|
+
:time => "2013-01-04 19:53:39 +0000",
|
27
|
+
:cpu => 0.0019777013519415455,
|
28
|
+
:mem => 31395840,
|
29
|
+
:disk => 15638528
|
30
|
+
}
|
31
|
+
}
|
33
32
|
}
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
end
|
38
|
-
end
|
33
|
+
}
|
34
|
+
end
|
35
|
+
end
|
39
36
|
|
40
|
-
|
41
|
-
|
42
|
-
|
37
|
+
subject do
|
38
|
+
capture_output { Mothership.new.invoke(:stats, inputs, given, global) }
|
39
|
+
end
|
43
40
|
|
44
|
-
|
45
|
-
|
41
|
+
describe 'metadata' do
|
42
|
+
let(:command) { Mothership.commands[:stats] }
|
46
43
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
44
|
+
describe 'command' do
|
45
|
+
subject { command }
|
46
|
+
its(:description) { should eq "Display application instance status" }
|
47
|
+
it { expect(Mothership::Help.group(:apps, :info)).to include(subject) }
|
48
|
+
end
|
52
49
|
|
53
|
-
|
50
|
+
include_examples 'inputs must have descriptions'
|
54
51
|
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
52
|
+
describe 'arguments' do
|
53
|
+
subject { command.arguments }
|
54
|
+
it 'has no arguments' do
|
55
|
+
should eq([:name => :app, :type => :optional, :value => nil])
|
56
|
+
end
|
57
|
+
end
|
59
58
|
end
|
60
|
-
end
|
61
|
-
end
|
62
59
|
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
60
|
+
it 'prints out the stats' do
|
61
|
+
subject
|
62
|
+
stdout.rewind
|
63
|
+
expect(stdout.readlines.last).to match /.*0\s+0\.0%\s+29\.9M of 288M\s+14\.9M of 256M.*/
|
64
|
+
end
|
65
|
+
end
|
67
66
|
end
|
68
67
|
end
|
@@ -1,134 +1,137 @@
|
|
1
|
-
require
|
1
|
+
require "spec_helper"
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
3
|
+
module CF
|
4
|
+
module Domain
|
5
|
+
describe Map do
|
6
|
+
before do
|
7
|
+
stub_client_and_precondition
|
8
|
+
end
|
7
9
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
10
|
+
let(:client) do
|
11
|
+
fake_client(
|
12
|
+
:current_organization => organization,
|
13
|
+
:current_space => space,
|
14
|
+
:spaces => [space],
|
15
|
+
:organizations => [organization],
|
16
|
+
:domains => domains)
|
17
|
+
end
|
16
18
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
shared_examples_for "binding a domain to a space" do
|
24
|
-
it "adds the domain to the space's organization" do
|
25
|
-
mock(space.organization).add_domain(domain)
|
26
|
-
stub(space).add_domain(domain)
|
27
|
-
subject
|
28
|
-
end
|
19
|
+
let(:organization) { fake(:organization) }
|
20
|
+
let(:space) { fake(:space, :organization => organization) }
|
21
|
+
let(:domain) { fake(:domain, :name => domain_name) }
|
22
|
+
let(:domain_name) { "some.domain.com" }
|
23
|
+
let(:domains) { [domain] }
|
29
24
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
25
|
+
shared_examples_for "binding a domain to a space" do
|
26
|
+
it "adds the domain to the space's organization" do
|
27
|
+
space.organization.should_receive(:add_domain).with(domain)
|
28
|
+
space.stub(:add_domain)
|
29
|
+
subject
|
30
|
+
end
|
36
31
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
32
|
+
it "adds the domain to the space" do
|
33
|
+
space.organization.stub(:add_domain)
|
34
|
+
space.should_receive(:add_domain).with(domain)
|
35
|
+
subject
|
36
|
+
end
|
41
37
|
end
|
42
|
-
end
|
43
|
-
|
44
|
-
it 'adds the domain to the organization' do
|
45
|
-
mock(organization).add_domain(domain)
|
46
|
-
subject
|
47
|
-
end
|
48
|
-
end
|
49
38
|
|
50
|
-
|
51
|
-
|
52
|
-
|
39
|
+
shared_examples_for "binding a domain to an organization" do
|
40
|
+
it "does NOT add the domain to a space" do
|
41
|
+
space.class.any_instance.should_not_receive(:add_domain).with(domain)
|
42
|
+
end
|
53
43
|
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
stub(space).add_domain(domain)
|
44
|
+
it "adds the domain to the organization" do
|
45
|
+
organization.should_receive(:add_domain).with(domain)
|
46
|
+
subject
|
47
|
+
end
|
59
48
|
end
|
60
49
|
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
expect(domain.name).to eq domain_name
|
65
|
-
expect(domain.owning_organization).to eq organization
|
66
|
-
end
|
50
|
+
shared_examples_for "mapping a domain to a space" do
|
51
|
+
context "when the domain does NOT exist" do
|
52
|
+
let(:domains) { [] }
|
67
53
|
|
68
|
-
|
69
|
-
|
54
|
+
before do
|
55
|
+
client.stub(:domain) { domain }
|
56
|
+
domain.stub(:create!)
|
57
|
+
end
|
70
58
|
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
end
|
59
|
+
it "creates the domain" do
|
60
|
+
space.organization.stub(:add_domain)
|
61
|
+
space.should_receive(:add_domain).with(domain)
|
75
62
|
|
76
|
-
|
77
|
-
|
63
|
+
domain.should_receive(:create!)
|
64
|
+
subject
|
65
|
+
expect(domain.name).to eq domain_name
|
66
|
+
expect(domain.owning_organization).to eq organization
|
67
|
+
end
|
78
68
|
|
79
|
-
|
80
|
-
|
69
|
+
include_examples "binding a domain to a space"
|
70
|
+
end
|
81
71
|
|
82
|
-
|
83
|
-
|
72
|
+
context "when the domain already exists" do
|
73
|
+
include_examples "binding a domain to a space"
|
74
|
+
end
|
75
|
+
end
|
84
76
|
|
85
|
-
|
86
|
-
|
77
|
+
context "when a domain and a space are passed" do
|
78
|
+
subject { cf %W[map-domain #{domain.name} --space #{space.name}] }
|
87
79
|
|
88
|
-
|
89
|
-
stub(client).domain { domain }
|
90
|
-
stub(domain).create!
|
91
|
-
stub(organization).add_domain(domain)
|
80
|
+
include_examples "mapping a domain to a space"
|
92
81
|
end
|
93
82
|
|
94
|
-
|
83
|
+
context "when a domain and an organization are passed" do
|
84
|
+
subject { cf %W[map-domain #{domain.name} --organization #{organization.name}] }
|
95
85
|
|
96
|
-
|
97
|
-
|
98
|
-
subject
|
99
|
-
expect(domain.name).to eq domain_name
|
100
|
-
end
|
86
|
+
context "and the domain does NOT exist" do
|
87
|
+
let(:domains) { [] }
|
101
88
|
|
102
|
-
|
103
|
-
|
89
|
+
before do
|
90
|
+
client.stub(:domain) { domain }
|
91
|
+
domain.stub(:create!)
|
92
|
+
organization.stub(:add_domain)
|
93
|
+
end
|
104
94
|
|
105
|
-
|
106
|
-
|
107
|
-
|
95
|
+
include_examples "binding a domain to an organization"
|
96
|
+
|
97
|
+
it "creates the domain" do
|
98
|
+
domain.should_receive(:create!)
|
99
|
+
subject
|
100
|
+
expect(domain.name).to eq domain_name
|
101
|
+
end
|
102
|
+
|
103
|
+
context "and the --shared option is passed" do
|
104
|
+
subject { cf %W[map-domain #{domain.name} --organization #{organization.name} --shared] }
|
105
|
+
|
106
|
+
it "adds the domain to the organization" do
|
107
|
+
organization.should_receive(:add_domain).with(domain)
|
108
|
+
subject
|
109
|
+
end
|
110
|
+
|
111
|
+
it "does not add the domain to a specific organization" do
|
112
|
+
domain.stub(:create!)
|
113
|
+
subject
|
114
|
+
expect(domain.owning_organization).to be_nil
|
115
|
+
end
|
116
|
+
end
|
108
117
|
end
|
109
118
|
|
110
|
-
|
111
|
-
|
112
|
-
subject
|
113
|
-
expect(domain.owning_organization).to be_nil
|
119
|
+
context "and the domain already exists" do
|
120
|
+
include_examples "binding a domain to an organization"
|
114
121
|
end
|
115
122
|
end
|
116
|
-
end
|
117
123
|
|
118
|
-
|
119
|
-
|
120
|
-
end
|
121
|
-
end
|
124
|
+
context "when a domain, organization, and space is passed" do
|
125
|
+
subject { cf %W[map-domain #{domain.name} --space #{space.name} --organization #{organization.name}] }
|
122
126
|
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
include_examples "mapping a domain to a space"
|
127
|
-
end
|
127
|
+
include_examples "mapping a domain to a space"
|
128
|
+
end
|
128
129
|
|
129
|
-
|
130
|
-
|
130
|
+
context "when only a domain is passed" do
|
131
|
+
subject { cf %W[map-domain #{domain.name}] }
|
131
132
|
|
132
|
-
|
133
|
+
include_examples "mapping a domain to a space"
|
134
|
+
end
|
135
|
+
end
|
133
136
|
end
|
134
137
|
end
|
@@ -1,73 +1,77 @@
|
|
1
|
-
require
|
1
|
+
require "spec_helper"
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
3
|
+
module CF
|
4
|
+
module Domain
|
5
|
+
describe Unmap do
|
6
|
+
before do
|
7
|
+
stub_client_and_precondition
|
8
|
+
end
|
7
9
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
10
|
+
let(:client) do
|
11
|
+
fake_client(
|
12
|
+
:current_organization => organization,
|
13
|
+
:current_space => space,
|
14
|
+
:spaces => [space],
|
15
|
+
:organizations => [organization],
|
16
|
+
:domains => [domain])
|
17
|
+
end
|
16
18
|
|
17
|
-
|
18
|
-
|
19
|
-
|
19
|
+
let(:organization) { fake(:organization, :spaces => [space]) }
|
20
|
+
let(:space) { fake(:space) }
|
21
|
+
let(:domain) { fake(:domain, :name => "some.domain.com") }
|
20
22
|
|
21
|
-
|
22
|
-
|
23
|
+
context "when the --delete flag is given" do
|
24
|
+
subject { cf %W[unmap-domain #{domain.name} --delete] }
|
23
25
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
26
|
+
it "asks for a confirmation" do
|
27
|
+
mock_ask("Really delete #{domain.name}?", :default => false) { false }
|
28
|
+
domain.stub(:delete!)
|
29
|
+
subject
|
30
|
+
end
|
29
31
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
32
|
+
context "and the user answers 'no' to the confirmation" do
|
33
|
+
it "does NOT delete the domain" do
|
34
|
+
stub_ask("Really delete #{domain.name}?", anything) { false }
|
35
|
+
domain.should_not_receive(:delete!)
|
36
|
+
subject
|
37
|
+
end
|
38
|
+
end
|
37
39
|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
40
|
+
context "and the user answers 'yes' to the confirmation" do
|
41
|
+
it "deletes the domain" do
|
42
|
+
stub_ask("Really delete #{domain.name}?", anything) { true }
|
43
|
+
domain.should_receive(:delete!)
|
44
|
+
subject
|
45
|
+
end
|
46
|
+
end
|
43
47
|
end
|
44
|
-
end
|
45
|
-
end
|
46
48
|
|
47
|
-
|
48
|
-
|
49
|
+
context "when a space is given" do
|
50
|
+
subject { cf %W[unmap-domain #{domain.name} --space #{space.name}] }
|
49
51
|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
52
|
+
it "unmaps the domain from the space" do
|
53
|
+
space.should_receive(:remove_domain).with(domain)
|
54
|
+
subject
|
55
|
+
end
|
56
|
+
end
|
55
57
|
|
56
|
-
|
57
|
-
|
58
|
+
context "when an organization is given" do
|
59
|
+
subject { cf %W[unmap-domain #{domain.name} --organization #{organization.name}] }
|
58
60
|
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
61
|
+
it "unmaps the domain from the organization" do
|
62
|
+
organization.should_receive(:remove_domain).with(domain)
|
63
|
+
subject
|
64
|
+
end
|
65
|
+
end
|
64
66
|
|
65
|
-
|
66
|
-
|
67
|
+
context "when only the domain is given" do
|
68
|
+
subject { cf %W[unmap-domain #{domain.name}] }
|
67
69
|
|
68
|
-
|
69
|
-
|
70
|
-
|
70
|
+
it "unmaps the domain from the current space" do
|
71
|
+
client.current_space.should_receive(:remove_domain).with(domain)
|
72
|
+
subject
|
73
|
+
end
|
74
|
+
end
|
71
75
|
end
|
72
76
|
end
|
73
77
|
end
|