Skip to content
This repository has been archived by the owner on Jun 22, 2023. It is now read-only.

Commit

Permalink
Updating tests to catch issue with pricing getting reversed for GovCloud
Browse files Browse the repository at this point in the history
  • Loading branch information
BrindleFly committed Apr 15, 2014
1 parent b9c241c commit 73a610f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
6 changes: 6 additions & 0 deletions lib/amazon-pricing/ec2-instance-type.rb
@@ -1,6 +1,12 @@
require 'amazon-pricing/instance-type'
module AwsPricing
class Ec2InstanceType < InstanceType

# Returns OperatingSystem pricing
# e.g. :linux
def get_operating_system(type)
get_category_type(type)
end

# Returns whether an instance_type is available.
# operating_system = :linux, :mswin, :rhel, :sles, :mswinSQL, :mswinSQLWeb
Expand Down
18 changes: 14 additions & 4 deletions test/govcloud_test.rb
Expand Up @@ -23,20 +23,20 @@ def startup
end

def test_cc8xlarge_issue
obj = @@ec2_pricing.get_instance_type('us-gov-west-1', 'cc2.8xlarge')
assert obj.api_name == 'cc2.8xlarge'
obj = @@ec2_pricing.get_instance_type('us-gov-west-1', 'm3.large')
assert obj.api_name == 'm3.large'
end

def test_memory
# Validate instance types in specific regions are available
region = @@ec2_pricing.get_region('us-gov-west-1')
instance = region.get_ec2_instance_type('m1.large')
instance = region.get_ec2_instance_type('m3.large')
assert instance.memory_in_mb == 7500
end

def test_virtual_cores
region = @@ec2_pricing.get_region('us-gov-west-1')
instance = region.get_ec2_instance_type('m1.large')
instance = region.get_ec2_instance_type('m3.large')
assert instance.virtual_cores == 2
end

Expand All @@ -49,4 +49,14 @@ def test_ebs
assert region.ebs_price.s3_snaps_per_gb == 0.125
end

# Defect found in which ordering of price per hour and upfront get reversed
def test_ri_pricing
region = @@ec2_pricing.get_region('us-gov-west-1')
instance = region.get_ec2_instance_type('m3.large')
os = instance.get_operating_system(:linux)
assert os.ondemand_price_per_hour == 0.168
assert os.light_prepay_1_year == 300.0
assert os.light_price_per_hour_1_year == 0.167
end

end

0 comments on commit 73a610f

Please sign in to comment.