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
data/.document
ADDED
data/LICENSE
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
Copyright (c) 2009 Jeremy Deininger
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
4
|
+
a copy of this software and associated documentation files (the
|
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
9
|
+
the following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be
|
|
12
|
+
included in all copies or substantial portions of the Software.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
= QuickStart
|
|
2
|
+
== Install
|
|
3
|
+
=== from rubyforge (soon)
|
|
4
|
+
"gem install virtualmonkey"
|
|
5
|
+
|
|
6
|
+
=== from source
|
|
7
|
+
"git clone http://github.com/jeremyd/virtualmonkey"
|
|
8
|
+
"gem install jeweler rspec"
|
|
9
|
+
"rake check_dependencies" <- Install any gems listed.
|
|
10
|
+
"rake install"
|
|
11
|
+
|
|
12
|
+
== Configuration
|
|
13
|
+
You need to setup ~/.fog and ~/.rest_connection with configuration options to match your RightScale account (for using the RightScale API) and your AWS credentials (for SimpleDB and S3).
|
|
14
|
+
Just run the monkey, and it will tell you how to setup your missing credentials.
|
|
15
|
+
|
|
16
|
+
== Usage
|
|
17
|
+
The command line client is "monkey". It lives in your gem binary path.
|
|
18
|
+
See the help pages for usage:
|
|
19
|
+
"monkey create --help"
|
|
20
|
+
"monkey run --help"
|
|
21
|
+
"monkey destroy --help"
|
|
22
|
+
|
|
23
|
+
= Virtual Monkey Architecture
|
|
24
|
+
|
|
25
|
+
== RightScale API access
|
|
26
|
+
Uses rest_connection library from http://github.com/jeremyd/rest_connection.git
|
|
27
|
+
|
|
28
|
+
== S3 and SimpleDB access
|
|
29
|
+
Uses Fog library from http://github.com/geemus/fog.git
|
|
30
|
+
|
|
31
|
+
== Virtual Monkey command line client "monkey"
|
|
32
|
+
|
|
33
|
+
== Cruise Control Hooks
|
|
34
|
+
(todo)
|
|
35
|
+
|
|
36
|
+
== Shared Resource Tracking (Amazon SimpleDB)
|
|
37
|
+
Shared Resources like DNS_IDs and EIPs will be shared among clients using conditional PUT operations to SimpleDB.
|
|
38
|
+
SharedDns
|
|
39
|
+
|
|
40
|
+
== Management Classes
|
|
41
|
+
|
|
42
|
+
=== DeploymentMonk - handles create/load/delete of DeploymentSets
|
|
43
|
+
Using the RS API we create a set of all the 'basic variations' a deployment can have.
|
|
44
|
+
Basic variations currently are generated using permutations of Images, Clouds, and Instance Types.
|
|
45
|
+
=== CukeMonk
|
|
46
|
+
handles running cucumber tests and collecting and posting results to S3
|
|
47
|
+
=== VirtualMonkey::DeploymentRunner
|
|
48
|
+
* These are a set of specialty mixins per Deployment type for cluster management of a single deployment.
|
|
49
|
+
|
|
50
|
+
* This keeps our cucumber features from getting cluttered. Each step definition needs an equivalent DeploymentRunner method.
|
|
51
|
+
|
|
52
|
+
* 'One-off' variations are setup by the DeploymentRunner(s) and will be applied during a test run.
|
|
53
|
+
ex: OPT_PHP_VHOST_PORT, SLAVE_DNS_ID
|
|
54
|
+
|
|
55
|
+
* VirtualMonkey::MysqlRunner, VirtualMonkey::FeAppRunner, VirtualMonkey::EBSRunner, VirtualMonkey::Mysql, VirtualMonkey::EBS
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
=== Cucumber feature tests
|
|
59
|
+
* Cucumber Features live in GEM_HOME/features
|
|
60
|
+
* These features can be run by hand -or- by CukeMonk via "monkey run" command.
|
|
61
|
+
* The features have one ENVIRONMENT variable that is used to pass in the Deployment nickname. To run by hand:
|
|
62
|
+
* "cucumber features/php.feature DEPLOYMENT=testing_deploy_x86_64"
|
|
63
|
+
=== A Feature will:
|
|
64
|
+
1) setup one-off variations using the VirtualMonkey::DeploymentRunner .
|
|
65
|
+
2) exercise a cluster deployment using the VirtualMonkey::DeploymentRunner.
|
|
66
|
+
|
|
67
|
+
== Note on Patches/Pull Requests
|
|
68
|
+
|
|
69
|
+
* Fork the project.
|
|
70
|
+
* Make your feature addition or bug fix.
|
|
71
|
+
* Commit, do not mess with rakefile, version, or history.
|
|
72
|
+
(if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
|
|
73
|
+
* Send me a pull request. Bonus points for topic branches.
|
|
74
|
+
|
|
75
|
+
== Copyright
|
|
76
|
+
|
|
77
|
+
Copyright (c) 2010 Jeremy Deininger. See LICENSE for details.
|
data/Rakefile
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
require 'rubygems'
|
|
2
|
+
require 'rake'
|
|
3
|
+
|
|
4
|
+
begin
|
|
5
|
+
require 'jeweler'
|
|
6
|
+
Jeweler::Tasks.new do |gem|
|
|
7
|
+
gem.name = "virtualmonkey"
|
|
8
|
+
gem.summary = %Q{testing cluster deployments}
|
|
9
|
+
gem.description = %Q{monkey see, monkey do, monkey repeat}
|
|
10
|
+
gem.email = "jeremy@rightscale.com"
|
|
11
|
+
gem.homepage = "http://github.com/jeremyd/virtualmonkey"
|
|
12
|
+
gem.authors = ["Jeremy Deininger"]
|
|
13
|
+
gem.add_development_dependency "rspec", ">= 1.2.9"
|
|
14
|
+
gem.add_development_dependency "jeweler"
|
|
15
|
+
gem.add_development_dependency "gemedit"
|
|
16
|
+
gem.add_dependency('json')
|
|
17
|
+
gem.add_dependency('trollop')
|
|
18
|
+
gem.add_dependency "rest_connection"
|
|
19
|
+
gem.add_dependency "fog"
|
|
20
|
+
gem.add_dependency "highline"
|
|
21
|
+
gem.add_dependency "rspec"
|
|
22
|
+
gem.add_dependency "eventmachine"
|
|
23
|
+
gem.add_dependency "right_popen"
|
|
24
|
+
gem.add_dependency "ruby-debug"
|
|
25
|
+
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
|
26
|
+
end
|
|
27
|
+
Jeweler::GemcutterTasks.new
|
|
28
|
+
rescue LoadError
|
|
29
|
+
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
#new rspec
|
|
33
|
+
#require 'rspec/core/rake_task'
|
|
34
|
+
#RSpec::Core::RakeTask.new do |t|
|
|
35
|
+
# t.rspec_opts = ["-c", "-f progress", "-r ./spec/spec_helper.rb"]
|
|
36
|
+
# t.pattern = 'spec/**/*_spec.rb'
|
|
37
|
+
#end
|
|
38
|
+
|
|
39
|
+
task :spec => :check_dependencies
|
|
40
|
+
|
|
41
|
+
task :default => :spec
|
|
42
|
+
|
|
43
|
+
require 'rake/rdoctask'
|
|
44
|
+
Rake::RDocTask.new do |rdoc|
|
|
45
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
|
46
|
+
|
|
47
|
+
rdoc.rdoc_dir = 'rdoc'
|
|
48
|
+
rdoc.title = "virtualmonkey #{version}"
|
|
49
|
+
rdoc.rdoc_files.include('README*')
|
|
50
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
|
51
|
+
end
|
data/VERSION
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
0.0.1
|
data/bin/grinder
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
# Development ENV only
|
|
4
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
|
5
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
|
6
|
+
###
|
|
7
|
+
|
|
8
|
+
require 'rubygems'
|
|
9
|
+
require 'virtualmonkey'
|
|
10
|
+
require 'ruby-debug'
|
|
11
|
+
|
|
12
|
+
usage = <<-EOS
|
|
13
|
+
After setting the 'DEPLOYMENT' and 'REST_CONNECTION_LOG' environment variables, run the grinder using:
|
|
14
|
+
|
|
15
|
+
grinder "testcase.rb" [breakline number]
|
|
16
|
+
|
|
17
|
+
DEVELOPERS: Grinder will drop you into ruby-debug at an exception. Setting the 'MONKEY_NO_DEBUG' environment variable will turn off this behavior.
|
|
18
|
+
|
|
19
|
+
Here are your environment variables:
|
|
20
|
+
export DEPLOYMENT=#{ENV['DEPLOYMENT']}
|
|
21
|
+
export REST_CONNECTION_LOG=#{ENV['REST_CONNECTION_LOG']}
|
|
22
|
+
export MONKEY_NO_DEBUG=#{ENV['MONKEY_NO_DEBUG']}
|
|
23
|
+
export MONKEY_NO_RESUME=#{ENV['MONKEY_NO_RESUME']}
|
|
24
|
+
EOS
|
|
25
|
+
|
|
26
|
+
raise usage unless ENV['DEPLOYMENT']
|
|
27
|
+
raise usage unless ARGV[0] and File.exist?(ARGV[0])
|
|
28
|
+
if ARGV[1]
|
|
29
|
+
@breakpoint = ARGV[1].to_i
|
|
30
|
+
else
|
|
31
|
+
@breakpoint = 1000000
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
@testcase = File.open(ARGV[0], "r")
|
|
35
|
+
testname = File.basename(ARGV[0])
|
|
36
|
+
|
|
37
|
+
linenum = 1
|
|
38
|
+
@resume = 0
|
|
39
|
+
|
|
40
|
+
# Should we resume?
|
|
41
|
+
test_states = "test_states"
|
|
42
|
+
state_dir = File.join(test_states, ENV['DEPLOYMENT'])
|
|
43
|
+
if File.directory?(state_dir)
|
|
44
|
+
unless ENV['MONKEY_NO_RESUME'] =~ /true/i
|
|
45
|
+
puts "Resuming previous testcase...\n"
|
|
46
|
+
@state_file = File.open(File.join(state_dir, testname), "r")
|
|
47
|
+
if @state_file.mtime < @testcase.mtime
|
|
48
|
+
puts "WARNING: testcase has been changed since state file."
|
|
49
|
+
puts "Scrapping previous testcase; Starting over...\n"
|
|
50
|
+
@state_file.close
|
|
51
|
+
File.delete(File.join(state_dir, testname))
|
|
52
|
+
else
|
|
53
|
+
begin
|
|
54
|
+
@resume += 1 if @state_file.readline
|
|
55
|
+
rescue EOFError => e
|
|
56
|
+
done = true
|
|
57
|
+
end while !done
|
|
58
|
+
@state_file.close
|
|
59
|
+
end
|
|
60
|
+
else
|
|
61
|
+
puts "Scrapping previous testcase; Starting over...\n"
|
|
62
|
+
File.delete(File.join(state_dir, testname))
|
|
63
|
+
end
|
|
64
|
+
else
|
|
65
|
+
Dir.mkdir(test_states) unless File.directory?(test_states)
|
|
66
|
+
Dir.mkdir(state_dir)
|
|
67
|
+
end
|
|
68
|
+
@state_file = File.open(File.join(state_dir, testname), "a")
|
|
69
|
+
|
|
70
|
+
# Grinding
|
|
71
|
+
done = false
|
|
72
|
+
timer = Time.now
|
|
73
|
+
begin
|
|
74
|
+
line = @testcase.readline
|
|
75
|
+
if line =~ /((=)|(set_var))/ or (@resume < linenum and linenum <= @breakpoint)
|
|
76
|
+
unless line =~ /^[ \t]*#/ or line =~ /^[ \t]*$/
|
|
77
|
+
puts("=" * line.length)
|
|
78
|
+
puts(line)
|
|
79
|
+
puts("=" * line.length)
|
|
80
|
+
line_timer = Time.now
|
|
81
|
+
eval(line)
|
|
82
|
+
line_elapsed = Time.now - line_timer
|
|
83
|
+
puts("Success. Time Elapsed: #{line_elapsed} seconds")
|
|
84
|
+
else
|
|
85
|
+
eval(line)
|
|
86
|
+
end
|
|
87
|
+
@state_file.syswrite(line) unless @resume > 0 and line =~ /((=)|(set_var))/
|
|
88
|
+
end
|
|
89
|
+
if linenum > @breakpoint
|
|
90
|
+
puts "Halting test at breakpoint (line #{@breakpoint})\n"
|
|
91
|
+
done = true
|
|
92
|
+
else
|
|
93
|
+
linenum += 1
|
|
94
|
+
end
|
|
95
|
+
rescue EOFError => e
|
|
96
|
+
@state_file.close
|
|
97
|
+
File.delete(File.join(state_dir, testname))
|
|
98
|
+
Dir.rmdir(state_dir)
|
|
99
|
+
done = true
|
|
100
|
+
end while !done
|
|
101
|
+
elapsed = Time.now - timer
|
|
102
|
+
puts "Total time elapsed: #{elapsed} seconds"
|
data/bin/mcicp
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
require 'rubygems'
|
|
4
|
+
require 'rest_connection'
|
|
5
|
+
require 'trollop'
|
|
6
|
+
require 'highline/import'
|
|
7
|
+
|
|
8
|
+
options = Trollop::options do
|
|
9
|
+
opt :from, "Copy MCIs from this Server Template (id)", :type => :integer, :required => :true
|
|
10
|
+
opt :to, "Copy MCIs to this Server Template (id)", :type => :integer, :required => :true
|
|
11
|
+
opt :nice, "Non-Destructive update of the destination Server Template"
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
class MciCp
|
|
15
|
+
def self.go(options)
|
|
16
|
+
temp1 = ServerTemplate.find(options[:from])
|
|
17
|
+
temp2 = ServerTemplate.find(options[:to])
|
|
18
|
+
from_st = ServerTemplateInternal.new(:href => temp1.href)
|
|
19
|
+
mci_payload = from_st.multi_cloud_images
|
|
20
|
+
to_st = ServerTemplateInternal.new(:href => temp2.href)
|
|
21
|
+
to_delete = to_st.multi_cloud_images
|
|
22
|
+
mci_payload.each do |mci|
|
|
23
|
+
begin
|
|
24
|
+
to_st.add_multi_cloud_image(mci['href'])
|
|
25
|
+
rescue => e
|
|
26
|
+
puts "image already added, skipping"
|
|
27
|
+
to_delete.delete(mci)
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
# TODO: need to set the 'right' default, but we can't lookup the default from the orig so we need some hax like a command line option regex for setting default (optional)
|
|
31
|
+
ubuntu_i386 = mci_payload.detect {|d| d['name'] =~ /Ubuntu.+i386/}
|
|
32
|
+
if ubuntu_i386
|
|
33
|
+
to_st.set_default_multi_cloud_image(ubuntu_i386['href'])
|
|
34
|
+
else
|
|
35
|
+
to_st.set_default_multi_cloud_image(mci_payload.first['href'])
|
|
36
|
+
end
|
|
37
|
+
unless options[:nice]
|
|
38
|
+
to_delete.each do |mci|
|
|
39
|
+
to_st.delete_multi_cloud_image(mci['href'])
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
puts 'done.'
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
MciCp.go(options)
|
data/bin/monkey
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
#!/usr/bin/ruby
|
|
2
|
+
|
|
3
|
+
require 'rubygems'
|
|
4
|
+
require 'rest_connection'
|
|
5
|
+
require 'trollop'
|
|
6
|
+
require 'highline/import'
|
|
7
|
+
|
|
8
|
+
options = Trollop::options do
|
|
9
|
+
opt :tag, "Tag of the DeploymentSet that you want to vary the sizes on", :type => :string, :required => true
|
|
10
|
+
opt :spot, "Use spot instances", :default => false
|
|
11
|
+
opt :micro_mayhem, "Set everything to Micros", :default => false
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
class VariationEngine
|
|
15
|
+
|
|
16
|
+
def initialize(options)
|
|
17
|
+
@options = options
|
|
18
|
+
@instance_vars32 = { "m1.small" => "0.095", "c1.medium" => "0.19" }
|
|
19
|
+
@instance_vars64 = { "m1.large" => "0.38", "m1.xlarge" => "0.76", "m2.xlarge" => "0.57", "m2.2xlarge" => "1.34", "m2.4xlarge" => "2.68", "c1.xlarge" => "0.76" }
|
|
20
|
+
if options[:micro_mayhem]
|
|
21
|
+
@instance_vars32 = { "t1.micro" => "0.02" }
|
|
22
|
+
@instance_vars64 = { "t1.micro" => "0.02" }
|
|
23
|
+
end
|
|
24
|
+
@deployments = Deployment.find_by(:nickname) {|n| n =~ /^#{@options[:tag]}/ }
|
|
25
|
+
puts "loading #{@deployments.size} deployments matching your tag #{@options[:tag]}"
|
|
26
|
+
return @deployments
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
# select different instance types for every server
|
|
30
|
+
def vary_instance_types
|
|
31
|
+
small_counter = 0
|
|
32
|
+
large_counter = 0
|
|
33
|
+
@deployments.each do |deployment|
|
|
34
|
+
deployment.servers_no_reload.each do |server|
|
|
35
|
+
server.reload
|
|
36
|
+
server.settings
|
|
37
|
+
server.parameters
|
|
38
|
+
if server.ec2_instance_type =~ /small/
|
|
39
|
+
small_counter += 1
|
|
40
|
+
new_type = @instance_vars32.keys[small_counter % @instance_vars32.size]
|
|
41
|
+
server.instance_type = new_type
|
|
42
|
+
server.max_spot_price = @instance_vars32[new_type] if @options[:spot]
|
|
43
|
+
elsif server.ec2_instance_type =~ /large/
|
|
44
|
+
large_counter += 1
|
|
45
|
+
new_type = @instance_vars64.keys[large_counter % @instance_vars64.size]
|
|
46
|
+
server.instance_type = new_type
|
|
47
|
+
server.max_spot_price = @instance_vars64[new_type] if @options[:spot]
|
|
48
|
+
end
|
|
49
|
+
server.pricing = "spot" if @options[:spot]
|
|
50
|
+
server.save
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
e = VariationEngine.new(options)
|
|
57
|
+
e.vary_instance_types
|
|
58
|
+
|
|
59
|
+
puts "Done."
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"1":{
|
|
3
|
+
"ec2_ssh_key_href":"https://my.rightscale.com/api/acct/2901/ec2_ssh_keys/7053",
|
|
4
|
+
"parameters":{
|
|
5
|
+
"PRIVATE_SSH_KEY":"key:publish-test:1"
|
|
6
|
+
},
|
|
7
|
+
"ec2_security_groups_href":"https://my.rightscale.com/api/acct/2901/ec2_security_groups/6411"
|
|
8
|
+
},
|
|
9
|
+
"2":{
|
|
10
|
+
"ec2_ssh_key_href":"https://my.rightscale.com/api/acct/2901/ec2_ssh_keys/198006",
|
|
11
|
+
"parameters":{
|
|
12
|
+
"PRIVATE_SSH_KEY":"key:publish-test-eu:2"
|
|
13
|
+
},
|
|
14
|
+
"ec2_security_groups_href":"https://my.rightscale.com/api/acct/2901/ec2_security_groups/48972"
|
|
15
|
+
},
|
|
16
|
+
"3":{
|
|
17
|
+
"ec2_ssh_key_href":"https://my.rightscale.com/api/acct/2901/ec2_ssh_keys/197758",
|
|
18
|
+
"parameters":{
|
|
19
|
+
"PRIVATE_SSH_KEY":"key:publish-test-west:3"
|
|
20
|
+
},
|
|
21
|
+
"ec2_security_groups_href":"https://my.rightscale.com/api/acct/2901/ec2_security_groups/97863"
|
|
22
|
+
},
|
|
23
|
+
"4":{
|
|
24
|
+
"ec2_ssh_key_href":"https://my.rightscale.com/api/acct/2901/ec2_ssh_keys/209603",
|
|
25
|
+
"parameters":{
|
|
26
|
+
"PRIVATE_SSH_KEY":"key:publish-test-ap:4"
|
|
27
|
+
},
|
|
28
|
+
"ec2_security_groups_href":"https://my.rightscale.com/api/acct/2901/ec2_security_groups/126284"
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
{
|
|
2
|
+
"3":{
|
|
3
|
+
"ec2_ssh_key_href":"https://my.rightscale.com/api/acct/2901/ec2_ssh_keys/197758",
|
|
4
|
+
"parameters":{
|
|
5
|
+
"PRIVATE_SSH_KEY":"key:publish-test-west:3"
|
|
6
|
+
},
|
|
7
|
+
"ec2_security_groups_href":"https://my.rightscale.com/api/acct/2901/ec2_security_groups/97863"
|
|
8
|
+
}
|
|
9
|
+
}
|