engineyard-serverside 2.0.7 → 2.1.0.pre
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/engineyard-serverside.rb +0 -1
- data/lib/engineyard-serverside/cli.rb +44 -42
- data/lib/engineyard-serverside/configuration.rb +55 -4
- data/lib/engineyard-serverside/dependency_manager.rb +17 -0
- data/lib/engineyard-serverside/dependency_manager/base.rb +65 -0
- data/lib/engineyard-serverside/dependency_manager/bundler.rb +124 -0
- data/lib/engineyard-serverside/dependency_manager/bundler_lock.rb +155 -0
- data/lib/engineyard-serverside/dependency_manager/legacy_helpers.rb +24 -0
- data/lib/engineyard-serverside/dependency_manager/npm.rb +16 -0
- data/lib/engineyard-serverside/deploy.rb +86 -178
- data/lib/engineyard-serverside/deprecation.rb +11 -1
- data/lib/engineyard-serverside/paths.rb +6 -0
- data/lib/engineyard-serverside/propagator.rb +2 -2
- data/lib/engineyard-serverside/rails_assets.rb +152 -0
- data/lib/engineyard-serverside/rails_assets/strategy.rb +197 -0
- data/lib/engineyard-serverside/server.rb +5 -0
- data/lib/engineyard-serverside/servers.rb +19 -7
- data/lib/engineyard-serverside/shell.rb +7 -5
- data/lib/engineyard-serverside/shell/command_result.rb +1 -1
- data/lib/engineyard-serverside/strategies/git.rb +14 -4
- data/lib/engineyard-serverside/task.rb +1 -0
- data/lib/engineyard-serverside/version.rb +1 -1
- data/spec/bundler_deploy_spec.rb +36 -33
- data/spec/configuration_spec.rb +5 -4
- data/spec/custom_deploy_spec.rb +11 -9
- data/spec/deploy_hook_spec.rb +10 -3
- data/spec/ey_yml_customized_deploy_spec.rb +1 -1
- data/spec/fixtures/lockfiles/1.0-no-bundler +1 -1
- data/spec/fixtures/lockfiles/1.0.0.rc.1-with-bundler +1 -1
- data/spec/fixtures/lockfiles/1.0.18-do_mysql +1 -1
- data/spec/fixtures/lockfiles/1.0.18-do_postgres +1 -1
- data/spec/fixtures/lockfiles/1.0.18-mysql +1 -1
- data/spec/fixtures/lockfiles/1.0.18-mysql2 +1 -1
- data/spec/fixtures/lockfiles/1.0.18-pg +1 -1
- data/spec/fixtures/lockfiles/1.0.6-no-bundler +2 -2
- data/spec/fixtures/lockfiles/1.0.6-with-any-bundler +2 -2
- data/spec/fixtures/lockfiles/1.0.6-with-bundler +2 -2
- data/spec/fixtures/lockfiles/1.3.1-rails-3.2.13 +112 -0
- data/spec/fixtures/repos/{assets_enabled → assets_detected}/Gemfile +1 -2
- data/spec/fixtures/repos/{assets_enabled → assets_detected}/Gemfile.lock +1 -3
- data/spec/fixtures/repos/{assets_enabled → assets_detected}/README +0 -0
- data/spec/fixtures/repos/assets_detected/Rakefile +5 -0
- data/spec/fixtures/repos/{assets_enabled → assets_detected}/app/assets/empty +0 -0
- data/spec/fixtures/repos/{assets_enabled → assets_detected}/config/application.rb +0 -0
- data/spec/fixtures/repos/assets_detected/config/ey.yml +3 -0
- data/spec/fixtures/repos/assets_disabled/Gemfile +1 -2
- data/spec/fixtures/repos/assets_disabled/Gemfile.lock +1 -3
- data/spec/fixtures/repos/assets_disabled/Rakefile +1 -0
- data/spec/fixtures/repos/assets_disabled/config/ey.yml +3 -0
- data/spec/fixtures/repos/assets_disabled_in_ey_yml/Gemfile +1 -2
- data/spec/fixtures/repos/assets_disabled_in_ey_yml/Gemfile.lock +1 -3
- data/spec/fixtures/repos/assets_disabled_in_ey_yml/Rakefile +1 -0
- data/spec/fixtures/repos/assets_disabled_in_ey_yml/config/ey.yml +1 -0
- data/spec/fixtures/repos/assets_enabled_all/Gemfile +1 -2
- data/spec/fixtures/repos/assets_enabled_all/Gemfile.lock +1 -3
- data/spec/fixtures/repos/assets_enabled_all/Rakefile +1 -0
- data/spec/fixtures/repos/assets_enabled_all/config/ey.yml +1 -0
- data/spec/fixtures/repos/assets_enabled_in_ey_yml/Gemfile +1 -1
- data/spec/fixtures/repos/assets_enabled_in_ey_yml/Gemfile.lock +1 -1
- data/spec/fixtures/repos/assets_enabled_in_ey_yml/Rakefile +1 -0
- data/spec/fixtures/repos/assets_enabled_util_only/Gemfile +1 -2
- data/spec/fixtures/repos/assets_enabled_util_only/Gemfile.lock +1 -3
- data/spec/fixtures/repos/assets_enabled_util_only/Rakefile +1 -0
- data/spec/fixtures/repos/assets_enabled_util_only/config/ey.yml +1 -0
- data/spec/fixtures/repos/assets_in_hook/Gemfile +1 -2
- data/spec/fixtures/repos/assets_in_hook/Gemfile.lock +1 -3
- data/spec/fixtures/repos/assets_in_hook/config/ey.yml +3 -0
- data/spec/fixtures/repos/assets_in_hook/deploy/before_compile_assets.rb +1 -1
- data/spec/fixtures/repos/bundle_fails/Gemfile +1 -0
- data/spec/fixtures/repos/bundle_fails/README +1 -0
- data/spec/fixtures/repos/bundle_fails/deploy/after_bundle.rb +1 -0
- data/spec/fixtures/repos/default/Gemfile +1 -2
- data/spec/fixtures/repos/default/Gemfile.lock +1 -3
- data/spec/fixtures/repos/default/ey.yml +3 -0
- data/spec/fixtures/repos/ey_yml/Gemfile +1 -1
- data/spec/fixtures/repos/ey_yml/Gemfile.lock +1 -1
- data/spec/fixtures/repos/ey_yml/config/ey.yml +11 -7
- data/spec/fixtures/repos/ey_yml_alt/Gemfile +1 -1
- data/spec/fixtures/repos/ey_yml_alt/Gemfile.lock +1 -1
- data/spec/fixtures/repos/no_ey_config/Gemfile +1 -2
- data/spec/fixtures/repos/no_ey_config/Gemfile.lock +1 -3
- data/spec/fixtures/repos/no_ey_config/ey.yml +3 -0
- data/spec/fixtures/repos/no_gemfile_lock/Gemfile +1 -2
- data/spec/fixtures/repos/no_gemfile_lock/ey.yml +3 -0
- data/spec/fixtures/repos/sqlite3/Gemfile +1 -1
- data/spec/fixtures/repos/sqlite3/Gemfile.lock +1 -1
- data/spec/lockfile_parser_spec.rb +25 -11
- data/spec/rails31_deploy_spec.rb +46 -5
- data/spec/restart_spec.rb +3 -3
- data/spec/services_deploy_spec.rb +89 -86
- data/spec/shell_spec.rb +0 -8
- data/spec/spec_helper.rb +81 -36
- data/spec/sqlite3_deploy_spec.rb +4 -5
- data/spec/support/integration.rb +22 -37
- metadata +167 -154
- data/lib/engineyard-serverside/lockfile_parser.rb +0 -101
- data/lib/engineyard-serverside/rails_asset_support.rb +0 -132
- data/spec/fixtures/repos/assets_enabled/Rakefile +0 -5
@@ -0,0 +1 @@
|
|
1
|
+
This repo has a bad Gemfile in it and no remote sources.
|
@@ -0,0 +1 @@
|
|
1
|
+
run 'touch after_bundle.ran'
|
@@ -1,13 +1,17 @@
|
|
1
|
+
defaults:
|
2
|
+
copy_exclude:
|
3
|
+
- .git
|
4
|
+
- README
|
5
|
+
migrate: true
|
6
|
+
migration_command: 'uh oh'
|
7
|
+
bundle_without: only test development
|
8
|
+
maintenance_on_migrate: false
|
9
|
+
maintenance_on_restart: false
|
1
10
|
environments:
|
2
11
|
env:
|
3
|
-
copy_exclude:
|
4
|
-
- .git
|
5
|
-
- README
|
6
|
-
migrate: true
|
7
|
-
migration_command: 'uh oh'
|
8
12
|
branch: branch_from_ey_yml
|
9
13
|
custom: custom_from_ey_yml
|
10
14
|
bundle_without: only test
|
11
|
-
maintenance_on_migrate: false
|
12
|
-
maintenance_on_restart: false
|
13
15
|
ignore_database_adapter_warning: true
|
16
|
+
env_other:
|
17
|
+
bundle_without: only development
|
@@ -6,7 +6,7 @@ describe "the bundler version retrieved from the lockfile" do
|
|
6
6
|
end
|
7
7
|
|
8
8
|
def get_parser(file)
|
9
|
-
EY::Serverside::
|
9
|
+
EY::Serverside::DependencyManager::BundlerLock::Lockfile.new(load_lockfile(file))
|
10
10
|
end
|
11
11
|
|
12
12
|
def get_version(file)
|
@@ -19,12 +19,12 @@ describe "the bundler version retrieved from the lockfile" do
|
|
19
19
|
end
|
20
20
|
|
21
21
|
it "has a default version" do
|
22
|
-
EY::Serverside::
|
23
|
-
EY::Serverside::
|
22
|
+
EY::Serverside::DependencyManager::Bundler.default_version.should_not be_nil
|
23
|
+
EY::Serverside::DependencyManager::Bundler::DEFAULT_VERSION.should_not be_nil
|
24
24
|
end
|
25
25
|
|
26
26
|
it "returns the default version for a 1.0 lockfile without a bundler dependency" do
|
27
|
-
get_version('1.0-no-bundler').should == EY::Serverside::
|
27
|
+
get_version('1.0-no-bundler').should == EY::Serverside::DependencyManager::Bundler.default_version
|
28
28
|
end
|
29
29
|
|
30
30
|
it "gets the version from a 1.0.0.rc.1 lockfile w/dependency on 1.0.0.rc.1" do
|
@@ -47,6 +47,16 @@ describe "the bundler version retrieved from the lockfile" do
|
|
47
47
|
lambda { get_version('not-a-lockfile') }.should raise_error(RuntimeError, /Malformed or pre bundler-1.0.0 Gemfile.lock/)
|
48
48
|
end
|
49
49
|
|
50
|
+
context "rails version" do
|
51
|
+
it "retrieves rails version" do
|
52
|
+
get_parser('1.3.1-rails-3.2.13').rails_version.should == "3.2.13"
|
53
|
+
end
|
54
|
+
|
55
|
+
it "finds no rails version" do
|
56
|
+
get_parser('1.0.18-mysql2').rails_version.should == nil
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
50
60
|
context "checking for gems in the dependencies" do
|
51
61
|
it "does not have any database adapters in a gemfile lock without them" do
|
52
62
|
get_parser('1.0.6-no-bundler').any_database_adapter?.should be_false
|
@@ -77,31 +87,35 @@ describe "the bundler version retrieved from the lockfile" do
|
|
77
87
|
subject { get_parser('1.0.6-no-bundler') }
|
78
88
|
|
79
89
|
it "uses the default version when there is no bundler version" do
|
80
|
-
subject.fetch_version(nil, nil).should == EY::Serverside::
|
90
|
+
subject.fetch_version(nil, nil).should == EY::Serverside::DependencyManager::Bundler.default_version
|
91
|
+
end
|
92
|
+
|
93
|
+
it "uses the given version when there is no operator" do
|
94
|
+
subject.fetch_version(nil, '1.0.1').should == '1.0.1'
|
81
95
|
end
|
82
96
|
|
83
97
|
it "uses the given version when the qualifier is `='" do
|
84
|
-
subject.fetch_version('1.0.1'
|
98
|
+
subject.fetch_version('=', '1.0.1').should == '1.0.1'
|
85
99
|
end
|
86
100
|
|
87
101
|
it "uses the default version when we get a pessimistic qualifier and is lower than the default version" do
|
88
|
-
subject.fetch_version('1.
|
102
|
+
subject.fetch_version('~>', '1.3.1').should == EY::Serverside::DependencyManager::Bundler.default_version
|
89
103
|
end
|
90
104
|
|
91
105
|
it "uses the given version when we get a pessimistic qualifier that doesn't match the default version" do
|
92
|
-
subject.fetch_version('1.0.0'
|
106
|
+
subject.fetch_version('~>', '1.0.0').should == '1.0.0'
|
93
107
|
end
|
94
108
|
|
95
109
|
it "uses the given version when it's geater of equal than the default version" do
|
96
|
-
subject.fetch_version('1.
|
110
|
+
subject.fetch_version('>=', '1.100.0').should == '1.100.0'
|
97
111
|
end
|
98
112
|
|
99
113
|
it "uses the default version when the given version is lower" do
|
100
|
-
subject.fetch_version('1.0.1'
|
114
|
+
subject.fetch_version('>=', '1.0.1').should == EY::Serverside::DependencyManager::Bundler.default_version
|
101
115
|
end
|
102
116
|
|
103
117
|
it "selects only the first version expression" do
|
104
|
-
scan = subject.
|
118
|
+
scan = subject.scan_gem('bundler', 'bundler (>=1.0.1, <2.0.0)')
|
105
119
|
scan.last.should == '1.0.1'
|
106
120
|
end
|
107
121
|
end
|
data/spec/rails31_deploy_spec.rb
CHANGED
@@ -2,12 +2,46 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe "Deploying a Rails 3.1 application" do
|
4
4
|
context "with default production settings" do
|
5
|
-
|
6
|
-
deploy_test_application('
|
5
|
+
it "precompiles assets when asset compilation is detected" do
|
6
|
+
deploy_test_application('assets_detected')
|
7
|
+
deploy_dir.join('current', 'precompiled').should exist
|
8
|
+
deploy_dir.join('current', 'public', 'assets').should exist
|
9
|
+
deploy_dir.join('current', 'public', 'assets', 'compiled_asset').should exist
|
10
|
+
read_output.should include("Precompiling assets. ('app/assets' exists, 'public/assets' not found, not disabled in config.)")
|
7
11
|
end
|
8
12
|
|
9
|
-
it "precompiles assets" do
|
13
|
+
it "precompiles assets, then reuses them on the next deploy if nothing has changed" do
|
14
|
+
deploy_test_application('assets_enabled_in_ey_yml')
|
10
15
|
deploy_dir.join('current', 'precompiled').should exist
|
16
|
+
deploy_dir.join('current', 'public', 'assets').should exist
|
17
|
+
deploy_dir.join('current', 'public', 'assets', 'compiled_asset').should exist
|
18
|
+
|
19
|
+
redeploy_test_application
|
20
|
+
deploy_dir.join('current', 'precompiled').should_not exist # doesn't run the task
|
21
|
+
deploy_dir.join('current', 'public', 'assets').should exist # but the assets are there
|
22
|
+
deploy_dir.join('current', 'public', 'assets', 'compiled_asset').should exist
|
23
|
+
read_output.should =~ %r#Reusing existing assets\. \(configured asset_dependencies unchanged from \w{7}..\w{7}\)#
|
24
|
+
|
25
|
+
redeploy_test_application('config' => {'precompile_unchanged_assets' => 'true'})
|
26
|
+
deploy_dir.join('current', 'precompiled').should exist # doesn't run the task
|
27
|
+
deploy_dir.join('current', 'public', 'assets').should exist # but the assets are there
|
28
|
+
deploy_dir.join('current', 'public', 'assets', 'compiled_asset').should exist
|
29
|
+
read_output.should_not include("Reusing existing assets")
|
30
|
+
end
|
31
|
+
|
32
|
+
it "precompile assets again when redeploying a ref with changes" do
|
33
|
+
deploy_test_application('assets_enabled_in_ey_yml')
|
34
|
+
deploy_dir.join('current', 'precompiled').should exist
|
35
|
+
deploy_dir.join('current', 'public', 'assets').should exist
|
36
|
+
deploy_dir.join('current', 'public', 'assets', 'compiled_asset').should exist
|
37
|
+
read_output.should include("Precompiling assets. (precompile_assets: true)")
|
38
|
+
|
39
|
+
# changing the ref stands in for actually having assets change (see Strategies::IntegrationSpec#same?)
|
40
|
+
redeploy_test_application('branch' => 'somenewref')
|
41
|
+
deploy_dir.join('current', 'precompiled').should exist # it does runs the task
|
42
|
+
deploy_dir.join('current', 'public', 'assets').should exist
|
43
|
+
deploy_dir.join('current', 'public', 'assets', 'compiled_asset').should exist
|
44
|
+
read_output.should_not =~ %r#Reusing existing assets#
|
11
45
|
end
|
12
46
|
end
|
13
47
|
|
@@ -18,6 +52,7 @@ describe "Deploying a Rails 3.1 application" do
|
|
18
52
|
|
19
53
|
it "precompiles assets" do
|
20
54
|
deploy_dir.join('current', 'precompiled').should exist
|
55
|
+
read_output.should include("Precompiling assets. (precompile_assets: true)")
|
21
56
|
end
|
22
57
|
end
|
23
58
|
|
@@ -28,6 +63,7 @@ describe "Deploying a Rails 3.1 application" do
|
|
28
63
|
|
29
64
|
it "precompiles assets" do
|
30
65
|
deploy_dir.join('current', 'precompiled').should_not exist
|
66
|
+
read_output.should include("Precompiling assets. (precompile_assets: true)")
|
31
67
|
end
|
32
68
|
end
|
33
69
|
|
@@ -38,16 +74,18 @@ describe "Deploying a Rails 3.1 application" do
|
|
38
74
|
|
39
75
|
it "precompiles assets" do
|
40
76
|
deploy_dir.join('current', 'precompiled').should exist
|
77
|
+
read_output.should include("Precompiling assets. (precompile_assets: true)")
|
41
78
|
end
|
42
79
|
end
|
43
80
|
|
44
|
-
context "with asset support disabled in
|
81
|
+
context "with asset support disabled in config/application.rb" do
|
45
82
|
before(:all) do
|
46
83
|
deploy_test_application('assets_disabled')
|
47
84
|
end
|
48
85
|
|
49
86
|
it "does not precompile assets" do
|
50
87
|
deploy_dir.join('current', 'precompiled').should_not exist
|
88
|
+
read_output.should include("Skipping asset precompilation. ('config/application.rb' disables assets.)")
|
51
89
|
end
|
52
90
|
end
|
53
91
|
|
@@ -56,8 +94,9 @@ describe "Deploying a Rails 3.1 application" do
|
|
56
94
|
deploy_test_application('assets_disabled_in_ey_yml')
|
57
95
|
end
|
58
96
|
|
59
|
-
it "
|
97
|
+
it "does not precompile assets" do
|
60
98
|
deploy_dir.join('current', 'precompiled').should_not exist
|
99
|
+
read_output.should include("Skipping asset precompilation. (precompile_assets: false)")
|
61
100
|
end
|
62
101
|
end
|
63
102
|
|
@@ -71,6 +110,8 @@ describe "Deploying a Rails 3.1 application" do
|
|
71
110
|
deploy_dir.join('current', 'precompiled').should_not exist
|
72
111
|
deploy_dir.join('current', 'public', 'assets').should be_directory
|
73
112
|
deploy_dir.join('current', 'public', 'assets').should_not be_symlink
|
113
|
+
deploy_dir.join('current', 'public', 'assets', 'custom_compiled_asset').should exist
|
114
|
+
read_output.should include("Skipping asset precompilation. ('public/assets' directory already exists.)")
|
74
115
|
end
|
75
116
|
end
|
76
117
|
end
|
data/spec/restart_spec.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
class TestRestartDeploy <
|
3
|
+
class TestRestartDeploy < FullTestDeploy
|
4
4
|
attr_reader :call_order
|
5
5
|
def initialize(*a)
|
6
6
|
super
|
@@ -21,7 +21,7 @@ describe "EY::Serverside::Deploy#restart_with_maintenance_page" do
|
|
21
21
|
|
22
22
|
it "puts up the maintenance page if necessary, restarts, and takes down the maintenance page" do
|
23
23
|
config = EY::Serverside::Deploy::Configuration.new('deploy_to' => deploy_dir, 'app' => 'app_name')
|
24
|
-
deployer = TestRestartWithMaintenancePage.
|
24
|
+
deployer = TestRestartWithMaintenancePage.realnew(test_servers, config, test_shell)
|
25
25
|
deployer.restart_with_maintenance_page
|
26
26
|
deployer.call_order.should == %w(
|
27
27
|
require_custom_tasks
|
@@ -36,7 +36,7 @@ describe "glassfish stack" do
|
|
36
36
|
|
37
37
|
it "requires a maintenance page" do
|
38
38
|
config = EY::Serverside::Deploy::Configuration.new('deploy_to' => deploy_dir, 'app' => 'app_name', 'stack' => 'glassfish')
|
39
|
-
deployer = TestRestartDeploy.
|
39
|
+
deployer = TestRestartDeploy.realnew(test_servers, config, test_shell)
|
40
40
|
deployer.restart_with_maintenance_page
|
41
41
|
deployer.call_order.should include('enable_maintenance_page')
|
42
42
|
end
|
@@ -1,14 +1,16 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe "Deploying an application with services" do
|
4
|
-
|
4
|
+
let(:shared_services_file) { deploy_dir.join('shared', 'config', 'ey_services_config_deploy.yml') }
|
5
|
+
let(:symlinked_services_file) { deploy_dir.join('current', 'config', 'ey_services_config_deploy.yml') }
|
6
|
+
let(:services_yml) { {"servicio" => {"foo" => "bar"}}.to_yaml }
|
7
|
+
|
8
|
+
describe "without ey_config" do
|
5
9
|
describe "with services" do
|
6
10
|
before do
|
7
|
-
deploy_test_application('no_ey_config'
|
8
|
-
|
9
|
-
|
10
|
-
deployer.mock_services_setup!("echo '#{@services_yml}' > #{@shared_services_file}")
|
11
|
-
end
|
11
|
+
deploy_test_application('no_ey_config', 'config' => {
|
12
|
+
'services_setup_command' => "echo '#{services_yml}' > #{shared_services_file}"
|
13
|
+
})
|
12
14
|
end
|
13
15
|
|
14
16
|
it "warns about missing ey_config" do
|
@@ -29,22 +31,20 @@ describe "Deploying an application with services" do
|
|
29
31
|
|
30
32
|
describe "deploy with invalid yaml ey_services_config_deploy" do
|
31
33
|
before do
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
deployer.mock_services_setup!("echo '#{@invalid_services_yml}' > #{@shared_services_file}")
|
37
|
-
end
|
34
|
+
@invalid_services_yml = "42"
|
35
|
+
deploy_test_application('default', 'config' => {
|
36
|
+
'services_setup_command' => "echo '#{@invalid_services_yml}' > #{shared_services_file}"
|
37
|
+
})
|
38
38
|
end
|
39
39
|
|
40
40
|
it "works without warning" do
|
41
|
-
|
42
|
-
|
43
|
-
|
41
|
+
shared_services_file.should exist
|
42
|
+
shared_services_file.should_not be_symlink
|
43
|
+
shared_services_file.read.should == "#{@invalid_services_yml}\n"
|
44
44
|
|
45
|
-
|
46
|
-
|
47
|
-
|
45
|
+
symlinked_services_file.should exist
|
46
|
+
symlinked_services_file.should be_symlink
|
47
|
+
shared_services_file.read.should == "#{@invalid_services_yml}\n"
|
48
48
|
|
49
49
|
read_output.should_not =~ /WARNING/
|
50
50
|
end
|
@@ -52,99 +52,102 @@ describe "Deploying an application with services" do
|
|
52
52
|
|
53
53
|
describe "a succesful deploy" do
|
54
54
|
before do
|
55
|
-
deploy_test_application
|
56
|
-
|
57
|
-
|
58
|
-
@services_yml = {"servicio" => {"foo" => "bar"}}.to_yaml
|
59
|
-
|
60
|
-
deployer.mock_services_setup!("echo '#{@services_yml}' > #{@shared_services_file}")
|
61
|
-
end
|
55
|
+
deploy_test_application('default', 'config' => {
|
56
|
+
'services_setup_command' => "echo '#{services_yml}' > #{shared_services_file}"
|
57
|
+
})
|
62
58
|
end
|
63
59
|
|
64
60
|
it "creates and symlinks ey_services_config_deploy.yml" do
|
65
|
-
|
66
|
-
|
67
|
-
|
61
|
+
shared_services_file.should exist
|
62
|
+
shared_services_file.should_not be_symlink
|
63
|
+
shared_services_file.read.should == "#{services_yml}\n"
|
68
64
|
|
69
|
-
|
70
|
-
|
71
|
-
|
65
|
+
symlinked_services_file.should exist
|
66
|
+
symlinked_services_file.should be_symlink
|
67
|
+
shared_services_file.read.should == "#{services_yml}\n"
|
72
68
|
|
73
69
|
read_output.should_not =~ /WARNING/
|
74
70
|
end
|
71
|
+
end
|
75
72
|
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
@shared_services_file.should_not be_symlink
|
86
|
-
@shared_services_file.read.should == "#{@services_yml}\n"
|
73
|
+
describe "a successful deploy followed by a deploy that can't find the command" do
|
74
|
+
before do
|
75
|
+
deploy_test_application('default', 'config' => {
|
76
|
+
'services_setup_command' => "echo '#{services_yml}' > #{shared_services_file}"
|
77
|
+
})
|
78
|
+
redeploy_test_application('config' => {
|
79
|
+
'services_check_command' => 'false'
|
80
|
+
})
|
81
|
+
end
|
87
82
|
|
88
|
-
|
89
|
-
|
90
|
-
|
83
|
+
it "silently fails" do
|
84
|
+
shared_services_file.should exist
|
85
|
+
shared_services_file.should_not be_symlink
|
86
|
+
shared_services_file.read.should == "#{services_yml}\n"
|
91
87
|
|
92
|
-
|
93
|
-
|
88
|
+
symlinked_services_file.should exist
|
89
|
+
symlinked_services_file.should be_symlink
|
90
|
+
shared_services_file.read.should == "#{services_yml}\n"
|
94
91
|
|
92
|
+
read_output.should_not =~ /WARNING/
|
95
93
|
end
|
96
94
|
|
97
|
-
|
98
|
-
it "logs a warning and symlinks the existing config file when there is existing services file" do
|
99
|
-
redeploy_test_application do |deployer|
|
100
|
-
deployer.mock_services_setup!("notarealcommandsoitwillexitnonzero")
|
101
|
-
end
|
102
|
-
@shared_services_file.should exist
|
103
|
-
@shared_services_file.should_not be_symlink
|
104
|
-
@shared_services_file.read.should == "#{@services_yml}\n"
|
95
|
+
end
|
105
96
|
|
106
|
-
|
107
|
-
|
108
|
-
|
97
|
+
describe "a successful followed by a deploy that fails to fetch services" do
|
98
|
+
it "logs a warning and symlinks the existing config file when there is existing services file" do
|
99
|
+
deploy_test_application('default', 'config' => {
|
100
|
+
'services_setup_command' => "echo '#{services_yml}' > #{shared_services_file}"
|
101
|
+
})
|
102
|
+
redeploy_test_application('config' => {'services_setup_command' => 'false'})
|
109
103
|
|
110
|
-
|
111
|
-
|
104
|
+
shared_services_file.should exist
|
105
|
+
shared_services_file.should_not be_symlink
|
106
|
+
shared_services_file.read.should == "#{services_yml}\n"
|
112
107
|
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
@shared_services_file.delete
|
117
|
-
end
|
108
|
+
symlinked_services_file.should exist
|
109
|
+
symlinked_services_file.should be_symlink
|
110
|
+
shared_services_file.read.should == "#{services_yml}\n"
|
118
111
|
|
119
|
-
|
120
|
-
|
112
|
+
read_output.should include('WARNING: External services configuration not updated')
|
113
|
+
end
|
121
114
|
|
122
|
-
|
123
|
-
|
115
|
+
it "does not log a warning or symlink a config file when there is no existing services file" do
|
116
|
+
deploy_test_application('default', 'config' => {
|
117
|
+
'services_setup_command' => "echo '#{services_yml}' > #{shared_services_file}"
|
118
|
+
})
|
119
|
+
shared_services_file.delete
|
120
|
+
redeploy_test_application('config' => {'services_setup_command' => 'false'})
|
121
|
+
|
122
|
+
shared_services_file.should_not exist
|
123
|
+
symlinked_services_file.should_not exist
|
124
124
|
|
125
|
+
read_output.should_not =~ /WARNING/
|
125
126
|
end
|
127
|
+
end
|
126
128
|
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
129
|
+
describe "a successful deploy followed by another successfull deploy" do
|
130
|
+
before do
|
131
|
+
deploy_test_application('default', 'config' => {
|
132
|
+
'services_setup_command' => "echo '#{services_yml}' > #{shared_services_file}"
|
133
|
+
})
|
134
|
+
@new_services_yml = {"servicio" => {"foo" => "bar2"}}.to_yaml
|
135
|
+
redeploy_test_application('config' => {
|
136
|
+
'services_setup_command' => "echo '#{@new_services_yml}' > #{shared_services_file}"
|
137
|
+
})
|
138
|
+
end
|
134
139
|
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
140
|
+
it "replaces the config with the new one (and symlinks)" do
|
141
|
+
shared_services_file.should exist
|
142
|
+
shared_services_file.should_not be_symlink
|
143
|
+
shared_services_file.read.should == "#{@new_services_yml}\n"
|
139
144
|
|
140
|
-
|
141
|
-
|
142
|
-
|
145
|
+
symlinked_services_file.should exist
|
146
|
+
symlinked_services_file.should be_symlink
|
147
|
+
shared_services_file.read.should == "#{@new_services_yml}\n"
|
143
148
|
|
144
|
-
|
145
|
-
end
|
149
|
+
read_output.should_not =~ /WARNING/
|
146
150
|
end
|
147
|
-
|
148
151
|
end
|
149
152
|
|
150
153
|
end
|