Module: BigBang::TestCmd

Included in:
Universe
Defined in:
lib/bigbang/test.rb

Instance Method Summary collapse

Instance Method Details

#testObject



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/bigbang/test.rb', line 36

def test
	notify("Testing EC2 access") do
		get_instances
	end

	notify("Testing configured availability zones") do
		test_availability_zones
	end

	notify("Testing configured AMI's") do
		test_amis
	end
	
	notify("Testing DNS API access") do
		test_dns
	end
end

#test_amisObject



20
21
22
23
24
25
26
27
28
# File 'lib/bigbang/test.rb', line 20

def test_amis
	@instances.collect { |i| i.ami }.to_set.each do |ami|
		begin
			provider.ec2.describe_images(:image_id => [ami])
		rescue AWS::InvalidAMIIDNotFound => e
			raise "ami #{ami} not found"
		end
	end
end

#test_availability_zonesObject



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/bigbang/test.rb', line 3

def test_availability_zones
	zones = Set.new
	@runs.each do |r|
		r.zone_sizes.each_key do |k|
			zones << k
		end
	end

	return if zones.empty?
	ec2_zones = get_availability_zones
	zones.each do |zone|
		unless ec2_zones.find { |z| z.zoneName == zone}
			raise "zone '#{zone}' not found"
		end
	end
end

#test_dnsObject



30
31
32
33
34
# File 'lib/bigbang/test.rb', line 30

def test_dns
	if provider.configured_zone.nil?
		raise "Configured DNS domain zone not found"
	end
end