virtualmonkey 0.0.1
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/.document +5 -0
- data/LICENSE +20 -0
- data/README.rdoc +77 -0
- data/Rakefile +51 -0
- data/VERSION +1 -0
- data/bin/grinder +102 -0
- data/bin/mcicp +46 -0
- data/bin/monkey +12 -0
- data/bin/vary_instance_types +59 -0
- data/config/cloud_variables/all_clouds.json +30 -0
- data/config/cloud_variables/east.json +9 -0
- data/config/cloud_variables/rackspace.json +7 -0
- data/config/cloud_variables/west.json +9 -0
- data/config/common_inputs/apache_haproxy.json +27 -0
- data/config/common_inputs/base.json +5 -0
- data/config/common_inputs/ebs_toolbox.json +10 -0
- data/config/common_inputs/haproxy.json +15 -0
- data/config/common_inputs/lamp.json +30 -0
- data/config/common_inputs/mysql.json +24 -0
- data/config/common_inputs/none.json +4 -0
- data/config/common_inputs/php.json +25 -0
- data/config/common_inputs/php_aio_trial_chef_alpha.json +3 -0
- data/config/common_inputs/php_app_fe_chef.json +12 -0
- data/config/common_inputs/php_elb.json +12 -0
- data/config/common_inputs/qstart.json +5 -0
- data/config/common_inputs/rails.json +31 -0
- data/config/common_inputs/rails_aio_demo_chef_alpha.json +3 -0
- data/config/common_inputs/rails_aio_developer_chef_alpha.json +10 -0
- data/config/common_inputs/rsgrid.json +10 -0
- data/config/common_inputs/tomcat.json +15 -0
- data/config/common_inputs/windows_blog_engine.json +3 -0
- data/config/common_inputs/windows_net_aio.json +14 -0
- data/config/troop/11H1/backup/base.json +10 -0
- data/config/troop/11H1/backup/lamp_mysql_50.json +10 -0
- data/config/troop/11H1/backup/lamp_mysql_51.json +10 -0
- data/config/troop/11H1/backup/loadbalancer-php.json +13 -0
- data/config/troop/11H1/backup/loadbalancer.json +14 -0
- data/config/troop/11H1/backup/loadbalancer_rails.json +13 -0
- data/config/troop/11H1/backup/loadbalancer_tomcat6.json +13 -0
- data/config/troop/11H1/backup/mysql50.json +11 -0
- data/config/troop/11H1/backup/mysql50_toolbox.json +12 -0
- data/config/troop/11H1/backup/mysql51.json +11 -0
- data/config/troop/11H1/backup/mysql51_toolbox.json +12 -0
- data/config/troop/11H1/backup/php_elb.json +11 -0
- data/config/troop/11H1/base.json +10 -0
- data/config/troop/11H1/ebs_toolbox.json +12 -0
- data/config/troop/11H1/lamp_mysql_50.json +10 -0
- data/config/troop/11H1/lamp_mysql_51.json +10 -0
- data/config/troop/11H1/loadbalancer-php.json +13 -0
- data/config/troop/11H1/loadbalancer.json +17 -0
- data/config/troop/11H1/loadbalancer_rails.json +13 -0
- data/config/troop/11H1/loadbalancer_tomcat6.json +13 -0
- data/config/troop/11H1/mysql50.json +11 -0
- data/config/troop/11H1/mysql50_toolbox.json +12 -0
- data/config/troop/11H1/mysql51.json +11 -0
- data/config/troop/11H1/mysql51_awsdns.json +11 -0
- data/config/troop/11H1/mysql51_debug.json +11 -0
- data/config/troop/11H1/mysql51_toolbox.json +12 -0
- data/config/troop/11H1/php.json +13 -0
- data/config/troop/11H1/php_elb.json +11 -0
- data/config/troop/11H1/rails.json +13 -0
- data/config/troop/11H1/tomcat6.json +13 -0
- data/config/troop/chef_quickstart.json +10 -0
- data/config/troop/just_elb +10 -0
- data/config/troop/lamp_v4.json +10 -0
- data/config/troop/patch_test.json +10 -0
- data/config/troop/rightlink.json +10 -0
- data/config/troop/simple_fail.json +11 -0
- data/config/troop/simple_pass.json +11 -0
- data/config/troop/windows_blog_engine.json +10 -0
- data/config/troop/windows_net_aio.json +10 -0
- data/config/troop/windows_quick_start.json +10 -0
- data/features/base.rb +31 -0
- data/features/db_toolbox.rb +59 -0
- data/features/ebs_toolbox.rb +62 -0
- data/features/lamp.rb +33 -0
- data/features/lb-apache-haproxy.rb +49 -0
- data/features/mysql_5.x_v2_v4_from_scratch.rb +71 -0
- data/features/mysql_5.x_v2_v4_from_scratch_awsdns.rb +71 -0
- data/features/mysql_5.x_v2_v4_from_scratch_dyndns.rb +71 -0
- data/features/mysql_v1_upgrade_v2.rb +54 -0
- data/features/old_cuke_features/Rakefile +121 -0
- data/features/old_cuke_features/Steps-TODO +31 -0
- data/features/old_cuke_features/app_state.feature +25 -0
- data/features/old_cuke_features/app_test.feature +24 -0
- data/features/old_cuke_features/base.feature +16 -0
- data/features/old_cuke_features/chef_quickstart.feature +11 -0
- data/features/old_cuke_features/db_toolbox.feature +38 -0
- data/features/old_cuke_features/ebs_toolbox.feature +39 -0
- data/features/old_cuke_features/elb_create_delete.feature +41 -0
- data/features/old_cuke_features/elb_generic.feature +27 -0
- data/features/old_cuke_features/fe_app_checks.feature +21 -0
- data/features/old_cuke_features/just-start.feature +13 -0
- data/features/old_cuke_features/lamp.feature +15 -0
- data/features/old_cuke_features/lb-apache-haproxy.feature +27 -0
- data/features/old_cuke_features/mysql_5.x_v2_v4_from_scratch.feature +33 -0
- data/features/old_cuke_features/mysql_5.x_v2_v4_from_scratch_awsdns.feature +33 -0
- data/features/old_cuke_features/mysql_5.x_v2_v4_from_scratch_dyndns.feature +33 -0
- data/features/old_cuke_features/mysql_chef_premium.feature +27 -0
- data/features/old_cuke_features/mysql_chef_premium_from_scratch.feature +37 -0
- data/features/old_cuke_features/mysql_v1_upgrade_v2.feature +42 -0
- data/features/old_cuke_features/php.feature +27 -0
- data/features/old_cuke_features/php_aio_trial_chef_alpha.feature +11 -0
- data/features/old_cuke_features/php_chef.feature +21 -0
- data/features/old_cuke_features/php_elb.feature +41 -0
- data/features/old_cuke_features/rails.feature +26 -0
- data/features/old_cuke_features/rails_aio_developer_chef.feature +17 -0
- data/features/old_cuke_features/reboot.feature +23 -0
- data/features/old_cuke_features/rightlink.feature +19 -0
- data/features/old_cuke_features/rsgrid.feature +19 -0
- data/features/old_cuke_features/simple.feature +8 -0
- data/features/old_cuke_features/simple_fail.feature +9 -0
- data/features/old_cuke_features/start-stop.feature +13 -0
- data/features/old_cuke_features/step_definitions/app.rb +21 -0
- data/features/old_cuke_features/step_definitions/deployment_steps.rb +112 -0
- data/features/old_cuke_features/step_definitions/ebs.rb +36 -0
- data/features/old_cuke_features/step_definitions/elb.rb +35 -0
- data/features/old_cuke_features/step_definitions/lb.rb +22 -0
- data/features/old_cuke_features/step_definitions/mysql_steps.rb +84 -0
- data/features/old_cuke_features/terminate.feature +7 -0
- data/features/old_cuke_features/tomcat6-tests-TODO +29 -0
- data/features/old_cuke_features/tomcat6.feature +27 -0
- data/features/patch_test.rb +33 -0
- data/features/php.rb +54 -0
- data/features/php_elb.rb +78 -0
- data/features/rails.rb +54 -0
- data/features/start_only.rb +26 -0
- data/features/tomcat6.rb +54 -0
- data/lib/virtualmonkey.rb +28 -0
- data/lib/virtualmonkey/application.rb +75 -0
- data/lib/virtualmonkey/application_frontend.rb +42 -0
- data/lib/virtualmonkey/command.rb +39 -0
- data/lib/virtualmonkey/command/clone.rb +50 -0
- data/lib/virtualmonkey/command/create.rb +21 -0
- data/lib/virtualmonkey/command/destroy.rb +51 -0
- data/lib/virtualmonkey/command/list.rb +10 -0
- data/lib/virtualmonkey/command/run.rb +76 -0
- data/lib/virtualmonkey/command/troop.rb +146 -0
- data/lib/virtualmonkey/cuke_monk.rb +184 -0
- data/lib/virtualmonkey/deployment_monk.rb +132 -0
- data/lib/virtualmonkey/deployment_runner.rb +333 -0
- data/lib/virtualmonkey/ebs.rb +161 -0
- data/lib/virtualmonkey/ebs_runner.rb +59 -0
- data/lib/virtualmonkey/elb_runner.rb +194 -0
- data/lib/virtualmonkey/fe_app_runner.rb +7 -0
- data/lib/virtualmonkey/file_locations.rb +7 -0
- data/lib/virtualmonkey/frontend.rb +124 -0
- data/lib/virtualmonkey/http_checks.rb +33 -0
- data/lib/virtualmonkey/index.html.erb +109 -0
- data/lib/virtualmonkey/lamp_runner.rb +29 -0
- data/lib/virtualmonkey/mysql.rb +172 -0
- data/lib/virtualmonkey/mysql_runner.rb +108 -0
- data/lib/virtualmonkey/mysql_toolbox_runner.rb +51 -0
- data/lib/virtualmonkey/patch_runner.rb +46 -0
- data/lib/virtualmonkey/php_aio_trial_chef_runner.rb +6 -0
- data/lib/virtualmonkey/php_chef_runner.rb +69 -0
- data/lib/virtualmonkey/rails_aio_developer_chef_runner.rb +8 -0
- data/lib/virtualmonkey/shared_dns.rb +67 -0
- data/lib/virtualmonkey/simple.rb +5 -0
- data/lib/virtualmonkey/simple_runner.rb +6 -0
- data/lib/virtualmonkey/test_case_interface.rb +151 -0
- data/lib/virtualmonkey/unified_application.rb +40 -0
- data/spec/bug3518.rb +16 -0
- data/spec/concurrent_writes_spec.rb +26 -0
- data/spec/cuke_job_spec.rb +26 -0
- data/spec/ek.rb +28 -0
- data/spec/little_ruby.rb +20 -0
- data/spec/mini.rb +25 -0
- data/spec/monitoring.rb +13 -0
- data/spec/release_aws_dns.rb +5 -0
- data/spec/release_dns.rb +5 -0
- data/spec/release_dyndns.rb +5 -0
- data/spec/shared_resources_spec.rb +25 -0
- data/spec/spec.opts +1 -0
- data/spec/spec_helper.rb +11 -0
- data/spec/virtualmonkey_spec.rb +7 -0
- data/virtualmonkey.gemspec +265 -0
- metadata +428 -0
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
class SharedDns
|
|
2
|
+
attr_accessor :reservation
|
|
3
|
+
attr_accessor :owner
|
|
4
|
+
|
|
5
|
+
def initialize(domain = "virtualmonkey_shared_resources")
|
|
6
|
+
@sdb = Fog::AWS::SimpleDB.new(:aws_access_key_id => Fog.credentials[:aws_access_key_id_test], :aws_secret_access_key => Fog.credentials[:aws_secret_access_key_test])
|
|
7
|
+
@domain = domain
|
|
8
|
+
@reservation = nil
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
# set dns inputs on a deployment to match the current reservation
|
|
12
|
+
# * deployment<~Deployment> the deployment to set inputs on
|
|
13
|
+
def set_dns_inputs(deployment)
|
|
14
|
+
sdb_result = @sdb.get_attributes(@domain, @reservation)
|
|
15
|
+
|
|
16
|
+
set_these = sdb_result.body['Attributes'].reject {|k,v| k == 'owner'}
|
|
17
|
+
set_these.each do |key,val|
|
|
18
|
+
deployment.set_input(key, val.to_s)
|
|
19
|
+
deployment.servers.each { |s| s.set_input(key, "text:") }
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def reserve_dns(owner, timeout = 0)
|
|
24
|
+
puts "Checking DNS reservation for #{owner}"
|
|
25
|
+
result = @sdb.select("SELECT * from #{@domain} where owner = '#{owner}'")
|
|
26
|
+
puts "Reusing DNS reservation" unless result.body["Items"].empty?
|
|
27
|
+
if result.body["Items"].empty?
|
|
28
|
+
result = @sdb.select("SELECT * from #{@domain} where owner = 'available'")
|
|
29
|
+
return false if result.body["Items"].empty?
|
|
30
|
+
puts "Aquired new DNS reservation"
|
|
31
|
+
item_name = result.body["Items"].keys.first
|
|
32
|
+
response = @sdb.put_attributes(@domain, item_name, {'owner' => owner}, :expect => {'owner' => "available"}, :replace => ['owner'])
|
|
33
|
+
end
|
|
34
|
+
@owner = owner
|
|
35
|
+
@reservation = result.body["Items"].keys.first
|
|
36
|
+
rescue Excon::Errors::ServiceUnavailable
|
|
37
|
+
puts "Resuce: ServiceUnavailable"
|
|
38
|
+
retry_reservation(owner, timeout)
|
|
39
|
+
rescue Excon::Errors::Conflict
|
|
40
|
+
puts "Resuce: Conflict"
|
|
41
|
+
retry_reservation(owner, timeout)
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def retry_reservation(owner, timeout)
|
|
45
|
+
STDOUT.flush
|
|
46
|
+
if timeout > 20
|
|
47
|
+
return false
|
|
48
|
+
end
|
|
49
|
+
sleep(5)
|
|
50
|
+
reserve_dns(owner, timeout + 1)
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def release_all
|
|
54
|
+
result = @sdb.select("SELECT * from #{@domain}")
|
|
55
|
+
result.body['Items'].keys.each do |item_name|
|
|
56
|
+
@sdb.put_attributes(@domain, item_name, {"owner" => "available"}, :replace => ["owner"])
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
def release_dns(res = @reservation)
|
|
61
|
+
raise "FATAL: could not release dns because there was no @reservation" unless res
|
|
62
|
+
@sdb.put_attributes(@domain, res, {"owner" => "available"}, :replace => ["owner"])
|
|
63
|
+
@reservation = nil
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
module VirtualMonkey
|
|
2
|
+
module TestCaseInterface
|
|
3
|
+
def set_var(sym, *args)
|
|
4
|
+
behavior(sym, *args)
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
def behavior(sym, *args)
|
|
8
|
+
begin
|
|
9
|
+
rerun_test
|
|
10
|
+
#pre-command
|
|
11
|
+
populate_settings unless @populated
|
|
12
|
+
#command
|
|
13
|
+
result = __send__(sym, *args)
|
|
14
|
+
#post-command
|
|
15
|
+
continue_test
|
|
16
|
+
rescue Exception => e
|
|
17
|
+
dev_mode?(e)
|
|
18
|
+
end while @rerun_last_command.pop
|
|
19
|
+
result
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def verify(method, expectation, *args)
|
|
23
|
+
if expectation =~ /((exception)|(error)|(fatal)|(fail))/i
|
|
24
|
+
expect = "fail"
|
|
25
|
+
error_msg = expectation.split(":")[1..-1].join(":")
|
|
26
|
+
elsif expectation =~ /((success)|(succeed)|(pass))/i
|
|
27
|
+
expect = "pass"
|
|
28
|
+
elsif expectation =~ /nil/i
|
|
29
|
+
expect = "nil"
|
|
30
|
+
else
|
|
31
|
+
raise 'Syntax Error: verify expects a "pass", "fail", or "nil"'
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
begin
|
|
35
|
+
rerun_test
|
|
36
|
+
result = __send__(command, *args)
|
|
37
|
+
if expect != "pass" and not (result == nil and expect == "nil")
|
|
38
|
+
raise "FATAL: Failed verification"
|
|
39
|
+
end
|
|
40
|
+
continue_test
|
|
41
|
+
rescue Exception => e
|
|
42
|
+
if not ("#{e}" =~ /#{error_msg}/ and expect == "fail")
|
|
43
|
+
dev_mode?(e)
|
|
44
|
+
end
|
|
45
|
+
end while @rerun_last_command.pop
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def probe(server, command, &block)
|
|
49
|
+
# run command on servers matching "server" over ssh
|
|
50
|
+
result = ""
|
|
51
|
+
@servers.select { |s| s.nickname =~ /#{server}/ }.each { |s|
|
|
52
|
+
begin
|
|
53
|
+
rerun_test
|
|
54
|
+
result_temp = s.spot_check_command(command)
|
|
55
|
+
if not yield(result_temp[:output])
|
|
56
|
+
raise "FATAL: Server #{s.nickname} failed probe. Got #{result_temp[:output]}"
|
|
57
|
+
end
|
|
58
|
+
continue_test
|
|
59
|
+
rescue Exception => e
|
|
60
|
+
dev_mode?(e)
|
|
61
|
+
end while @rerun_last_command.pop
|
|
62
|
+
result += result_temp[:output]
|
|
63
|
+
}
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
private
|
|
67
|
+
|
|
68
|
+
def dev_mode?(e)
|
|
69
|
+
if not ENV['MONKEY_NO_DEBUG'] =~ /true/i
|
|
70
|
+
puts e
|
|
71
|
+
puts "Pausing for debugging..."
|
|
72
|
+
debugger
|
|
73
|
+
else
|
|
74
|
+
exception_handle(e)
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
def exception_handle(e)
|
|
79
|
+
puts "ATTENTION: Using default exception_handle(e). This can be overridden in mixin classes."
|
|
80
|
+
if e.message =~ /Insufficient capacity/
|
|
81
|
+
puts "Got \"#{e.message}\". Retrying...."
|
|
82
|
+
sleep 60
|
|
83
|
+
else
|
|
84
|
+
raise e
|
|
85
|
+
end
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
def help
|
|
89
|
+
puts "Here are some of the wrapper methods that may be of use to you in your debugging quest:\n"
|
|
90
|
+
puts "behavior(sym, *args): Pass the method name (as a symbol or string) and the optional arguments"
|
|
91
|
+
puts " that you wish to pass to that method; behavior() will call that method"
|
|
92
|
+
puts " with those arguments while handling nested exceptions, retries, and"
|
|
93
|
+
puts " debugger calls.\n"
|
|
94
|
+
puts " Examples:"
|
|
95
|
+
puts " behavior(:launch_all)"
|
|
96
|
+
puts " behavior(:launch_set, 'Load Balancer')\n"
|
|
97
|
+
puts "verify(sym, expectation_string, *args): Pass the method name (as a symbol or string), the expected"
|
|
98
|
+
puts " result, and any arguments to pass to that method. The"
|
|
99
|
+
puts " expectation_string should consist of 'Error: MyRegex',"
|
|
100
|
+
puts " 'Pass', or 'nil'. 'Error: MyRegex' tells verify() that it"
|
|
101
|
+
puts " should expect an exception to be raised, and the message "
|
|
102
|
+
puts " or exception name should match /MyRegex/. 'Pass' tells"
|
|
103
|
+
puts " verify() that it should expect the method to return normally,"
|
|
104
|
+
puts " and 'nil' tells verify() that it should expect the method to"
|
|
105
|
+
puts " return nil.\n"
|
|
106
|
+
puts " Example:"
|
|
107
|
+
puts " verify(:launch_all, 'Error: execution expired')\n"
|
|
108
|
+
puts "probe(server_regex, shell_command, &block): Provides a one-line interface for running a command on"
|
|
109
|
+
puts " a set of servers and verifying their output. The block"
|
|
110
|
+
puts " should take one argument, the output string from one of"
|
|
111
|
+
puts " the servers, and return true or false based on however"
|
|
112
|
+
puts " the developer wants to verify correctness.\n"
|
|
113
|
+
puts " Examples:"
|
|
114
|
+
puts " probe('.*', 'ls') { |s| puts s }"
|
|
115
|
+
puts " probe('.*', 'uname -a') { |s| s =~ /x64/ }\n"
|
|
116
|
+
puts "continue_test: Disables the retry loop that reruns the last command (the current command that you're"
|
|
117
|
+
puts " debugging.\n"
|
|
118
|
+
puts "help: Prints this help message."
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
def populate_settings
|
|
122
|
+
@servers.each { |s| s.settings }
|
|
123
|
+
lookup_scripts
|
|
124
|
+
@populated = 1
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
def object_behavior(obj, sym, *args)
|
|
128
|
+
begin
|
|
129
|
+
rerun_test
|
|
130
|
+
#pre-command
|
|
131
|
+
populate_settings unless @populated
|
|
132
|
+
#command
|
|
133
|
+
result = obj.__send__(sym, *args)
|
|
134
|
+
#post-command
|
|
135
|
+
continue_test
|
|
136
|
+
rescue Exception => e
|
|
137
|
+
dev_mode?(e)
|
|
138
|
+
end while @rerun_last_command.pop
|
|
139
|
+
result
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
def rerun_test
|
|
143
|
+
@rerun_last_command.push(true)
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
def continue_test
|
|
147
|
+
@rerun_last_command.pop
|
|
148
|
+
@rerun_last_command.push(false)
|
|
149
|
+
end
|
|
150
|
+
end
|
|
151
|
+
end
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
module VirtualMonkey
|
|
2
|
+
module UnifiedApplication
|
|
3
|
+
# returns true if the http response contains the expected_string
|
|
4
|
+
# * url<~String> url to perform http request
|
|
5
|
+
# * expected_string<~String> regex compatible string used to match against the response output
|
|
6
|
+
def test_http_response(expected_string, url, port)
|
|
7
|
+
cmd = "curl -s #{url} 2> /dev/null "
|
|
8
|
+
puts cmd
|
|
9
|
+
timeout=300
|
|
10
|
+
begin
|
|
11
|
+
status = Timeout::timeout(timeout) do
|
|
12
|
+
while true
|
|
13
|
+
response = `#{cmd}`
|
|
14
|
+
break if response.include?(expected_string)
|
|
15
|
+
puts "Retrying..."
|
|
16
|
+
sleep 5
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
rescue Timeout::Error => e
|
|
20
|
+
raise "ERROR: Query failed after #{timeout/60} minutes."
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def run_unified_application_checks(run_on=@servers, port=8000)
|
|
25
|
+
run_on.each do |server|
|
|
26
|
+
behavior(:run_unified_application_check, server.dns_name, port)
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
# this is where ALL the generic application server checks live, this could get rather long but for now it's a single method with a sequence of checks
|
|
31
|
+
def run_unified_application_check(dns_name, port=8000)
|
|
32
|
+
url_base = "#{dns_name}:#{port}"
|
|
33
|
+
behavior(:test_http_response, "html serving succeeded", "#{url_base}/index.html", port)
|
|
34
|
+
behavior(:test_http_response, "configuration=succeeded", "#{url_base}/appserver/", port)
|
|
35
|
+
behavior(:test_http_response, "I am in the db", "#{url_base}/dbread/", port)
|
|
36
|
+
behavior(:test_http_response, "hostname=", "#{url_base}/serverid/", port)
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
end
|
|
40
|
+
end
|
data/spec/bug3518.rb
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
|
2
|
+
|
|
3
|
+
describe "bug #3518" do
|
|
4
|
+
before(:all) do
|
|
5
|
+
raise "for this spec to run, you must have a mysql deployment nickname in $DEPLOYMENT variable" unless ENV['DEPLOYMENT']
|
|
6
|
+
@runner = VirtualMonkey::MysqlRunner.new(ENV['DEPLOYMENT'])
|
|
7
|
+
@runner.lookup_scripts
|
|
8
|
+
@runner.setup_dns
|
|
9
|
+
end
|
|
10
|
+
it "disables binlogs on the old master after promote" do
|
|
11
|
+
@runner.run_promotion_operations
|
|
12
|
+
oldmaster = @runner.servers.last
|
|
13
|
+
oldmaster.settings
|
|
14
|
+
puts "oldmaster is #{oldmaster.dns_name}"
|
|
15
|
+
end
|
|
16
|
+
end
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
require File.join(File.dirname(__FILE__), "spec_helper")
|
|
2
|
+
require 'ruby-debug'
|
|
3
|
+
|
|
4
|
+
describe SharedDns, "Using sdb to store shared resources" do
|
|
5
|
+
it "should perform concurrent reads and writes" do
|
|
6
|
+
unique_record = "blah#{rand(10000000)}"
|
|
7
|
+
|
|
8
|
+
reservations = Array.new
|
|
9
|
+
18.times do |i|
|
|
10
|
+
reservations[i] = SharedDns.new
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
reservations[0].release_all
|
|
14
|
+
|
|
15
|
+
mythreads = Array.new
|
|
16
|
+
reservations.each do |x|
|
|
17
|
+
mythreads << Thread.new do
|
|
18
|
+
x.reserve_dns
|
|
19
|
+
# all reservations should succeed
|
|
20
|
+
x.should_not == false
|
|
21
|
+
puts "reserved #{x.reservation}"
|
|
22
|
+
STDOUT.flush
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
|
2
|
+
|
|
3
|
+
describe CukeMonk do
|
|
4
|
+
it "checks a job status" do
|
|
5
|
+
EM.run {
|
|
6
|
+
cm = CukeMonk.new
|
|
7
|
+
cm.run_test("NODEPLOY", "simple.feature")
|
|
8
|
+
cm.run_test("NODEPLOY", "simple.feature")
|
|
9
|
+
cm.run_test("NODEPLOY", "simple.feature")
|
|
10
|
+
|
|
11
|
+
EM.add_periodic_timer(1) {
|
|
12
|
+
cm.show_jobs
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
donetime = EM.add_periodic_timer(1) {
|
|
16
|
+
donetime.cancel
|
|
17
|
+
puts "All done? #{cm.all_done?}"
|
|
18
|
+
if cm.all_done?
|
|
19
|
+
EM.stop
|
|
20
|
+
end
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
}
|
|
25
|
+
end
|
|
26
|
+
end
|
data/spec/ek.rb
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
require 'rubygems'
|
|
2
|
+
require "ruby-debug"
|
|
3
|
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
|
4
|
+
|
|
5
|
+
describe "Messing with spec" do
|
|
6
|
+
before(:all) do
|
|
7
|
+
raise "for this spec to run, you must have a mysql deployment nickname in $DEPLOYMENT variable" unless ENV['DEPLOYMENT']
|
|
8
|
+
@runner = VirtualMonkey::MysqlRunner.new(ENV['DEPLOYMENT'])
|
|
9
|
+
@runner.lookup_scripts
|
|
10
|
+
@runner.lineage='testlineage3049'
|
|
11
|
+
@runner.stripe_count=1
|
|
12
|
+
# @runner.set_variation_lineage
|
|
13
|
+
@master = @runner.servers.first
|
|
14
|
+
@master.start
|
|
15
|
+
@master.wait_for_operational_with_dns
|
|
16
|
+
@master.settings
|
|
17
|
+
puts "master is #{@master.dns_name}"
|
|
18
|
+
# @runner.config_master_from_scratch(master)
|
|
19
|
+
# @runner.setup_dns
|
|
20
|
+
|
|
21
|
+
end
|
|
22
|
+
it "wait for master snapshot to complete - no pending snapshots for master lineage" do
|
|
23
|
+
# take the lineage name, find all snapshots and verify that none are in the pending state.
|
|
24
|
+
@runner.run_script("backup", @master)
|
|
25
|
+
@runner.wait_for_snapshots
|
|
26
|
+
debugger
|
|
27
|
+
end
|
|
28
|
+
end
|
data/spec/little_ruby.rb
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
require 'rubygems'
|
|
2
|
+
require 'virtualmonkey'
|
|
3
|
+
|
|
4
|
+
@sdb = Fog::AWS::SimpleDB.new(:aws_access_key_id => Fog.credentials[:aws_access_key_id_test], :aws_secret_access_key => Fog.credentials[:aws_secret_access_key_test])
|
|
5
|
+
|
|
6
|
+
@domain="virtualmonkey_awsdns"
|
|
7
|
+
|
|
8
|
+
29.times do |num|
|
|
9
|
+
item_name="awsdns#{num}"
|
|
10
|
+
attributes=
|
|
11
|
+
{"SLAVE_DB_DNSID"=>["text:Z3AINKOIEY1X3X:testslave#{num}.aws.rightscale.com"],
|
|
12
|
+
"MASTER_DB_DNSID"=>["text:Z3AINKOIEY1X3X:test#{num}.aws.rightscale.com"],
|
|
13
|
+
"DNS_USER"=>["cred:AWS_ACCESS_KEY_ID_TEST"],
|
|
14
|
+
"DNS_PASSWORD"=>["cred:AWS_SECRET_ACCESS_KEY_TEST"],
|
|
15
|
+
"DNS_PROVIDER"=>["text:AwsDNS"],
|
|
16
|
+
"owner"=>["available"],
|
|
17
|
+
"MASTER_DB_DNSNAME"=>["text:test#{num}.aws.rightscale.com"]}
|
|
18
|
+
response = @sdb.put_attributes(@domain, item_name, attributes)
|
|
19
|
+
end
|
|
20
|
+
|
data/spec/mini.rb
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
require 'rubygems'
|
|
2
|
+
require "ruby-debug"
|
|
3
|
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
|
4
|
+
|
|
5
|
+
describe "Messing with spec" do
|
|
6
|
+
before(:all) do
|
|
7
|
+
raise "for this spec to run, you must have a mysql deployment nickname in $DEPLOYMENT variable" unless ENV['DEPLOYMENT']
|
|
8
|
+
@runner = VirtualMonkey::MysqlRunner.new(ENV['DEPLOYMENT'])
|
|
9
|
+
@runner
|
|
10
|
+
@runner.lookup_scripts
|
|
11
|
+
@snapshot_lineage_prefix='testlineage3049'
|
|
12
|
+
# @runner.setup_dns
|
|
13
|
+
|
|
14
|
+
end
|
|
15
|
+
it "wait for master snapshot to complete - no pending snapshots for master lineage" do
|
|
16
|
+
# take the lineage name, find all snapshots and verify that none are in the pending state.
|
|
17
|
+
snapshots =Ec2EbsSnapshot.find_by_cloud_id(3).select { |n| n.nickname =~ /#{@snapshot_lineage_prefix}.*$/ }
|
|
18
|
+
status= snapshots.map &:aws_status
|
|
19
|
+
puts status.join ","
|
|
20
|
+
puts "we got completed snapshots" if status.include?("completed")
|
|
21
|
+
puts "we got pending snapshots" if status.include?("pending")
|
|
22
|
+
debugger
|
|
23
|
+
puts x
|
|
24
|
+
end
|
|
25
|
+
end
|
data/spec/monitoring.rb
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
|
2
|
+
|
|
3
|
+
require 'rubygems'
|
|
4
|
+
require 'virtualmonkey'
|
|
5
|
+
|
|
6
|
+
dep=VirtualMonkey::SimpleRunner.new(ENV['DEPLOYMENT'])
|
|
7
|
+
s= dep.servers.first
|
|
8
|
+
s.monitoring
|
|
9
|
+
mon=s.get_sketchy_data({'start'=>-180,'end'=>"-20",'plugin_name'=>"df",'plugin_type'=>"df-mnt"})
|
|
10
|
+
data=mon['data']
|
|
11
|
+
free=data['free']
|
|
12
|
+
raise "No df free data" unless free.length > 0
|
|
13
|
+
raise "DF not free" unless free[0]
|