virtualmonkey 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- 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,62 @@
|
|
1
|
+
#@ebs
|
2
|
+
#Feature: EBS toolbox tests
|
3
|
+
# Tests the RightScale premium ServerTemplate
|
4
|
+
#
|
5
|
+
# Scenario: Run all EBS toolbox operational scripts
|
6
|
+
##
|
7
|
+
## PHASE 1) Launch a toolbox server and create an EBS stripe with "interesting" data on it.
|
8
|
+
## How many servers do we need? Launch them all and figure it out later.
|
9
|
+
##
|
10
|
+
# Given A EBS Toolbox deployment
|
11
|
+
@runner = VirtualMonkey::EBSRunner.new(ENV['DEPLOYMENT'])
|
12
|
+
|
13
|
+
# Then I should set a variation lineage
|
14
|
+
@runner.set_var(:set_variation_lineage)
|
15
|
+
|
16
|
+
# Then I should set a variation stripe count of "3"
|
17
|
+
@runner.set_var(:set_variation_stripe_count, 3)
|
18
|
+
|
19
|
+
# Then I should set a variation volume size "3"
|
20
|
+
@runner.set_var(:set_variation_volume_size, 3)
|
21
|
+
|
22
|
+
# Then I should set a variation mount point "/mnt/ebs"
|
23
|
+
@runner.set_var(:set_variation_mount_point, "/mnt/ebs")
|
24
|
+
|
25
|
+
# Then I should stop the servers
|
26
|
+
@runner.behavior(:stop_all)
|
27
|
+
|
28
|
+
# Then I should launch all servers
|
29
|
+
@runner.behavior(:launch_all)
|
30
|
+
|
31
|
+
# Then I should wait for the state of "all" servers to be "operational"
|
32
|
+
@runner.behavior(:wait_for_all, "operational")
|
33
|
+
|
34
|
+
# Then I should create a new EBS stripe
|
35
|
+
@runner.behavior(:create_stripe)
|
36
|
+
|
37
|
+
##
|
38
|
+
## PHASE 2) Run checks for the basic scripts
|
39
|
+
##
|
40
|
+
# Then I should test the backup script operations
|
41
|
+
@runner.behavior(:test_backup_script_operations)
|
42
|
+
|
43
|
+
##
|
44
|
+
## PHASE 3) restore the snapshot on another server
|
45
|
+
##
|
46
|
+
# Then I should backup the volume
|
47
|
+
@runner.behavior(:create_backup)
|
48
|
+
|
49
|
+
# Then I should test the restore operations
|
50
|
+
@runner.behavior(:test_restore)
|
51
|
+
|
52
|
+
##
|
53
|
+
## PHASE 4) Do the grow EBS tests
|
54
|
+
##
|
55
|
+
# Then I should test the restore grow operations
|
56
|
+
@runner.behavior(:test_restore_grow)
|
57
|
+
|
58
|
+
# Then I should test reboot operations on the deployment
|
59
|
+
@runner.behavior(:run_reboot_operations)
|
60
|
+
|
61
|
+
# Then I should stop the servers
|
62
|
+
@runner.behavior(:stop_all)
|
data/features/lamp.rb
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
#@lamp_test
|
2
|
+
#
|
3
|
+
#Feature: LAMP Server Template Test
|
4
|
+
# Tests the deployment
|
5
|
+
#
|
6
|
+
#Scenario: LAMP Server Template Test
|
7
|
+
#
|
8
|
+
# Given A LAMP deployment
|
9
|
+
@runner = VirtualMonkey::LampRunner.new(ENV['DEPLOYMENT'])
|
10
|
+
|
11
|
+
# Then I should stop the servers
|
12
|
+
@runner.behavior(:stop_all)
|
13
|
+
|
14
|
+
# Then I should launch all servers
|
15
|
+
@runner.behavior(:launch_all)
|
16
|
+
|
17
|
+
# Then I should wait for the state of "all" servers to be "operational"
|
18
|
+
@runner.behavior(:wait_for_all, "operational")
|
19
|
+
|
20
|
+
# Then I should run LAMP checks
|
21
|
+
@runner.behavior(:run_lamp_checks)
|
22
|
+
|
23
|
+
# Then I should run mysql checks
|
24
|
+
@runner.behavior(:run_checks)
|
25
|
+
|
26
|
+
## Then I should run mysqlslap stress test
|
27
|
+
# @runner.behavior(:run_mysqlslap_check)
|
28
|
+
#
|
29
|
+
# Then I should check that ulimit was set correctly
|
30
|
+
@runner.probe(".*", "su - mysql -s /bin/bash -c \"ulimit -n\"") { |s| s.to_i > 1024 }
|
31
|
+
|
32
|
+
# Then I should check that monitoring is enabled
|
33
|
+
@runner.behavior(:check_monitoring)
|
@@ -0,0 +1,49 @@
|
|
1
|
+
#@lb_test
|
2
|
+
#
|
3
|
+
#Feature: LB Server Test
|
4
|
+
# Tests the LB servers
|
5
|
+
#
|
6
|
+
#Scenario: LB server test
|
7
|
+
#
|
8
|
+
# Given An Apache with HAproxy deployment
|
9
|
+
@runner = VirtualMonkey::FeAppRunner.new(ENV['DEPLOYMENT'])
|
10
|
+
|
11
|
+
# Then I should stop the servers
|
12
|
+
@runner.behavior(:stop_all)
|
13
|
+
|
14
|
+
# Then I should set a variation for connecting to shared database host
|
15
|
+
@runner.set_var(:set_master_db_dnsname)
|
16
|
+
|
17
|
+
# When I launch the "Load Balancer" servers
|
18
|
+
@runner.behavior(:launch_set, "Load Balancer")
|
19
|
+
|
20
|
+
# Then I should wait for the state of "Load Balancer" servers to be "operational"
|
21
|
+
@runner.behavior(:wait_for_set, "Load Balancer", "operational")
|
22
|
+
|
23
|
+
# Then I should set a variation LB_HOSTNAME
|
24
|
+
@runner.set_var(:set_lb_hostname)
|
25
|
+
|
26
|
+
# When I launch the "App Server" servers
|
27
|
+
@runner.behavior(:launch_set, "App Server")
|
28
|
+
|
29
|
+
# Then I should wait for the state of "App Server" servers to be "operational"
|
30
|
+
@runner.behavior(:wait_for_set, "App Server", "operational")
|
31
|
+
|
32
|
+
# Then I should run unified application checks on app servers
|
33
|
+
@runner.behavior(:run_unified_application_checks, @runner.send(:app_servers))
|
34
|
+
|
35
|
+
# Then I should run frontend checks
|
36
|
+
@runner.behavior(:frontend_checks)
|
37
|
+
|
38
|
+
# Then I should run log rotation checks
|
39
|
+
@runner.behavior(:log_rotation_checks)
|
40
|
+
|
41
|
+
## TODO?
|
42
|
+
## When I restart apache
|
43
|
+
#
|
44
|
+
#
|
45
|
+
## Then apache status should be good
|
46
|
+
#
|
47
|
+
#
|
48
|
+
# Then I should test reboot operations on the deployment
|
49
|
+
@runner.behavior(:run_reboot_operations)
|
@@ -0,0 +1,71 @@
|
|
1
|
+
#@mysql_5.x
|
2
|
+
#Feature: mysql 5.x v2 or v4 promote operations test
|
3
|
+
# Tests the RightScale premium ServerTemplate
|
4
|
+
#
|
5
|
+
# Scenario: Setup 2 server deployment and run basic cluster failover operations
|
6
|
+
#
|
7
|
+
# PHASE 1) Bootstrap and test promote
|
8
|
+
#
|
9
|
+
# Given A MySQL deployment
|
10
|
+
@runner = VirtualMonkey::MysqlRunner.new(ENV['DEPLOYMENT'])
|
11
|
+
|
12
|
+
# Then I should stop the servers
|
13
|
+
@runner.behavior(:stop_all)
|
14
|
+
|
15
|
+
# Then I should set a variation lineage
|
16
|
+
@runner.set_var(:set_variation_lineage)
|
17
|
+
|
18
|
+
# Then I should set a variation stripe count of "1"
|
19
|
+
@runner.set_var(:set_variation_stripe_count, 1)
|
20
|
+
|
21
|
+
# Then I should set a variation MySQL DNS
|
22
|
+
@runner.set_var(:setup_dns, "virtualmonkey_shared_resources") # DNSMadeEasy
|
23
|
+
|
24
|
+
# Then I should launch all servers
|
25
|
+
@runner.behavior(:launch_all)
|
26
|
+
|
27
|
+
# Then I should wait for the state of "all" servers to be "booting"
|
28
|
+
@runner.behavior(:wait_for_all, "booting")
|
29
|
+
|
30
|
+
# Then I should wait for the state of "all" servers to be "operational"
|
31
|
+
@runner.behavior(:wait_for_all, "operational")
|
32
|
+
|
33
|
+
# Then I should test promotion operations on the deployment
|
34
|
+
@runner.behavior(:run_promotion_operations)
|
35
|
+
|
36
|
+
# Then I should run mysql checks
|
37
|
+
@runner.behavior(:run_checks)
|
38
|
+
|
39
|
+
# Then I should run mysqlslap stress test
|
40
|
+
# @runner.behavior(:run_mysqlslap_check)
|
41
|
+
|
42
|
+
# Then I should check that ulimit was set correctly
|
43
|
+
# @runner.behavior(:ulimit_check)
|
44
|
+
@runner.probe(".*", "su - mysql -s /bin/bash -c \"ulimit -n\"") { |s| s.to_i > 1024 }
|
45
|
+
|
46
|
+
# Then I should check that monitoring is enabled
|
47
|
+
@runner.behavior(:check_monitoring)
|
48
|
+
|
49
|
+
#
|
50
|
+
# PHASE 2) Reboot
|
51
|
+
#
|
52
|
+
|
53
|
+
# Then I should test reboot operations on the deployment
|
54
|
+
@runner.behavior(:run_reboot_operations)
|
55
|
+
|
56
|
+
#
|
57
|
+
# PHASE 3) Additional Tests
|
58
|
+
#
|
59
|
+
|
60
|
+
# Then I should run a restore using OPT_DB_RESTORE_TIMESTAMP_OVERRIDE
|
61
|
+
@runner.behavior(:run_restore_with_timestamp_override)
|
62
|
+
|
63
|
+
#
|
64
|
+
# PHASE 4) Terminate
|
65
|
+
#
|
66
|
+
|
67
|
+
# Then I should terminate the servers
|
68
|
+
@runner.behavior(:stop_all, true)
|
69
|
+
|
70
|
+
# Then I should release the DNS
|
71
|
+
@runner.behavior(:release_dns)
|
@@ -0,0 +1,71 @@
|
|
1
|
+
#@mysql_5.x
|
2
|
+
#Feature: mysql 5.x v2 or v4 promote operations test
|
3
|
+
# Tests the RightScale premium ServerTemplate
|
4
|
+
#
|
5
|
+
# Scenario: Setup 2 server deployment and run basic cluster failover operations
|
6
|
+
#
|
7
|
+
# PHASE 1) Bootstrap and test promote
|
8
|
+
#
|
9
|
+
# Given A MySQL deployment
|
10
|
+
@runner = VirtualMonkey::MysqlRunner.new(ENV['DEPLOYMENT'])
|
11
|
+
|
12
|
+
# Then I should stop the servers
|
13
|
+
@runner.behavior(:stop_all)
|
14
|
+
|
15
|
+
# Then I should set a variation lineage
|
16
|
+
@runner.set_var(:set_variation_lineage)
|
17
|
+
|
18
|
+
# Then I should set a variation stripe count of "1"
|
19
|
+
@runner.set_var(:set_variation_stripe_count, 1)
|
20
|
+
|
21
|
+
# Then I should set a variation MySQL DNS
|
22
|
+
@runner.set_var(:setup_dns, "virtualmonkey_awsdns") # AWSDNS
|
23
|
+
|
24
|
+
# Then I should launch all servers
|
25
|
+
@runner.behavior(:launch_all)
|
26
|
+
|
27
|
+
# Then I should wait for the state of "all" servers to be "booting"
|
28
|
+
@runner.behavior(:wait_for_all, "booting")
|
29
|
+
|
30
|
+
# Then I should wait for the state of "all" servers to be "operational"
|
31
|
+
@runner.behavior(:wait_for_all, "operational")
|
32
|
+
|
33
|
+
# Then I should test promotion operations on the deployment
|
34
|
+
@runner.behavior(:run_promotion_operations)
|
35
|
+
|
36
|
+
# Then I should run mysql checks
|
37
|
+
@runner.behavior(:run_checks)
|
38
|
+
|
39
|
+
# Then I should run mysqlslap stress test
|
40
|
+
# @runner.behavior(:run_mysqlslap_check)
|
41
|
+
|
42
|
+
# Then I should check that ulimit was set correctly
|
43
|
+
# @runner.behavior(:ulimit_check)
|
44
|
+
@runner.probe(".*", "su - mysql -s /bin/bash -c \"ulimit -n\"") { |s| s.to_i > 1024 }
|
45
|
+
|
46
|
+
# Then I should check that monitoring is enabled
|
47
|
+
@runner.behavior(:check_monitoring)
|
48
|
+
|
49
|
+
#
|
50
|
+
# PHASE 2) Reboot
|
51
|
+
#
|
52
|
+
|
53
|
+
# Then I should test reboot operations on the deployment
|
54
|
+
@runner.behavior(:run_reboot_operations)
|
55
|
+
|
56
|
+
#
|
57
|
+
# PHASE 3) Additional Tests
|
58
|
+
#
|
59
|
+
|
60
|
+
# Then I should run a restore using OPT_DB_RESTORE_TIMESTAMP_OVERRIDE
|
61
|
+
@runner.behavior(:run_restore_with_timestamp_override)
|
62
|
+
|
63
|
+
#
|
64
|
+
# PHASE 4) Terminate
|
65
|
+
#
|
66
|
+
|
67
|
+
# Then I should terminate the servers
|
68
|
+
@runner.behavior(:stop_all, true)
|
69
|
+
|
70
|
+
# Then I should release the DNS
|
71
|
+
@runner.behavior(:release_dns)
|
@@ -0,0 +1,71 @@
|
|
1
|
+
#@mysql_5.x
|
2
|
+
#Feature: mysql 5.x v2 or v4 promote operations test
|
3
|
+
# Tests the RightScale premium ServerTemplate
|
4
|
+
#
|
5
|
+
# Scenario: Setup 2 server deployment and run basic cluster failover operations
|
6
|
+
#
|
7
|
+
# PHASE 1) Bootstrap and test promote
|
8
|
+
#
|
9
|
+
# Given A MySQL deployment
|
10
|
+
@runner = VirtualMonkey::MysqlRunner.new(ENV['DEPLOYMENT'])
|
11
|
+
|
12
|
+
# Then I should stop the servers
|
13
|
+
@runner.behavior(:stop_all)
|
14
|
+
|
15
|
+
# Then I should set a variation lineage
|
16
|
+
@runner.set_var(:set_variation_lineage)
|
17
|
+
|
18
|
+
# Then I should set a variation stripe count of "1"
|
19
|
+
@runner.set_var(:set_variation_stripe_count, 1)
|
20
|
+
|
21
|
+
# Then I should set a variation MySQL DNS
|
22
|
+
@runner.set_var(:setup_dns, "virtualmonkey_awsdns") # DNSMadeEasy
|
23
|
+
|
24
|
+
# Then I should launch all servers
|
25
|
+
@runner.behavior(:launch_all)
|
26
|
+
|
27
|
+
# Then I should wait for the state of "all" servers to be "booting"
|
28
|
+
@runner.behavior(:wait_for_all, "booting")
|
29
|
+
|
30
|
+
# Then I should wait for the state of "all" servers to be "operational"
|
31
|
+
@runner.behavior(:wait_for_all, "operational")
|
32
|
+
|
33
|
+
# Then I should test promotion operations on the deployment
|
34
|
+
@runner.behavior(:run_promotion_operations)
|
35
|
+
|
36
|
+
# Then I should run mysql checks
|
37
|
+
@runner.behavior(:run_checks)
|
38
|
+
|
39
|
+
# Then I should run mysqlslap stress test
|
40
|
+
# @runner.behavior(:run_mysqlslap_check)
|
41
|
+
|
42
|
+
# Then I should check that ulimit was set correctly
|
43
|
+
# @runner.behavior(:ulimit_check)
|
44
|
+
@runner.probe(".*", "su - mysql -s /bin/bash -c \"ulimit -n\"") { |s| s.to_i > 1024 }
|
45
|
+
|
46
|
+
# Then I should check that monitoring is enabled
|
47
|
+
@runner.behavior(:check_monitoring)
|
48
|
+
|
49
|
+
#
|
50
|
+
# PHASE 2) Reboot
|
51
|
+
#
|
52
|
+
|
53
|
+
# Then I should test reboot operations on the deployment
|
54
|
+
@runner.behavior(:run_reboot_operations)
|
55
|
+
|
56
|
+
#
|
57
|
+
# PHASE 3) Additional Tests
|
58
|
+
#
|
59
|
+
|
60
|
+
# Then I should run a restore using OPT_DB_RESTORE_TIMESTAMP_OVERRIDE
|
61
|
+
@runner.behavior(:run_restore_with_timestamp_override)
|
62
|
+
|
63
|
+
#
|
64
|
+
# PHASE 4) Terminate
|
65
|
+
#
|
66
|
+
|
67
|
+
# Then I should terminate the servers
|
68
|
+
@runner.behavior(:stop_all, true)
|
69
|
+
|
70
|
+
# Then I should release the DNS
|
71
|
+
@runner.behavior(:release_dns)
|
@@ -0,0 +1,54 @@
|
|
1
|
+
#@mysql_5.x
|
2
|
+
#Feature: mysql 5.x v1 to v2 upgrade tests
|
3
|
+
# Tests the RightScale premium ServerTemplate
|
4
|
+
#
|
5
|
+
# Scenario: Follow the steps in the v1 to v2 upgrade guide. Then run the mysql checks.
|
6
|
+
# http://support.rightscale.com/03-Tutorials/02-AWS/02-Website_Edition/2.1_MySQL_Setup/MySQL_Setup_Migration%3a__EBS_to_EBS_Stripe
|
7
|
+
#
|
8
|
+
# PHASE 1) Launch a v1 master from a known hardcoded snapshot.
|
9
|
+
# TODO - add the steps to create the v1 master from scratch. The upgrade is the major
|
10
|
+
# concern so lets get that done first.
|
11
|
+
# Prerequisite: A Deployment with a running MySQL EBS Master-DB server
|
12
|
+
# (launched using a revision of the "MySQL EBS v1" ServerTemplate)
|
13
|
+
# Old school hand crafted deployment: https://my.rightscale.com/deployments/49925. Make sure
|
14
|
+
# The one server is still up and running as master DB.
|
15
|
+
#
|
16
|
+
# Given A MySQL deployment
|
17
|
+
@runner = VirtualMonkey::MysqlRunner.new(ENV['DEPLOYMENT'])
|
18
|
+
|
19
|
+
# Then I should stop the servers
|
20
|
+
@runner.behavior(:stop_all)
|
21
|
+
|
22
|
+
# Then I should set a variation lineage
|
23
|
+
@runner.behavior(:set_variation_lineage)
|
24
|
+
|
25
|
+
# Then I should set a variation stripe count of "3"
|
26
|
+
@runner.behavior(:set_variation_stripe_count, 3)
|
27
|
+
|
28
|
+
#
|
29
|
+
# PHASE 2) Launch a new v2 server and migrate from v1
|
30
|
+
#
|
31
|
+
# Then I should launch all servers
|
32
|
+
@runner.behavior(:launch_all)
|
33
|
+
|
34
|
+
# Then I should wait for the state of "all" servers to be "operational"
|
35
|
+
@runner.behavior(:wait_for_all, "operational")
|
36
|
+
|
37
|
+
# Then I should create the migration script
|
38
|
+
@runner.behavior(:create_migration_script)
|
39
|
+
|
40
|
+
# Then I should migrate a new slave
|
41
|
+
@runner.behavior(:migrate_slave)
|
42
|
+
|
43
|
+
#
|
44
|
+
# PHASE 3) Initialize additional slave from v2 snapshots
|
45
|
+
#
|
46
|
+
# Then I should init a new v2 slave
|
47
|
+
@runner.behavior(:launch_v2_slave)
|
48
|
+
|
49
|
+
# Then I should test the new v2 slave
|
50
|
+
@runner.behavior(:run_checks)
|
51
|
+
|
52
|
+
# Then I should check that ulimit was set correctly
|
53
|
+
@runner.behavior(:ulimit_check)
|
54
|
+
|
@@ -0,0 +1,121 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rest_connection'
|
3
|
+
require 'yaml'
|
4
|
+
require 'fileutils'
|
5
|
+
require 'sqlite3'
|
6
|
+
require File.join(File.dirname(__FILE__), "..", "vmonk", "lib", "cuke_monk")
|
7
|
+
|
8
|
+
def cached_deployments()
|
9
|
+
if File.exists?("deployments.cache.yaml")
|
10
|
+
puts "Loading deployments from cache.."
|
11
|
+
deployments = YAML::load(IO.read("deployments.cache.yaml"))
|
12
|
+
else
|
13
|
+
deployments = Deployment.find_by(:nickname) { |nick| nick.include?(ENV['DEPLOYMENTS_TAG']) }
|
14
|
+
File.open("deployments.cache.yaml", "w") {|f| f.write(deployments.to_yaml)}
|
15
|
+
end
|
16
|
+
deployments
|
17
|
+
end
|
18
|
+
|
19
|
+
desc "Release MySQL DNS records for reuse"
|
20
|
+
task :release_dns do
|
21
|
+
raise "Please setup DEPLOYMENT environment variable" unless ENV['DEPLOYMENT']
|
22
|
+
SQLite3::Database.new("shared.db") do |db|
|
23
|
+
q = db.query("UPDATE mysql_dns SET owner=NULL where owner='#{ENV['DEPLOYMENT']}'")
|
24
|
+
q.close
|
25
|
+
db.query("SELECT * FROM mysql_dns") do |result|
|
26
|
+
puts result.entries
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
desc "Release ALL MySQL DNS records for reuse"
|
32
|
+
task :release_all_dns do
|
33
|
+
SQLite3::Database.new("shared.db") do |db|
|
34
|
+
q = db.query("UPDATE mysql_dns SET owner=NULL")
|
35
|
+
q.close
|
36
|
+
db.query("SELECT * FROM mysql_dns") do |result|
|
37
|
+
puts result.entries
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
desc "Run Parallel Cucumber Features and post results"
|
43
|
+
task :run_parallel_features do
|
44
|
+
raise "FATAL: please setup $FEATURE environment variable with the filename of Cuke feature test." unless ENV['FEATURE']
|
45
|
+
raise "FATAL: please setup DEPLOYMENTS_TAG environment variable, for finding your set of deployments" unless ENV['DEPLOYMENTS_TAG']
|
46
|
+
|
47
|
+
cm = CukeMonk.new
|
48
|
+
set = Deployment.find_by(:nickname) { |nick| nick.include?(ENV['DEPLOYMENTS_TAG']) }
|
49
|
+
puts "Found: #{set.size} deployments matching #{ENV['DEPLOYMENTS_TAG']}"
|
50
|
+
feature_name = ENV["FEATURE"]
|
51
|
+
FileUtils.mkdir_p("log")
|
52
|
+
ENV['REST_CONNECTION_LOG'] = "log/rest_connection.log"
|
53
|
+
deployment_nicknames = set.map &:nickname
|
54
|
+
cm.run_tests(deployment_nicknames, feature_name)
|
55
|
+
cm.generate_reports
|
56
|
+
end
|
57
|
+
|
58
|
+
desc "Parallel Cuke test on a set of deployments"
|
59
|
+
task :run_parallel_features_old do
|
60
|
+
raise "FATAL: please setup $FEATURE environment variable with the filename of Cuke feature test." unless ENV['FEATURE']
|
61
|
+
raise "FATAL: please setup DEPLOYMENTS_TAG environment variable, for finding your set of deployments" unless ENV['DEPLOYMENTS_TAG']
|
62
|
+
set = Deployment.find_by(:nickname) { |nick| nick.include?(ENV['DEPLOYMENTS_TAG']) }
|
63
|
+
puts "Found: #{set.size} deployments matching #{ENV['DEPLOYMENTS_TAG']}"
|
64
|
+
feature_name = ENV["FEATURE"]
|
65
|
+
FileUtils.mkdir_p("log")
|
66
|
+
children = []
|
67
|
+
set.each do |dep|
|
68
|
+
ENV['DEPLOYMENT'] = dep.nickname
|
69
|
+
ENV['REST_CONNECTION_LOG'] = "log/rest_connection.#{ENV['DEPLOYMENT']}-#{dep.nickname}.log"
|
70
|
+
children << Process.fork {
|
71
|
+
cmd = "cucumber #{feature_name} --out 'log/#{ENV['DEPLOYMENT']}-#{dep.nickname}.log'"
|
72
|
+
puts "RUNNING: #{cmd}"
|
73
|
+
success = system(cmd)
|
74
|
+
if success
|
75
|
+
FileUtils.mv("log/#{ENV['DEPLOYMENT']}-#{dep.nickname}.log","log/COMPLETED-#{ENV['DEPLOYMENT']}-#{dep.nickname}.log")
|
76
|
+
else
|
77
|
+
FileUtils.mv("log/#{ENV['DEPLOYMENT']}-#{dep.nickname}.log","log/FAILED-#{ENV['DEPLOYMENT']}-#{dep.nickname}.log")
|
78
|
+
end
|
79
|
+
}
|
80
|
+
end
|
81
|
+
|
82
|
+
Signal.trap("SIGINT") do
|
83
|
+
puts "Caught CTRL-C, killing children.."
|
84
|
+
children.each {|c| Process.kill("INT", c)}
|
85
|
+
sleep 1
|
86
|
+
children.each {|c| Process.kill("INT", c)}
|
87
|
+
end
|
88
|
+
|
89
|
+
children.each {|c| Process.wait2(c)}
|
90
|
+
puts "Run finished"
|
91
|
+
|
92
|
+
end
|
93
|
+
|
94
|
+
desc "TERMINATE all servers in all deployments specified by DEPLOYMENTS_TAG"
|
95
|
+
task :kill_all do
|
96
|
+
raise "FATAL: please setup DEPLOYMENTS_TAG environment variable, for finding your set of deployments" unless ENV['DEPLOYMENTS_TAG']
|
97
|
+
set = cached_deployments
|
98
|
+
set.each {|n| STDOUT.puts n.nickname}
|
99
|
+
STDOUT.puts "10 seconds till ..TERMINATING all servers in these deployments ^^^^. CTRL-C to abort."
|
100
|
+
sleep 10
|
101
|
+
set.each do |deploy|
|
102
|
+
servers = deploy.servers
|
103
|
+
servers.each { |s| s.stop }
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
desc "RELAUNCH all *running servers in deployments specified by DEPLOYMENTS_TAG"
|
108
|
+
task :relaunch_all do
|
109
|
+
raise "FATAL: please setup DEPLOYMENTS_TAG environment variable, for finding your set of deployments" unless ENV['DEPLOYMENTS_TAG']
|
110
|
+
set = cached_deployments
|
111
|
+
set.each {|n| STDOUT.puts n.nickname}
|
112
|
+
STDOUT.puts "10 seconds till ..RELAUNCHING all servers in these deployments ^^^^. CTRL-C to abort."
|
113
|
+
sleep 10
|
114
|
+
set.each do |deploy|
|
115
|
+
my_servers = deploy.servers
|
116
|
+
my_servers.each do |s|
|
117
|
+
s.relaunch
|
118
|
+
end
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|