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,5 +1,4 @@
|
|
1
|
-
require
|
2
|
-
require "cf/cli/app/rename"
|
1
|
+
require "spec_helper"
|
3
2
|
|
4
3
|
describe CF::App::Rename do
|
5
4
|
let(:global) { { :color => false, :quiet => true } }
|
@@ -10,28 +9,26 @@ describe CF::App::Rename do
|
|
10
9
|
let(:new_name) { "some-new-name" }
|
11
10
|
|
12
11
|
before do
|
13
|
-
|
14
|
-
|
15
|
-
stub(cli).precondition { nil }
|
16
|
-
end
|
12
|
+
CF::CLI.any_instance.stub(:client).and_return(client)
|
13
|
+
CF::CLI.any_instance.stub(:precondition).and_return(nil)
|
17
14
|
end
|
18
15
|
|
19
16
|
subject { Mothership.new.invoke(:rename, inputs, given, global) }
|
20
17
|
|
21
|
-
describe
|
18
|
+
describe "metadata" do
|
22
19
|
let(:command) { Mothership.commands[:rename] }
|
23
20
|
|
24
|
-
describe
|
21
|
+
describe "command" do
|
25
22
|
subject { command }
|
26
23
|
its(:description) { should eq "Rename an application" }
|
27
24
|
it { expect(Mothership::Help.group(:apps, :manage)).to include(subject) }
|
28
25
|
end
|
29
26
|
|
30
|
-
include_examples
|
27
|
+
include_examples "inputs must have descriptions"
|
31
28
|
|
32
|
-
describe
|
29
|
+
describe "arguments" do
|
33
30
|
subject { command.arguments }
|
34
|
-
it
|
31
|
+
it "has the correct argument order" do
|
35
32
|
should eq([
|
36
33
|
{ :type => :optional, :value => nil, :name => :app },
|
37
34
|
{ :type => :optional, :value => nil, :name => :name }
|
@@ -40,62 +37,62 @@ describe CF::App::Rename do
|
|
40
37
|
end
|
41
38
|
end
|
42
39
|
|
43
|
-
context
|
44
|
-
context
|
40
|
+
context "when there are no apps" do
|
41
|
+
context "and an app is given" do
|
45
42
|
let(:given) { { :app => "some-app" } }
|
46
43
|
it { expect { subject }.to raise_error(CF::UserError, "Unknown app 'some-app'.") }
|
47
44
|
end
|
48
45
|
|
49
|
-
context
|
46
|
+
context "and an app is not given" do
|
50
47
|
it { expect { subject }.to raise_error(CF::UserError, "No applications.") }
|
51
48
|
end
|
52
49
|
end
|
53
50
|
|
54
|
-
context
|
51
|
+
context "when there are apps" do
|
55
52
|
let(:client) { fake_client(:apps => apps) }
|
56
53
|
let(:apps) { fake_list(:app, 2) }
|
57
54
|
let(:renamed_app) { apps.first }
|
58
55
|
|
59
|
-
context
|
60
|
-
it
|
56
|
+
context "when the defaults are used" do
|
57
|
+
it "asks for the app and new name and renames" do
|
61
58
|
mock_ask("Rename which application?", anything) { renamed_app }
|
62
59
|
mock_ask("New name") { new_name }
|
63
|
-
|
64
|
-
|
60
|
+
renamed_app.should_receive(:name=).with(new_name)
|
61
|
+
renamed_app.should_receive(:update!)
|
65
62
|
subject
|
66
63
|
end
|
67
64
|
end
|
68
65
|
|
69
|
-
context
|
66
|
+
context "when no name is provided, but a app is" do
|
70
67
|
let(:given) { { :app => renamed_app.name } }
|
71
68
|
|
72
|
-
it
|
69
|
+
it "asks for the new name and renames" do
|
73
70
|
dont_allow_ask("Rename which application?", anything)
|
74
71
|
mock_ask("New name") { new_name }
|
75
|
-
|
76
|
-
|
72
|
+
renamed_app.should_receive(:name=).with(new_name)
|
73
|
+
renamed_app.should_receive(:update!)
|
77
74
|
subject
|
78
75
|
end
|
79
76
|
end
|
80
77
|
|
81
|
-
context
|
78
|
+
context "when an app is provided and a name" do
|
82
79
|
let(:inputs) { { :app => renamed_app, :name => new_name } }
|
83
80
|
|
84
|
-
it
|
85
|
-
|
81
|
+
it "renames the app" do
|
82
|
+
renamed_app.should_receive(:update!)
|
86
83
|
subject
|
87
84
|
end
|
88
85
|
|
89
|
-
it
|
86
|
+
it "displays the progress" do
|
90
87
|
mock_with_progress("Renaming to #{new_name}")
|
91
|
-
|
88
|
+
renamed_app.should_receive(:update!)
|
92
89
|
|
93
90
|
subject
|
94
91
|
end
|
95
92
|
|
96
|
-
context
|
97
|
-
it
|
98
|
-
|
93
|
+
context "and the name already exists" do
|
94
|
+
it "fails" do
|
95
|
+
renamed_app.should_receive(:update!) { raise CFoundry::AppNameTaken.new("Bad Name", 404) }
|
99
96
|
expect { subject }.to raise_error(CFoundry::AppNameTaken)
|
100
97
|
end
|
101
98
|
end
|
@@ -1,55 +1,58 @@
|
|
1
1
|
require "spec_helper"
|
2
|
-
require "webmock/rspec"
|
3
2
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
context "when the --disk flag is given" do
|
12
|
-
let(:before_value) { 512 }
|
13
|
-
let(:app) { fake :app, :disk_quota => before_value }
|
14
|
-
|
15
|
-
subject { cf %W[scale #{app.name} --disk 1G] }
|
3
|
+
module CF
|
4
|
+
module App
|
5
|
+
describe Scale do
|
6
|
+
before do
|
7
|
+
stub_client_and_precondition
|
8
|
+
end
|
16
9
|
|
17
|
-
|
18
|
-
mock(app).update!
|
19
|
-
expect { subject }.to change(app, :disk_quota).from(before_value).to(1024)
|
20
|
-
end
|
21
|
-
end
|
10
|
+
let(:client) { fake_client :apps => [app] }
|
22
11
|
|
23
|
-
|
24
|
-
|
25
|
-
|
12
|
+
context "when the --disk flag is given" do
|
13
|
+
let(:before_value) { 512 }
|
14
|
+
let(:app) { fake :app, :disk_quota => before_value }
|
26
15
|
|
27
|
-
|
16
|
+
subject { cf %W[scale #{app.name} --disk 1G] }
|
28
17
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
18
|
+
it "changes the application's disk quota" do
|
19
|
+
app.should_receive(:update!)
|
20
|
+
expect { subject }.to change(app, :disk_quota).from(before_value).to(1024)
|
21
|
+
end
|
22
|
+
end
|
33
23
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
24
|
+
context "when the --memory flag is given" do
|
25
|
+
let(:before_value) { 512 }
|
26
|
+
let(:app) { fake :app, :memory => before_value }
|
27
|
+
|
28
|
+
subject { cf %W[scale #{app.name} --memory 1G] }
|
29
|
+
|
30
|
+
it "changes the application's memory" do
|
31
|
+
app.should_receive(:update!)
|
32
|
+
expect { subject }.to change(app, :memory).from(before_value).to(1024)
|
33
|
+
end
|
34
|
+
|
35
|
+
context "if --restart is true" do
|
36
|
+
it "restarts the application" do
|
37
|
+
app.stub(:update!)
|
38
|
+
app.stub(:started?) { true }
|
39
|
+
mock_invoke :restart, :app => app
|
40
|
+
subject
|
41
|
+
end
|
42
|
+
end
|
40
43
|
end
|
41
|
-
end
|
42
|
-
end
|
43
44
|
|
44
|
-
|
45
|
-
|
46
|
-
|
45
|
+
context "when the --instances flag is given" do
|
46
|
+
let(:before_value) { 3 }
|
47
|
+
let(:app) { fake :app, :total_instances => before_value }
|
47
48
|
|
48
|
-
|
49
|
+
subject { cf %W[scale #{app.name} --instances 5] }
|
49
50
|
|
50
|
-
|
51
|
-
|
52
|
-
|
51
|
+
it "changes the application's number of instances" do
|
52
|
+
app.should_receive(:update!)
|
53
|
+
expect { subject }.to change(app, :total_instances).from(before_value).to(5)
|
54
|
+
end
|
55
|
+
end
|
53
56
|
end
|
54
57
|
end
|
55
58
|
end
|
@@ -1,242 +1,243 @@
|
|
1
1
|
require "spec_helper"
|
2
|
-
require "webmock/rspec"
|
3
2
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
let(:client) { fake_client :apps => [app] }
|
10
|
-
let(:app) { fake :app }
|
11
|
-
|
12
|
-
subject { cf %W[start #{app.name}] }
|
13
|
-
|
14
|
-
context "with an app that's already started" do
|
15
|
-
let(:app) { fake :app, :state => "STARTED" }
|
16
|
-
|
17
|
-
it "skips starting the application" do
|
18
|
-
dont_allow(app).start!
|
19
|
-
subject
|
20
|
-
end
|
21
|
-
|
22
|
-
it "says the app is already started" do
|
23
|
-
subject
|
24
|
-
expect(error_output).to say("Application #{app.name} is already started.")
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
context "with an app that's NOT already started" do
|
29
|
-
def self.it_says_application_is_starting
|
30
|
-
it "says that it's starting the application" do
|
31
|
-
subject
|
32
|
-
expect(output).to say("Starting #{app.name}... OK")
|
3
|
+
module CF
|
4
|
+
module App
|
5
|
+
describe Start do
|
6
|
+
before do
|
7
|
+
stub_client_and_precondition
|
33
8
|
end
|
34
|
-
end
|
35
9
|
|
36
|
-
|
37
|
-
|
38
|
-
subject
|
39
|
-
expect(output).to say(log_text)
|
40
|
-
end
|
41
|
-
end
|
10
|
+
let(:client) { fake_client :apps => [app] }
|
11
|
+
let(:app) { fake :app }
|
42
12
|
|
43
|
-
|
44
|
-
it "does not print the log progress" do
|
45
|
-
subject
|
46
|
-
expect(output).to_not say(log_text)
|
47
|
-
end
|
48
|
-
end
|
13
|
+
subject { cf %W[start #{app.name}] }
|
49
14
|
|
50
|
-
|
51
|
-
|
52
|
-
let(:app) { fake :app, :total_instances => 2 }
|
15
|
+
context "with an app that's already started" do
|
16
|
+
let(:app) { fake :app, :state => "STARTED" }
|
53
17
|
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
end
|
18
|
+
it "skips starting the application" do
|
19
|
+
app.should_not_receive(:start!)
|
20
|
+
subject
|
58
21
|
end
|
59
22
|
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
CFoundry::V2::App::Instance.new(nil, nil, nil, :state => "RUNNING")
|
64
|
-
]
|
65
|
-
end
|
66
|
-
|
67
|
-
after_sleep do
|
68
|
-
stub(app).instances { final_instances }
|
69
|
-
end
|
23
|
+
it "says the app is already started" do
|
24
|
+
subject
|
25
|
+
expect(error_output).to say("Application #{app.name} is already started.")
|
70
26
|
end
|
27
|
+
end
|
71
28
|
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
CFoundry::V2::App::Instance.new(nil, nil, nil, :state => "RUNNING")
|
76
|
-
]
|
77
|
-
end
|
78
|
-
|
79
|
-
it "says app is started" do
|
29
|
+
context "with an app that's NOT already started" do
|
30
|
+
def self.it_says_application_is_starting
|
31
|
+
it "says that it's starting the application" do
|
80
32
|
subject
|
81
|
-
expect(output).to say("
|
82
|
-
expect(output).to say("1 running, 1 down")
|
83
|
-
expect(output).to say("2 running")
|
33
|
+
expect(output).to say("Starting #{app.name}... OK")
|
84
34
|
end
|
85
35
|
end
|
86
36
|
|
87
|
-
|
88
|
-
|
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
|
37
|
+
def self.it_prints_log_progress
|
38
|
+
it "prints out the log progress" do
|
93
39
|
subject
|
94
|
-
expect(output).to say(
|
95
|
-
expect(error_output).to say("Application failed to stage")
|
96
|
-
expect(output).to_not say(/\d (running|down|flapping)/)
|
40
|
+
expect(output).to say(log_text)
|
97
41
|
end
|
98
42
|
end
|
99
43
|
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
]
|
105
|
-
end
|
106
|
-
|
107
|
-
before do
|
108
|
-
stub(app).instances { raise CFoundry::NotStaged.new("Staging is pending", 170002, nil, nil) }
|
44
|
+
def self.it_does_not_print_log_progress
|
45
|
+
it "does not print the log progress" do
|
46
|
+
subject
|
47
|
+
expect(output).to_not say(log_text)
|
109
48
|
end
|
49
|
+
end
|
110
50
|
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
51
|
+
def self.it_waits_for_application_to_become_healthy
|
52
|
+
describe "waits for application to become healthy" do
|
53
|
+
let(:app) { fake :app, :total_instances => 2 }
|
54
|
+
|
55
|
+
def after_sleep
|
56
|
+
described_class.any_instance.stub(:sleep) { yield }
|
57
|
+
end
|
58
|
+
|
59
|
+
before do
|
60
|
+
app.stub(:instances) do
|
61
|
+
[CFoundry::V2::App::Instance.new(nil, nil, nil, :state => "DOWN"),
|
62
|
+
CFoundry::V2::App::Instance.new(nil, nil, nil, :state => "RUNNING")
|
63
|
+
]
|
64
|
+
end
|
65
|
+
|
66
|
+
after_sleep do
|
67
|
+
app.stub(:instances) { final_instances }
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
context "when all instances become running" do
|
72
|
+
let(:final_instances) do
|
73
|
+
[CFoundry::V2::App::Instance.new(nil, nil, nil, :state => "RUNNING"),
|
74
|
+
CFoundry::V2::App::Instance.new(nil, nil, nil, :state => "RUNNING")
|
75
|
+
]
|
76
|
+
end
|
77
|
+
|
78
|
+
it "says app is started" do
|
79
|
+
subject
|
80
|
+
expect(output).to say("Checking #{app.name}...")
|
81
|
+
expect(output).to say("1 running, 1 down")
|
82
|
+
expect(output).to say("2 running")
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
context "staging fails" do
|
87
|
+
before do
|
88
|
+
app.stub(:instances) { raise CFoundry::StagingError.new("Failed to stage", 170001, nil, nil) }
|
89
|
+
end
|
90
|
+
|
91
|
+
it "says the app failed to stage" do
|
92
|
+
subject
|
93
|
+
expect(output).to say("Checking #{app.name}...")
|
94
|
+
expect(error_output).to say("Application failed to stage")
|
95
|
+
expect(output).to_not say(/\d (running|down|flapping)/)
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
context "staging has not completed" do
|
100
|
+
let(:final_instances) do
|
101
|
+
[CFoundry::V2::App::Instance.new(nil, nil, nil, :state => "RUNNING"),
|
102
|
+
CFoundry::V2::App::Instance.new(nil, nil, nil, :state => "RUNNING")
|
103
|
+
]
|
104
|
+
end
|
105
|
+
|
106
|
+
before do
|
107
|
+
app.stub(:instances) { raise CFoundry::NotStaged.new("Staging is pending", 170002, nil, nil) }
|
108
|
+
end
|
109
|
+
|
110
|
+
it "keeps polling" do
|
111
|
+
subject
|
112
|
+
expect(output).to say("Checking #{app.name}...")
|
113
|
+
expect(output).to say("Staging in progress...")
|
114
|
+
expect(output).to say("2 running")
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
context "when any instance becomes flapping" do
|
119
|
+
let(:final_instances) do
|
120
|
+
[CFoundry::V2::App::Instance.new(nil, nil, nil, :state => "FLAPPING"),
|
121
|
+
CFoundry::V2::App::Instance.new(nil, nil, nil, :state => "STARTING")
|
122
|
+
]
|
123
|
+
end
|
124
|
+
|
125
|
+
it "says app failed to start" do
|
126
|
+
subject
|
127
|
+
expect(output).to say("Checking #{app.name}...")
|
128
|
+
expect(output).to say("1 running, 1 down")
|
129
|
+
expect(output).to say("1 starting, 1 flapping")
|
130
|
+
expect(error_output).to say("Application failed to start")
|
131
|
+
end
|
132
|
+
end
|
116
133
|
end
|
117
134
|
end
|
118
135
|
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
136
|
+
let(:log_url) { nil }
|
137
|
+
|
138
|
+
before do
|
139
|
+
app.stub(:invalidate!)
|
140
|
+
app.stub(:instances) do
|
141
|
+
[CFoundry::V2::App::Instance.new(nil, nil, nil, :state => "RUNNING")]
|
124
142
|
end
|
125
143
|
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
expect(output).to say("1 running, 1 down")
|
130
|
-
expect(output).to say("1 starting, 1 flapping")
|
131
|
-
expect(error_output).to say("Application failed to start")
|
144
|
+
app.should_receive(:start!).with(true) do |_, &blk|
|
145
|
+
app.state = "STARTED"
|
146
|
+
blk.call(log_url)
|
132
147
|
end
|
133
148
|
end
|
134
|
-
end
|
135
|
-
end
|
136
149
|
|
137
|
-
|
150
|
+
context "when progress log url is provided" do
|
151
|
+
let(:log_url) { "http://example.com/my-app-log" }
|
152
|
+
let(:log_text) { "Staging complete!" }
|
138
153
|
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
154
|
+
context "and progress log url is not available immediately" do
|
155
|
+
before do
|
156
|
+
stub_request(:get, "#{log_url}&tail&tail_offset=0").to_return(
|
157
|
+
:status => 404, :body => "")
|
158
|
+
end
|
144
159
|
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
end
|
150
|
-
|
151
|
-
context "when progress log url is provided" do
|
152
|
-
let(:log_url) { "http://example.com/my-app-log" }
|
153
|
-
let(:log_text) { "Staging complete!" }
|
154
|
-
|
155
|
-
context "and progress log url is not available immediately" do
|
156
|
-
before do
|
157
|
-
stub_request(:get, "#{log_url}&tail&tail_offset=0").to_return(
|
158
|
-
:status => 404, :body => "")
|
159
|
-
end
|
160
|
+
it_says_application_is_starting
|
161
|
+
it_does_not_print_log_progress
|
162
|
+
it_waits_for_application_to_become_healthy
|
163
|
+
end
|
160
164
|
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
+
context "and progress log url becomes unavailable after some time" do
|
166
|
+
before do
|
167
|
+
stub_request(:get, "#{log_url}&tail&tail_offset=0").to_return(
|
168
|
+
:status => 200, :body => log_text[0...5])
|
169
|
+
stub_request(:get, "#{log_url}&tail&tail_offset=5").to_return(
|
170
|
+
:status => 200, :body => log_text[5..-1])
|
171
|
+
stub_request(:get, "#{log_url}&tail&tail_offset=#{log_text.size}").to_return(
|
172
|
+
:status => 404, :body => "")
|
173
|
+
end
|
174
|
+
|
175
|
+
it_says_application_is_starting
|
176
|
+
it_prints_log_progress
|
177
|
+
it_waits_for_application_to_become_healthy
|
178
|
+
end
|
165
179
|
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
180
|
+
context "and a request times out" do
|
181
|
+
before do
|
182
|
+
stub_request(:get, "#{log_url}&tail&tail_offset=0").to_return(
|
183
|
+
:should_timeout => true)
|
184
|
+
stub_request(:get, "#{log_url}&tail&tail_offset=0").to_return(
|
185
|
+
:status => 200, :body => log_text)
|
186
|
+
stub_request(:get, "#{log_url}&tail&tail_offset=#{log_text.size}").to_return(
|
187
|
+
:status => 404, :body => "")
|
188
|
+
end
|
189
|
+
|
190
|
+
it_says_application_is_starting
|
191
|
+
it_prints_log_progress
|
192
|
+
it_waits_for_application_to_become_healthy
|
193
|
+
end
|
174
194
|
end
|
175
195
|
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
end
|
196
|
+
context "when progress log url is not provided" do
|
197
|
+
let(:log_url) { nil }
|
198
|
+
let(:log_text) { "Staging complete!" }
|
180
199
|
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
:should_timeout => true)
|
185
|
-
stub_request(:get, "#{log_url}&tail&tail_offset=0").to_return(
|
186
|
-
:status => 200, :body => log_text)
|
187
|
-
stub_request(:get, "#{log_url}&tail&tail_offset=#{log_text.size}").to_return(
|
188
|
-
:status => 404, :body => "")
|
200
|
+
it_says_application_is_starting
|
201
|
+
it_does_not_print_log_progress
|
202
|
+
it_waits_for_application_to_become_healthy
|
189
203
|
end
|
190
204
|
|
191
|
-
|
192
|
-
|
193
|
-
it_waits_for_application_to_become_healthy
|
194
|
-
end
|
195
|
-
end
|
196
|
-
|
197
|
-
context "when progress log url is not provided" do
|
198
|
-
let(:log_url) { nil }
|
199
|
-
let(:log_text) { "Staging complete!" }
|
200
|
-
|
201
|
-
it_says_application_is_starting
|
202
|
-
it_does_not_print_log_progress
|
203
|
-
it_waits_for_application_to_become_healthy
|
204
|
-
end
|
205
|
+
context "when a debug mode is given" do
|
206
|
+
let(:mode) { "foo" }
|
205
207
|
|
206
|
-
|
207
|
-
let(:mode) { "foo" }
|
208
|
+
subject { cf %W[start #{app.name} -d #{mode}] }
|
208
209
|
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
end
|
215
|
-
end
|
210
|
+
context "and the debug mode is different from the one already set" do
|
211
|
+
it "starts the app with the given debug mode" do
|
212
|
+
expect { subject }.to change { app.debug }.from(nil).to("foo")
|
213
|
+
end
|
214
|
+
end
|
216
215
|
|
217
|
-
|
218
|
-
|
216
|
+
context "and the debug mode is the same as the one already set" do
|
217
|
+
let(:app) { fake :app, :debug => "foo" }
|
219
218
|
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
219
|
+
it "does not set the debug mode to anything different" do
|
220
|
+
app.should_not_receive(:debug).with(anything)
|
221
|
+
subject
|
222
|
+
end
|
223
|
+
end
|
225
224
|
|
226
|
-
|
227
|
-
|
228
|
-
|
225
|
+
context "and the mode is given as 'none'" do
|
226
|
+
let(:app) { fake :app, :debug => "foo" }
|
227
|
+
let(:mode) { "none" }
|
229
228
|
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
229
|
+
it "removes the debug mode" do
|
230
|
+
expect { subject }.to change { app.debug }.from("foo").to(nil)
|
231
|
+
end
|
232
|
+
end
|
234
233
|
|
235
|
-
|
236
|
-
|
234
|
+
context "and an empty mode is given" do
|
235
|
+
let(:mode) { "" }
|
237
236
|
|
238
|
-
|
239
|
-
|
237
|
+
it "sets debug to 'run'" do
|
238
|
+
expect { subject }.to change { app.debug }.from(nil).to("run")
|
239
|
+
end
|
240
|
+
end
|
240
241
|
end
|
241
242
|
end
|
242
243
|
end
|