def test_ba_price_update(self): """ Tests that the AXBidVisor actually updates the pricing info. """ bidadv = AWSBidAdvisor(REFRESH_INTERVAL, REFRESH_INTERVAL, REGION) od_updater = bidadv.OnDemandUpdater(bidadv) od_updater.get_on_demand_pricing() sp_updater = bidadv.SpotInstancePriceUpdater(bidadv) sp_updater.get_spot_price_info() # Verify that the pricing info was populated. assert len(bidadv.on_demand_price_dict) > 0 assert len(bidadv.spot_price_list) > 0 # Make the price dicts empty to check if they get updated. bidadv.on_demand_price_dict = {} bidadv.spot_price_list = {} od_updater.get_on_demand_pricing() sp_updater.get_spot_price_info() # Verify that the pricing info is populated again. assert len(bidadv.on_demand_price_dict) > 0 assert len(bidadv.spot_price_list) > 0
def test_ba_on_demand_pricing(self): """ Tests that the AWSBidVisor correctly gets the on-demand pricing. """ bidadv = AWSBidAdvisor(REFRESH_INTERVAL, REFRESH_INTERVAL, REGION) assert len(bidadv.on_demand_price_dict) == 0 updater = bidadv.OnDemandUpdater(bidadv) updater.get_on_demand_pricing() assert len(bidadv.on_demand_price_dict) > 0
def test_ba_get_current_price(self): """ Tests that the BidAdvisor returns the most recent price information. """ bidadv = AWSBidAdvisor(REFRESH_INTERVAL, REFRESH_INTERVAL, REGION) od_updater = bidadv.OnDemandUpdater(bidadv) od_updater.get_on_demand_pricing() sp_updater = bidadv.SpotInstancePriceUpdater(bidadv) sp_updater.get_spot_price_info() # Verify that the pricing info was populated. assert len(bidadv.on_demand_price_dict) > 0 assert len(bidadv.spot_price_list) > 0 price_info_map = bidadv.get_current_price() assert price_info_map["spot"] is not None assert price_info_map["on-demand"] is not None