cf 1.1.4 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/cf/cli/start/login.rb +3 -0
- data/lib/cf/version.rb +1 -1
- data/spec/cf/cli/app/base_spec.rb +2 -2
- data/spec/cf/cli/app/delete_spec.rb +150 -129
- data/spec/cf/cli/app/instances_spec.rb +56 -51
- data/spec/cf/cli/app/push/create_spec.rb +72 -70
- data/spec/cf/cli/app/push_spec.rb +46 -43
- data/spec/cf/cli/app/rename_spec.rb +13 -6
- data/spec/cf/cli/app/scale_spec.rb +9 -4
- data/spec/cf/cli/app/start_spec.rb +28 -23
- data/spec/cf/cli/app/stats_spec.rb +9 -10
- data/spec/cf/cli/domain/map_spec.rb +13 -10
- data/spec/cf/cli/domain/unmap_spec.rb +11 -11
- data/spec/cf/cli/organization/delete_spec.rb +10 -4
- data/spec/cf/cli/organization/orgs_spec.rb +15 -4
- data/spec/cf/cli/organization/rename_spec.rb +7 -5
- data/spec/cf/cli/populators/organization_spec.rb +40 -29
- data/spec/cf/cli/populators/space_spec.rb +51 -40
- data/spec/cf/cli/populators/target_spec.rb +4 -2
- data/spec/cf/cli/route/delete_spec.rb +6 -4
- data/spec/cf/cli/route/map_spec.rb +54 -35
- data/spec/cf/cli/route/unmap_spec.rb +21 -15
- data/spec/cf/cli/service/create_spec.rb +17 -12
- data/spec/cf/cli/service/rename_spec.rb +8 -6
- data/spec/cf/cli/service/services_spec.rb +15 -8
- data/spec/cf/cli/space/create_spec.rb +5 -9
- data/spec/cf/cli/space/delete_spec.rb +9 -8
- data/spec/cf/cli/space/rename_spec.rb +15 -8
- data/spec/cf/cli/space/space_spec.rb +10 -10
- data/spec/cf/cli/space/spaces_spec.rb +11 -5
- data/spec/cf/cli/space/switch_space_spec.rb +7 -7
- data/spec/cf/cli/start/info_spec.rb +3 -1
- data/spec/cf/cli/start/login_spec.rb +1 -1
- data/spec/cf/cli/start/logout_spec.rb +1 -1
- data/spec/cf/cli/start/target_spec.rb +7 -6
- data/spec/cf/cli/user/create_spec.rb +3 -4
- data/spec/cf/cli/user/passwd_spec.rb +2 -4
- data/spec/cf/cli/user/register_spec.rb +4 -4
- data/spec/cf/cli_spec.rb +1 -3
- data/spec/factories/cfoundry/v2/apps_factory.rb +12 -0
- data/spec/factories/cfoundry/v2/clients_factory.rb +4 -0
- data/spec/factories/cfoundry/v2/{domain_factory.rb → domains_factory.rb} +0 -0
- data/spec/factories/cfoundry/v2/organizations_factory.rb +12 -0
- data/spec/factories/cfoundry/v2/{route_factory.rb → routes_factory.rb} +0 -0
- data/spec/factories/cfoundry/v2/service_bindings_factory.rb +11 -0
- data/spec/factories/cfoundry/v2/service_instances_factory.rb +12 -0
- data/spec/factories/cfoundry/v2/service_plans_factory.rb +13 -0
- data/spec/factories/cfoundry/v2/services_factory.rb +14 -0
- data/spec/factories/cfoundry/v2/spaces_factory.rb +12 -0
- data/spec/factories/cfoundry/v2/stacks_factory.rb +11 -0
- data/spec/factories/cfoundry/v2/{user_factory.rb → users_factory.rb} +0 -0
- data/spec/features/push_flow_spec.rb +8 -8
- data/spec/manifests/manifests_spec.rb +34 -51
- data/spec/manifests/plugin_spec.rb +17 -6
- data/spec/spec_helper.rb +0 -1
- data/spec/support/interact_helper.rb +1 -1
- data/spec/tunnel/tunnel_spec.rb +5 -5
- metadata +37 -13
@@ -5,7 +5,9 @@ describe CF::Start::Info do
|
|
5
5
|
let(:all) { false }
|
6
6
|
|
7
7
|
let(:client) do
|
8
|
-
|
8
|
+
build(:client).tap do |client|
|
9
|
+
client.stub(:services => Array.new(3) { build(:service) })
|
10
|
+
end
|
9
11
|
end
|
10
12
|
|
11
13
|
let(:target_info) do
|
@@ -7,8 +7,8 @@ module CF
|
|
7
7
|
stub_client_and_precondition
|
8
8
|
end
|
9
9
|
|
10
|
-
let(:client) {
|
11
|
-
let(:app) {
|
10
|
+
let(:client) { build(:client).tap {|client| client.stub(:apps => [app]) } }
|
11
|
+
let(:app) { build(:app) }
|
12
12
|
|
13
13
|
describe "metadata" do
|
14
14
|
let(:command) { Mothership.commands[:target] }
|
@@ -41,12 +41,13 @@ module CF
|
|
41
41
|
stub_home_dir_with { "#{SPEC_ROOT}/fixtures/fake_home_dirs/new" }
|
42
42
|
|
43
43
|
context "when the user is authenticated and has an organization" do
|
44
|
-
let(:user) {
|
45
|
-
let(:organization) {
|
46
|
-
let(:space) {
|
47
|
-
let(:client) { fake_client :organizations => [organization], :token => CFoundry::AuthToken.new("bearer some-access-token") }
|
44
|
+
let(:user) { build(:user) }
|
45
|
+
let(:organization) { build(:organization, :name => "My Org", :guid => "organization-id-1", :users => [user], :spaces => [space]) }
|
46
|
+
let(:space) { build(:space, :name => "Staging", :guid => "space-id-2", :developers => [user]) }
|
48
47
|
|
49
48
|
before do
|
49
|
+
client.stub(:logged_in?) { true }
|
50
|
+
client.stub(:organizations) { [organization] }
|
50
51
|
client.stub(:current_user) { user }
|
51
52
|
client.stub(:organization) { organization }
|
52
53
|
client.stub(:current_organization) { organization }
|
@@ -25,9 +25,9 @@ module CF
|
|
25
25
|
end
|
26
26
|
|
27
27
|
describe "running the command" do
|
28
|
-
let(:client) {
|
29
|
-
let(:org) {
|
30
|
-
let(:user) {
|
28
|
+
let(:client) { build(:client) }
|
29
|
+
let(:org) { build(:organization) }
|
30
|
+
let(:user) { build(:user) }
|
31
31
|
|
32
32
|
before do
|
33
33
|
stub_client
|
@@ -90,7 +90,6 @@ module CF
|
|
90
90
|
user.managed_organizations.should == [org]
|
91
91
|
user.audited_organizations.should == [org]
|
92
92
|
end
|
93
|
-
|
94
93
|
end
|
95
94
|
end
|
96
95
|
end
|
@@ -16,15 +16,13 @@ module CF
|
|
16
16
|
end
|
17
17
|
|
18
18
|
describe "#passwd" do
|
19
|
-
let(:client) {
|
19
|
+
let(:client) { build(:client) }
|
20
20
|
let(:old_password) { "old" }
|
21
21
|
let(:new_password) { "password" }
|
22
22
|
let(:verify_password) { new_password }
|
23
23
|
let(:score) { :strong }
|
24
24
|
let(:guid) { random_string("my-object-guid") }
|
25
|
-
let(:
|
26
|
-
let(:user_object) { user_model.new(guid, client) }
|
27
|
-
let(:user) { user_object.fake(:password => "foo") }
|
25
|
+
let(:user) { build(:user) }
|
28
26
|
|
29
27
|
before do
|
30
28
|
stub_client_and_precondition
|
@@ -3,7 +3,7 @@ require "spec_helper"
|
|
3
3
|
module CF
|
4
4
|
module User
|
5
5
|
describe Register do
|
6
|
-
let(:client) {
|
6
|
+
let(:client) { build(:client) }
|
7
7
|
|
8
8
|
before do
|
9
9
|
stub_client_and_precondition
|
@@ -133,9 +133,9 @@ module CF
|
|
133
133
|
subject { cf %W[register --no-force --no-login] }
|
134
134
|
|
135
135
|
it "asks for the email, password and confirm password" do
|
136
|
-
|
137
|
-
|
138
|
-
|
136
|
+
should_ask("Email") { email }
|
137
|
+
should_ask("Password", anything) { password }
|
138
|
+
should_ask("Confirm Password", anything) { verify_password }
|
139
139
|
subject
|
140
140
|
end
|
141
141
|
end
|
data/spec/cf/cli_spec.rb
CHANGED
@@ -152,7 +152,7 @@ module CF
|
|
152
152
|
|
153
153
|
describe "#execute" do
|
154
154
|
let(:inputs) { {} }
|
155
|
-
let(:client) {
|
155
|
+
let(:client) { build(:client) }
|
156
156
|
|
157
157
|
before do
|
158
158
|
stub_client
|
@@ -179,8 +179,6 @@ module CF
|
|
179
179
|
def precondition;
|
180
180
|
end
|
181
181
|
|
182
|
-
desc "XXX"
|
183
|
-
|
184
182
|
def refresh_token
|
185
183
|
if client
|
186
184
|
client.token = self.class.new_token
|
@@ -0,0 +1,12 @@
|
|
1
|
+
FactoryGirl.define do
|
2
|
+
factory :app, :class => CFoundry::V2::App do
|
3
|
+
sequence(:guid) { |n| "app-guid-#{n}" }
|
4
|
+
sequence(:name) { |n| "app-name-#{n}" }
|
5
|
+
|
6
|
+
ignore do
|
7
|
+
client { FactoryGirl.build(:client) }
|
8
|
+
end
|
9
|
+
|
10
|
+
initialize_with { new(guid, client) }
|
11
|
+
end
|
12
|
+
end
|
File without changes
|
@@ -0,0 +1,12 @@
|
|
1
|
+
FactoryGirl.define do
|
2
|
+
factory :organization, :class => CFoundry::V2::Organization do
|
3
|
+
sequence(:guid) { |n| "organization-guid-#{n}" }
|
4
|
+
sequence(:name) { |n| "organization-name-#{n}" }
|
5
|
+
|
6
|
+
ignore do
|
7
|
+
client { FactoryGirl.build(:client) }
|
8
|
+
end
|
9
|
+
|
10
|
+
initialize_with { new(guid, client) }
|
11
|
+
end
|
12
|
+
end
|
File without changes
|
@@ -0,0 +1,11 @@
|
|
1
|
+
FactoryGirl.define do
|
2
|
+
factory :service_binding, :class => CFoundry::V2::ServiceBinding do
|
3
|
+
sequence(:guid) { |n| "service-binding-guid-#{n}" }
|
4
|
+
|
5
|
+
ignore do
|
6
|
+
client { FactoryGirl.build(:client) }
|
7
|
+
end
|
8
|
+
|
9
|
+
initialize_with { new(guid, client) }
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
FactoryGirl.define do
|
2
|
+
factory :service_instance, :class => CFoundry::V2::ServiceInstance do
|
3
|
+
sequence(:guid) { |n| "service-instance-guid-#{n}" }
|
4
|
+
sequence(:name) { |n| "service-instance-name-#{n}" }
|
5
|
+
|
6
|
+
ignore do
|
7
|
+
client { FactoryGirl.build(:client) }
|
8
|
+
end
|
9
|
+
|
10
|
+
initialize_with { new(guid, client) }
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
FactoryGirl.define do
|
2
|
+
factory :service_plan, :class => CFoundry::V2::ServicePlan do
|
3
|
+
sequence(:guid) { |n| "service-plan-guid-#{n}" }
|
4
|
+
sequence(:name) { |n| "service-plan-name-#{n}" }
|
5
|
+
extra { "{}" }
|
6
|
+
|
7
|
+
ignore do
|
8
|
+
client { FactoryGirl.build(:client) }
|
9
|
+
end
|
10
|
+
|
11
|
+
initialize_with { new(guid, client) }
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
FactoryGirl.define do
|
2
|
+
factory :service, :class => CFoundry::V2::Service do
|
3
|
+
sequence(:guid) { |n| "service-guid-#{n}" }
|
4
|
+
sequence(:label) { |n| "service-label-#{n}" }
|
5
|
+
service_plans { [build(:service_plan)] }
|
6
|
+
extra { "{}" }
|
7
|
+
|
8
|
+
ignore do
|
9
|
+
client { FactoryGirl.build(:client) }
|
10
|
+
end
|
11
|
+
|
12
|
+
initialize_with { new(guid, client) }
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
FactoryGirl.define do
|
2
|
+
factory :space, :class => CFoundry::V2::Space do
|
3
|
+
sequence(:guid) { |n| "space-guid-#{n}" }
|
4
|
+
sequence(:name) { |n| "space-name-#{n}" }
|
5
|
+
|
6
|
+
ignore do
|
7
|
+
client { FactoryGirl.build(:client) }
|
8
|
+
end
|
9
|
+
|
10
|
+
initialize_with { new(guid, client) }
|
11
|
+
end
|
12
|
+
end
|
File without changes
|
@@ -12,7 +12,7 @@ if ENV['CF_V2_RUN_INTEGRATION']
|
|
12
12
|
|
13
13
|
let(:run_id) { TRAVIS_BUILD_ID.to_s + Time.new.to_f.to_s.gsub(".", "_") }
|
14
14
|
let(:app) { "hello-sinatra-#{run_id}" }
|
15
|
-
let(:service_name) { "
|
15
|
+
let(:service_name) { "dummy-service-#{run_id}" }
|
16
16
|
|
17
17
|
before do
|
18
18
|
FileUtils.rm_rf File.expand_path(CF::CONFIG_DIR)
|
@@ -65,13 +65,13 @@ if ENV['CF_V2_RUN_INTEGRATION']
|
|
65
65
|
|
66
66
|
# create a service here
|
67
67
|
expect(runner).to say "What kind?>"
|
68
|
-
runner.send_keys "
|
68
|
+
runner.send_keys "dummy n/a"
|
69
69
|
|
70
70
|
expect(runner).to say "Name?>"
|
71
71
|
runner.send_keys service_name
|
72
72
|
|
73
73
|
expect(runner).to say "Which plan?>"
|
74
|
-
runner.send_keys "
|
74
|
+
runner.send_keys "small"
|
75
75
|
|
76
76
|
expect(runner).to say /Creating service #{service_name}.*OK/
|
77
77
|
expect(runner).to say /Binding .+ to .+ OK/
|
@@ -97,17 +97,17 @@ if ENV['CF_V2_RUN_INTEGRATION']
|
|
97
97
|
|
98
98
|
BlueShell::Runner.run("#{cf_bin} services") do |runner|
|
99
99
|
expect(runner).to say /name\s+service\s+provider\s+version\s+plan\s+bound apps/
|
100
|
-
expect(runner).to say /
|
101
|
-
|
102
|
-
|
100
|
+
expect(runner).to say /dummy-service-.+?\s+ # name
|
101
|
+
dummy\s+ # service
|
102
|
+
dummy\s+ # provider
|
103
103
|
n\/a\s+ # version
|
104
|
-
|
104
|
+
small\s+ # plan
|
105
105
|
#{app} # bound apps
|
106
106
|
/x
|
107
107
|
end
|
108
108
|
|
109
109
|
BlueShell::Runner.run("#{cf_bin} unbind-service #{service_name} #{app}") do |runner|
|
110
|
-
runner.
|
110
|
+
expect(runner).to say "OK", 20
|
111
111
|
end
|
112
112
|
|
113
113
|
BlueShell::Runner.run("#{cf_bin} delete #{app}") do |runner|
|
@@ -15,14 +15,14 @@ describe CFManifests do
|
|
15
15
|
|
16
16
|
let(:target_base) { "some-cloud.com" }
|
17
17
|
|
18
|
-
let(:foo) {
|
19
|
-
let(:bar) {
|
20
|
-
let(:baz) {
|
21
|
-
let(:xxx) {
|
22
|
-
let(:yyy) {
|
18
|
+
let(:foo) { build(:app, :name => "foo") }
|
19
|
+
let(:bar) { build(:app, :name => "bar") }
|
20
|
+
let(:baz) { build(:app, :name => "baz") }
|
21
|
+
let(:xxx) { build(:app, :name => "xxx") }
|
22
|
+
let(:yyy) { build(:app, :name => "yyy") }
|
23
23
|
|
24
24
|
let(:client) do
|
25
|
-
|
25
|
+
build(:client).tap { |client| client.stub(:apps => [foo, bar, baz, xxx, yyy]) }
|
26
26
|
end
|
27
27
|
|
28
28
|
let(:manifest_file) { "/abc/manifest.yml" }
|
@@ -44,31 +44,31 @@ describe CFManifests do
|
|
44
44
|
end
|
45
45
|
|
46
46
|
describe "#create_manifest_for" do
|
47
|
-
let(:app)
|
48
|
-
|
47
|
+
let(:app) do
|
48
|
+
build :app,
|
49
49
|
:memory => 2048,
|
50
50
|
:total_instances => 2,
|
51
51
|
:command => "ruby main.rb",
|
52
52
|
:buildpack => "git://example.com/foo.git",
|
53
53
|
:routes => [
|
54
|
-
|
55
|
-
|
56
|
-
|
54
|
+
build(:route,
|
55
|
+
:host => "some-app-name",
|
56
|
+
:domain => build(:domain, :name => target_base))
|
57
57
|
],
|
58
58
|
:service_bindings => [
|
59
|
-
|
59
|
+
build(
|
60
60
|
:service_binding,
|
61
61
|
:service_instance =>
|
62
|
-
|
62
|
+
build(
|
63
63
|
:service_instance,
|
64
64
|
:name => "service-1",
|
65
65
|
:service_plan =>
|
66
|
-
|
66
|
+
build(
|
67
67
|
:service_plan,
|
68
68
|
:name => "P200",
|
69
|
-
:service =>
|
69
|
+
:service => build(:service))))
|
70
70
|
]
|
71
|
-
|
71
|
+
end
|
72
72
|
|
73
73
|
subject { cmd.create_manifest_for(app, "some-path") }
|
74
74
|
|
@@ -105,73 +105,56 @@ describe CFManifests do
|
|
105
105
|
end
|
106
106
|
end
|
107
107
|
|
108
|
-
context "
|
108
|
+
context "with only minimum configuration" do
|
109
109
|
let(:app) {
|
110
|
-
|
110
|
+
build :app,
|
111
111
|
:memory => 2048,
|
112
|
-
:total_instances => 2
|
112
|
+
:total_instances => 2,
|
113
|
+
:routes => [],
|
114
|
+
:service_bindings => []
|
113
115
|
}
|
114
116
|
|
115
117
|
its(["url"]) { should eq "none" }
|
116
|
-
end
|
117
|
-
|
118
|
-
context "when there is no command" do
|
119
|
-
let(:app) {
|
120
|
-
fake :app,
|
121
|
-
:memory => 2048,
|
122
|
-
:total_instances => 2
|
123
|
-
}
|
124
|
-
|
125
118
|
it { should_not include "command" }
|
126
|
-
end
|
127
|
-
|
128
|
-
context "when there are no service bindings" do
|
129
|
-
let(:app) {
|
130
|
-
fake :app,
|
131
|
-
:memory => 2048,
|
132
|
-
:total_instances => 2
|
133
|
-
}
|
134
|
-
|
135
119
|
it { should_not include "services" }
|
136
120
|
end
|
137
121
|
end
|
138
122
|
|
139
123
|
describe "#setup_services" do
|
140
124
|
let(:service_bindings) { [] }
|
141
|
-
let(:app) {
|
125
|
+
let(:app) { build :app, :service_bindings => service_bindings }
|
142
126
|
|
143
127
|
before do
|
144
128
|
dont_allow_ask(anything, anything)
|
145
129
|
end
|
146
130
|
|
147
131
|
context "when services are defined in the manifest" do
|
148
|
-
let(:info)
|
149
|
-
{
|
150
|
-
|
151
|
-
|
152
|
-
let(:service_1) { fake(:service_instance, :name => "service-1") }
|
132
|
+
let(:info) do
|
133
|
+
{:services => {"service-1" => {:label => "mysql", :plan => "100"}}}
|
134
|
+
end
|
153
135
|
|
154
|
-
let(:
|
136
|
+
let(:service_1) { build(:service_instance, :name => "service-1") }
|
137
|
+
let(:plan_100) { build :service_plan, :name => "100" }
|
155
138
|
|
156
|
-
let(:mysql)
|
157
|
-
|
139
|
+
let(:mysql) do
|
140
|
+
build(
|
158
141
|
:service,
|
159
142
|
:label => "mysql",
|
160
143
|
:provider => "core",
|
161
144
|
:service_plans => [plan_100])
|
162
|
-
|
145
|
+
end
|
163
146
|
|
164
147
|
let(:service_instances) { [] }
|
165
148
|
|
166
|
-
let(:client)
|
167
|
-
|
168
|
-
|
149
|
+
let(:client) do
|
150
|
+
build(:client).tap { |client| client.stub(:services => [mysql], :service_instances => service_instances) }
|
151
|
+
end
|
169
152
|
|
170
153
|
context "and the services exist" do
|
171
154
|
let(:service_instances) { [service_1] }
|
172
155
|
|
173
156
|
context "and are already bound" do
|
174
|
-
let(:service_bindings) { [
|
157
|
+
let(:service_bindings) { [build(:service_binding, :service_instance => service_1)] }
|
175
158
|
|
176
159
|
it "does neither create nor bind the service again" do
|
177
160
|
cmd.should_not_receive(:invoke).with(:create_service, anything)
|