示例#1
0
 def test_get_cloud_account_overview_with_openshift_and_rhel_image(self):
     """Assert an account overview reports openshift and rhel correctly."""
     powered_times = (
         (
             util_helper.utc_dt(2018, 1, 10, 0, 0, 0),
             util_helper.utc_dt(2018, 1, 10, 5, 0, 0)
         ),
     )
     account_helper.generate_aws_instance_events(
         self.instance_1, powered_times,
         self.windows_image.ec2_ami_id
     )
     # in addition to instance_1's events, we are creating an event for
     # instance_2 with a rhel & openshift_image
     account_helper.generate_single_aws_instance_event(
         self.instance_2, self.start, InstanceEvent.TYPE.power_on,
         self.openshift_and_rhel_image.ec2_ami_id)
     overview = reports.get_account_overview(
         self.account, self.start, self.end)
     # we expect to find 2 total images, 2 total instances, 1 rhel instance
     # and 1 openshift instance
     self.assertExpectedAccountOverview(overview, self.account,
                                        images=2, instances=2,
                                        rhel_instances=1,
                                        openshift_instances=1)
示例#2
0
 def test_get_cloud_account_overview_with_openshift(self):
     """Assert an account overview reports openshift correctly."""
     # generate event for instance_1 with the rhel/openshift image
     account_helper.generate_single_aws_instance_event(
         self.instance_1, self.start, InstanceEvent.TYPE.power_on,
         self.openshift_and_rhel_image.ec2_ami_id)
     # generate event for instance_2 with the openshift image
     account_helper.generate_single_aws_instance_event(
         self.instance_2, self.start, InstanceEvent.TYPE.power_on,
         self.openshift_image.ec2_ami_id)
     overview = reports.get_account_overview(
         self.account, self.start, self.end)
     # assert that we only find the two openshift images
     self.assertExpectedAccountOverview(overview, self.account,
                                        images=2, instances=2,
                                        rhel_instances=1,
                                        openshift_instances=2)
示例#3
0
    def test_validate_event_off_before_start(self):
        """Test that an off event before start is not a valid event."""
        powered_time = util_helper.utc_dt(2017, 12, 10, 0, 0, 0)

        event = account_helper.generate_single_aws_instance_event(
            self.instance_1, powered_time, InstanceEvent.TYPE.power_off
        )
        is_valid = reports.validate_event(event, self.start)
        self.assertEqual(is_valid, False)
示例#4
0
    def test_validate_event_on_after_start(self):
        """Test that an on event after start is a valid event to inspect."""
        powered_time = util_helper.utc_dt(2018, 1, 10, 0, 0, 0)

        event = account_helper.generate_single_aws_instance_event(
            self.instance_1, powered_time, InstanceEvent.TYPE.power_on
        )
        is_valid = reports.validate_event(event, self.start)
        self.assertEqual(is_valid, True)