tdd_deploy 0.1.8 → 0.1.9
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/tdd_deploy/deploy_test_methods.rb +1 -0
- data/lib/tdd_deploy/environ.rb +3 -2
- data/lib/tdd_deploy/server.rb +2 -2
- data/lib/tdd_deploy/site_tests/site_layout.rb +10 -6
- data/lib/tdd_deploy/version.rb +1 -1
- data/tests/test_helpers.rb +3 -0
- data/tests/test_server.rb +8 -2
- data/tests/test_site_layout.rb +11 -5
- data/tests/test_test_base.rb +1 -1
- metadata +13 -13
@@ -29,6 +29,7 @@ module TddDeploy
|
|
29
29
|
end
|
30
30
|
|
31
31
|
def deploy_test_file_exists_on_hosts_as(userid, host_list, path, success_msg = nil)
|
32
|
+
host_list = rationalize_host_list(host_list)
|
32
33
|
deploy_test_on_hosts_as(userid, host_list, /^\s*success\s*$/, success_msg || "path #{path} should exist") do
|
33
34
|
"test -s #{path} && echo success || echo fail"
|
34
35
|
end
|
data/lib/tdd_deploy/environ.rb
CHANGED
@@ -393,7 +393,8 @@ module TddDeploy
|
|
393
393
|
self.capfile.migration_host_list
|
394
394
|
end
|
395
395
|
|
396
|
-
# takes the name of a list (as a string or symbol), a single string, or an array of host names
|
396
|
+
# takes the name of a list (as a string or symbol), a single string, or an array of host names.
|
397
|
+
# If it's an array, then returns uniq-ified array of strings [to handle the uniion of lists]
|
397
398
|
def rationalize_host_list(host_list_or_list_name)
|
398
399
|
if host_list_or_list_name.is_a? String
|
399
400
|
return self.respond_to?(host_list_or_list_name.to_sym) ? self.send(host_list_or_list_name.to_sym) :
|
@@ -402,7 +403,7 @@ module TddDeploy
|
|
402
403
|
return self.respond_to?(host_list_or_list_name) ? self.send(host_list_or_list_name) :
|
403
404
|
[host_list_or_list_name.to_s]
|
404
405
|
elsif host_list_or_list_name.is_a? Array
|
405
|
-
return host_list_or_list_name.map { |host| host.to_s }
|
406
|
+
return host_list_or_list_name.map { |host| host.to_s }.uniq
|
406
407
|
else
|
407
408
|
raise ArgumentError.new("rationalize_host_list(#{host_list_or_list_name.inspect}) is invalid")
|
408
409
|
end
|
data/lib/tdd_deploy/server.rb
CHANGED
@@ -71,7 +71,7 @@ module TddDeploy
|
|
71
71
|
[:app_hosts, :balance_hosts, :db_hosts, :web_hosts].each do |host_list|
|
72
72
|
installer.install_special_files_on_host_list_as self.site_user, host_list
|
73
73
|
end
|
74
|
-
query_hash['failed-tests'] =
|
74
|
+
query_hash['failed-tests'] = failed_tests.join(',')
|
75
75
|
end
|
76
76
|
|
77
77
|
if self.query_hash['install_configs']
|
@@ -80,7 +80,7 @@ module TddDeploy
|
|
80
80
|
[:app_hosts, :balance_hosts, :db_hosts, :web_hosts].each do |host_list|
|
81
81
|
installer.install_config_files_on_host_list_as self.site_user, host_list
|
82
82
|
end
|
83
|
-
query_hash['failed-tests'] =
|
83
|
+
query_hash['failed-tests'] = failed_tests.join(',')
|
84
84
|
end
|
85
85
|
|
86
86
|
if self.query_hash['run_cap_deploy']
|
@@ -17,23 +17,27 @@ module TddDeploy
|
|
17
17
|
# * ~/site/one_thin_server - shell script to start a single server instance
|
18
18
|
class SiteLayout < TddDeploy::TestBase
|
19
19
|
def test_site_subdir
|
20
|
-
deploy_test_file_exists_on_hosts_as self.site_user, self.
|
20
|
+
deploy_test_file_exists_on_hosts_as self.site_user, self.app_hosts, "#{self.site_doc_root}"
|
21
21
|
end
|
22
22
|
|
23
23
|
def test_releases_subdir
|
24
|
-
deploy_test_file_exists_on_hosts_as self.site_user, self.
|
24
|
+
deploy_test_file_exists_on_hosts_as self.site_user, self.app_hosts, "#{self.site_doc_root}/../../../releases"
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_special_dir
|
28
|
+
deploy_test_file_exists_on_hosts_as self.site_user, self.hosts, self.site_special_dir
|
25
29
|
end
|
26
30
|
|
27
31
|
def test_thin_conf
|
28
|
-
deploy_test_file_exists_on_hosts_as self.site_user, self.
|
32
|
+
deploy_test_file_exists_on_hosts_as self.site_user, self.app_hosts, "#{site_doc_root}/../config/thin.conf"
|
29
33
|
end
|
30
34
|
|
31
35
|
def test_one_thin_server_conf
|
32
|
-
deploy_test_file_exists_on_hosts_as self.site_user, self.
|
36
|
+
deploy_test_file_exists_on_hosts_as self.site_user, self.app_hosts, "#{site_doc_root}/../config/one_thin_server.conf"
|
33
37
|
end
|
34
38
|
|
35
39
|
def test_site_dir_exists
|
36
|
-
deploy_test_file_exists_on_hosts_as self.site_user, self.
|
40
|
+
deploy_test_file_exists_on_hosts_as self.site_user, self.app_hosts, "#{site_special_dir}"
|
37
41
|
end
|
38
42
|
|
39
43
|
def test_monitrc
|
@@ -45,7 +49,7 @@ module TddDeploy
|
|
45
49
|
end
|
46
50
|
|
47
51
|
def test_one_thin_server
|
48
|
-
deploy_test_file_exists_on_hosts_as self.site_user, self.
|
52
|
+
deploy_test_file_exists_on_hosts_as self.site_user, self.app_hosts, "#{site_special_dir}/one_thin_server"
|
49
53
|
end
|
50
54
|
end
|
51
55
|
end
|
data/lib/tdd_deploy/version.rb
CHANGED
data/tests/test_helpers.rb
CHANGED
data/tests/test_server.rb
CHANGED
@@ -10,7 +10,7 @@ class TestServerTestCase < Test::Unit::TestCase
|
|
10
10
|
BIN_DIR = File.join(GEM_ROOT, 'bin')
|
11
11
|
|
12
12
|
include TddDeploy::Environ
|
13
|
-
|
13
|
+
|
14
14
|
def setup
|
15
15
|
# we can't create a server w/o an environment, but we flush it between tests.
|
16
16
|
# so we have to create the enviornment file here
|
@@ -20,14 +20,20 @@ class TestServerTestCase < Test::Unit::TestCase
|
|
20
20
|
@tester = TddDeploy::Server.new
|
21
21
|
@tester.set_env(:web_hosts => 'arch', :db_hosts => 'arch',
|
22
22
|
:host_admin => 'mike', :local_admin => 'mike', :ssh_timeout => 2,
|
23
|
-
:site => 'site', :site_user => 'site_user')
|
23
|
+
:site => 'site', :site_user => 'site_user', :site_special_dir => 'non-special-special-dir')
|
24
24
|
@tester.save_env
|
25
|
+
@tester.run_on_a_host_as 'site_user', 'arch', "mkdir #{@tester.site_special_dir}"
|
26
|
+
['monitrc', 'one_thin_server', 'nginx.conf'].each do |fname|
|
27
|
+
@tester.run_on_a_host_as 'site_user', 'arch', "echo '# #{fname}' >#{@tester.site_special_dir}/#{fname}"
|
28
|
+
end
|
25
29
|
end
|
26
30
|
|
27
31
|
def teardown
|
28
32
|
system('rm -f site_host_setup.env')
|
29
33
|
TddDeploy::TestBase.flush_children_methods
|
30
34
|
@tester.load_all_tests
|
35
|
+
@tester.run_on_a_host_as 'site_user', 'arch', "rm #{@tester.site_special_dir}/*"
|
36
|
+
@tester.run_on_a_host_as 'site_user', 'arch', "rmdir #{@tester.site_special_dir}"
|
31
37
|
@tester = nil
|
32
38
|
end
|
33
39
|
|
data/tests/test_site_layout.rb
CHANGED
@@ -6,20 +6,26 @@ class TestSiteLayoutTestCase < Test::Unit::TestCase
|
|
6
6
|
def setup
|
7
7
|
@tester = TddDeploy::SiteLayout.new
|
8
8
|
@tester.reset_env
|
9
|
-
@tester.set_env :hosts => 'arch'
|
9
|
+
@tester.set_env :hosts => 'arch', :site_special_dir => 'non-special-special-dir'
|
10
10
|
@tester.reset_tests
|
11
|
+
@tester.run_on_a_host_as 'site_user', 'arch', "mkdir #{@tester.site_special_dir}"
|
12
|
+
['monitrc', 'one_thin_server', 'nginx.conf'].each do |fname|
|
13
|
+
@tester.run_on_a_host_as 'site_user', 'arch', "echo '# #{fname}' >#{@tester.site_special_dir}/#{fname}"
|
14
|
+
end
|
11
15
|
end
|
12
16
|
|
13
17
|
def teardown
|
18
|
+
@tester.run_on_a_host_as 'site_user', 'arch', "rm #{@tester.site_special_dir}/*"
|
19
|
+
@tester.run_on_a_host_as 'site_user', 'arch', "rmdir #{@tester.site_special_dir}"
|
14
20
|
@tester = nil
|
15
21
|
end
|
16
22
|
|
17
23
|
def test_site_home
|
18
|
-
assert @tester.test_site_subdir, "Directory
|
24
|
+
assert @tester.test_site_subdir, "Directory #{@tester.site_doc_root} should exist"
|
19
25
|
end
|
20
26
|
|
21
27
|
def test_site_releases
|
22
|
-
assert @tester.test_releases_subdir, "Directory
|
28
|
+
assert @tester.test_releases_subdir, "Directory #{@tester.site_doc_root}/../../releases should exist"
|
23
29
|
end
|
24
30
|
|
25
31
|
def test_site_configuration_dir_exists
|
@@ -27,11 +33,11 @@ class TestSiteLayoutTestCase < Test::Unit::TestCase
|
|
27
33
|
end
|
28
34
|
|
29
35
|
def test_site_nginx_conf
|
30
|
-
assert @tester.test_nginx_conf, "Directory
|
36
|
+
assert @tester.test_nginx_conf, "Directory #{@tester.site_special_dir}/nginx.conf should exist"
|
31
37
|
end
|
32
38
|
|
33
39
|
def test_site_monitrc
|
34
|
-
assert @tester.test_monitrc, "Directory
|
40
|
+
assert @tester.test_monitrc, "Directory #{@tester.site_special_dir}/monitrc should exist"
|
35
41
|
end
|
36
42
|
|
37
43
|
def test_test_thin_conf
|
data/tests/test_test_base.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tdd_deploy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.9
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2011-08-16 00:00:00.000000000Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: capistrano
|
16
|
-
requirement: &
|
16
|
+
requirement: &2164802500 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *2164802500
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: net-ping
|
27
|
-
requirement: &
|
27
|
+
requirement: &2164801880 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *2164801880
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: net-ssh
|
38
|
-
requirement: &
|
38
|
+
requirement: &2164801380 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *2164801380
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: rack
|
49
|
-
requirement: &
|
49
|
+
requirement: &2164800800 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: '0'
|
55
55
|
type: :runtime
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *2164800800
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: ZenTest
|
60
|
-
requirement: &
|
60
|
+
requirement: &2164800220 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ~>
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: 4.5.0
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *2164800220
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: autotest-growl
|
71
|
-
requirement: &
|
71
|
+
requirement: &2164799700 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ! '>='
|
@@ -76,7 +76,7 @@ dependencies:
|
|
76
76
|
version: '0'
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *2164799700
|
80
80
|
description: Test driven support for host provisioning & Capistrano deployment - for
|
81
81
|
those who don't want to bother learning too much
|
82
82
|
email: ! ' mike@clove.com '
|